gxd-uni-library-editx 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/.editorconfig +14 -0
  2. package/README.md +447 -0
  3. package/index.js +3 -0
  4. package/package.json +104 -0
  5. package/postcss.config.js +22 -0
  6. package/settings.js.tpl +68 -0
  7. package/src/XdAppClass.1.0.js +257 -0
  8. package/src/XdAppClass.js +150 -0
  9. package/src/components/XdAddress/XdAddress.vue +579 -0
  10. package/src/components/XdAddressSelect/XdAddressSelect.vue +243 -0
  11. package/src/components/XdBaiduMap/XdBaiduMap.vue +204 -0
  12. package/src/components/XdBaiduOverlay/XdBaiduOverlay.vue +345 -0
  13. package/src/components/XdBaiduSearch/XdBaiduSearch.vue +354 -0
  14. package/src/components/XdBar/XdBar.vue +339 -0
  15. package/src/components/XdButton/XdButton.vue +288 -0
  16. package/src/components/XdCartList/XdCartList.vue +791 -0
  17. package/src/components/XdCartNoStoreList/XdCartNoStoreList.vue +747 -0
  18. package/src/components/XdCity/XdCity.vue +620 -0
  19. package/src/components/XdCity/city.js +93 -0
  20. package/src/components/XdCity/testData.js +124 -0
  21. package/src/components/XdCityLocation/XdCityLocation.vue +314 -0
  22. package/src/components/XdCityLocation/jweixin.js +72 -0
  23. package/src/components/XdCityShow/XdCityShow.vue +354 -0
  24. package/src/components/XdClipImage/XdClipImage.vue +879 -0
  25. package/src/components/XdCoins/XdCoins.vue +66 -0
  26. package/src/components/XdConfirm/XdConfirm.vue +240 -0
  27. package/src/components/XdContentXss/XdContentXss.vue +71 -0
  28. package/src/components/XdDailog/XdDailog.vue +258 -0
  29. package/src/components/XdDate/XdDataItemOne.vue +236 -0
  30. package/src/components/XdDate/XdDate.vue +1081 -0
  31. package/src/components/XdDate/XdDateItem.vue +316 -0
  32. package/src/components/XdDate/XdDateTime.vue +929 -0
  33. package/src/components/XdDate/i18n/en.json +19 -0
  34. package/src/components/XdDate/i18n/index.js +8 -0
  35. package/src/components/XdDate/i18n/zh-Hans.json +19 -0
  36. package/src/components/XdDate/i18n/zh-Hant.json +19 -0
  37. package/src/components/XdDate/keypress.js +45 -0
  38. package/src/components/XdDate/util.js +418 -0
  39. package/src/components/XdDownDrawer/XdDownDrawer.vue +176 -0
  40. package/src/components/XdEditPwd/XdEditPwd.vue +305 -0
  41. package/src/components/XdEnterOrderList/XdEnterOrderList.vue +413 -0
  42. package/src/components/XdExpressTimeLine/XdExpressTimeLine.vue +280 -0
  43. package/src/components/XdFilter/XdFilter.vue +541 -0
  44. package/src/components/XdFontIcon/XdFontIcon.vue +165 -0
  45. package/src/components/XdFontIcon/css/icon.less +498 -0
  46. package/src/components/XdFooterBar/XdFooterBar.vue +291 -0
  47. package/src/components/XdFooterTabbar/XdFooterTabbar.vue +284 -0
  48. package/src/components/XdForm/XdForm.vue +481 -0
  49. package/src/components/XdForm/validate.js +486 -0
  50. package/src/components/XdFormCheckbox/XdFormCheckbox.vue +858 -0
  51. package/src/components/XdFormDate.vue +187 -0
  52. package/src/components/XdFormInput/XdFormInput.vue +535 -0
  53. package/src/components/XdFormInput/common.js +56 -0
  54. package/src/components/XdFormItem/XdFormItem.vue +583 -0
  55. package/src/components/XdFormSelect/XdFormSelect.vue +119 -0
  56. package/src/components/XdImage/XdImage.vue +113 -0
  57. package/src/components/XdItemCardUser/XdItemCardUser.vue +232 -0
  58. package/src/components/XdItemFilmImage/XdItemFilmImage.vue +146 -0
  59. package/src/components/XdItemFilmText/XdItemFilmText.vue +83 -0
  60. package/src/components/XdItemPhysical/XdItemPhysical.vue +410 -0
  61. package/src/components/XdItemPhysicalPack/XdItemPhysicalPack.vue +240 -0
  62. package/src/components/XdItemStore/XdItemStore.vue +236 -0
  63. package/src/components/XdItemUserInfo/XdItemUserInfo.vue +175 -0
  64. package/src/components/XdJson/XdJson.vue +398 -0
  65. package/src/components/XdKeyValue/XdKeyValue.vue +150 -0
  66. package/src/components/XdLabelNew/XdLabelNew.vue +193 -0
  67. package/src/components/XdLayout/XdLayout.vue +634 -0
  68. package/src/components/XdLoading/XdLoading.vue +165 -0
  69. package/src/components/XdMore/XdMore.vue +66 -0
  70. package/src/components/XdMpHtml/XdMpHtml.vue +458 -0
  71. package/src/components/XdMpHtml/node/node.vue +536 -0
  72. package/src/components/XdMpHtml/parser.js +1260 -0
  73. package/src/components/XdMpHtml/static/js/handler.js +1 -0
  74. package/src/components/XdMpHtml/static/js/uni.webview.min.js +1 -0
  75. package/src/components/XdMpHtml/static/local.html +1 -0
  76. package/src/components/XdMy/XdMy.vue +294 -0
  77. package/src/components/XdMySuccess/XdMySuccess.vue +603 -0
  78. package/src/components/XdNavTab/XdNavTab.vue +147 -0
  79. package/src/components/XdNoData/XdNoData.vue +87 -0
  80. package/src/components/XdNoticeBar/XdNoticeBar.vue +501 -0
  81. package/src/components/XdNumber/XdNumber.vue +210 -0
  82. package/src/components/XdNumberUni/XdNumberUni.vue +270 -0
  83. package/src/components/XdNumberUni/readme.md +42 -0
  84. package/src/components/XdOnlineConfirm/XdOnlineConfirm.vue +385 -0
  85. package/src/components/XdOnlineDetail/XdOnlineDetail.vue +332 -0
  86. package/src/components/XdOnlinePay/XdOnlinePay.vue +349 -0
  87. package/src/components/XdOnlineSchedule/XdOnlineSchedule.vue +453 -0
  88. package/src/components/XdOnlineSeat/XdOnlineSeat.vue +796 -0
  89. package/src/components/XdOnlineSeatMove/XdOnlineSeatMove.vue +1012 -0
  90. package/src/components/XdPayCombo/XdPayCombo.vue +118 -0
  91. package/src/components/XdPreviewImage/XdPreviewImage.vue +372 -0
  92. package/src/components/XdPwPay/XdPwPay.vue +214 -0
  93. package/src/components/XdRadio/XdRadio.vue +151 -0
  94. package/src/components/XdRangeSlider/XdRangeSlider.vue +355 -0
  95. package/src/components/XdRedName/XdRedName.vue +35 -0
  96. package/src/components/XdSearchBar/XdSearchBar.vue +286 -0
  97. package/src/components/XdSelect/XdSelect.vue +382 -0
  98. package/src/components/XdSelectCity/XdSelectCity.vue +270 -0
  99. package/src/components/XdSelectTime/XdSelectTime.vue +342 -0
  100. package/src/components/XdStar/XdStar.vue +261 -0
  101. package/src/components/XdStoreCashier/XdStoreCashier.vue +526 -0
  102. package/src/components/XdStoreItem/XdStoreItem.vue +400 -0
  103. package/src/components/XdStoreOrderDetail/XdStoreOrderDetail.vue +1571 -0
  104. package/src/components/XdStoreOrderList/XdStoreOrderList.vue +450 -0
  105. package/src/components/XdStoreProductInfo/XdStoreProductInfo.vue +940 -0
  106. package/src/components/XdStoreProductType/XdStoreProductType.vue +307 -0
  107. package/src/components/XdSuccess/XdSuccess.vue +527 -0
  108. package/src/components/XdSwipeSelect/XdSwipeSelect.vue +99 -0
  109. package/src/components/XdSwiper/XdSwiper.vue +124 -0
  110. package/src/components/XdSwitch/XdSwitch.vue +204 -0
  111. package/src/components/XdTab/XdTab.vue +220 -0
  112. package/src/components/XdTabScroll/XdTabScroll.vue +212 -0
  113. package/src/components/XdTag/XdTag.vue +423 -0
  114. package/src/components/XdTimeLine/XdTimeLine.vue +121 -0
  115. package/src/components/XdTips/XdTips.vue +212 -0
  116. package/src/components/XdTipsBlock/XdTipsBlock.vue +141 -0
  117. package/src/components/XdTitleSection/XdTitleSection.vue +152 -0
  118. package/src/components/XdTitleTab/XdTitleTab.vue +227 -0
  119. package/src/components/XdUnit/XdUnit.vue +206 -0
  120. package/src/components/XdUpload/XdUpload.vue +197 -0
  121. package/src/components/XdUploadImage/XdUploadImage.vue +145 -0
  122. package/src/components/Xdlogs/XdLogs.vue +144 -0
  123. package/src/components/autoload.js +211 -0
  124. package/src/components/swipeAction/UniSwipeAction.vue +43 -0
  125. package/src/components/swipeActionItem/UniSwipeActionItem.vue +386 -0
  126. package/src/components/swipeActionItem/bindingx.js +298 -0
  127. package/src/components/swipeActionItem/index.wxs +321 -0
  128. package/src/components/swipeActionItem/isPC.js +18 -0
  129. package/src/components/swipeActionItem/mpalipay.js +210 -0
  130. package/src/components/swipeActionItem/mpother.js +252 -0
  131. package/src/components/swipeActionItem/mpwxs.js +140 -0
  132. package/src/dome/dome/address.vue +415 -0
  133. package/src/dome/dome/auth/login.vue +166 -0
  134. package/src/dome/dome/baidu_show.vue +20 -0
  135. package/src/dome/dome/cake.vue +186 -0
  136. package/src/dome/dome/cart.vue +205 -0
  137. package/src/dome/dome/cart_store.vue +149 -0
  138. package/src/dome/dome/cashier/cashier.vue +73 -0
  139. package/src/dome/dome/cashier/check_cashier.vue +469 -0
  140. package/src/dome/dome/cashier/success.vue +127 -0
  141. package/src/dome/dome/city.vue +148 -0
  142. package/src/dome/dome/cityData.js +9 -0
  143. package/src/dome/dome/clip.vue +82 -0
  144. package/src/dome/dome/date/date.vue +273 -0
  145. package/src/dome/dome/date/selected.js +315 -0
  146. package/src/dome/dome/dcom/app1.vue +13 -0
  147. package/src/dome/dome/dcom/app2.vue +13 -0
  148. package/src/dome/dome/dcom/app3.vue +13 -0
  149. package/src/dome/dome/dcom/app4.vue +13 -0
  150. package/src/dome/dome/dcom/app5.vue +13 -0
  151. package/src/dome/dome/dcom/index.vue +1 -0
  152. package/src/dome/dome/debug/debug.vue +95 -0
  153. package/src/dome/dome/docache/docache.vue +88 -0
  154. package/src/dome/dome/express.vue +269 -0
  155. package/src/dome/dome/form.vue +312 -0
  156. package/src/dome/dome/icon.js +125 -0
  157. package/src/dome/dome/icon.vue +93 -0
  158. package/src/dome/dome/index.vue +725 -0
  159. package/src/dome/dome/item.vue +236 -0
  160. package/src/dome/dome/json/json.vue +88 -0
  161. package/src/dome/dome/layout.vue +105 -0
  162. package/src/dome/dome/line.vue +113 -0
  163. package/src/dome/dome/map/search.vue +70 -0
  164. package/src/dome/dome/my.vue +171 -0
  165. package/src/dome/dome/notice.vue +93 -0
  166. package/src/dome/dome/online/confirm.vue +92 -0
  167. package/src/dome/dome/online/detail.vue +80 -0
  168. package/src/dome/dome/online/pay.vue +78 -0
  169. package/src/dome/dome/online/schedule.vue +73 -0
  170. package/src/dome/dome/online/seat.vue +98 -0
  171. package/src/dome/dome/order/detail.vue +166 -0
  172. package/src/dome/dome/order/enter_order.vue +294 -0
  173. package/src/dome/dome/order/list.vue +219 -0
  174. package/src/dome/dome/order/order.js +18 -0
  175. package/src/dome/dome/order/success.vue +68 -0
  176. package/src/dome/dome/product.vue +179 -0
  177. package/src/dome/dome/store_cashier.vue +67 -0
  178. package/src/dome/dome/swiper.vue +32 -0
  179. package/src/dome/dome/webview.vue +61 -0
  180. package/src/install.js +183 -0
  181. package/src/main/address/address.vue +251 -0
  182. package/src/main/cart/cart.vue +149 -0
  183. package/src/main/cashier/cashier.vue +72 -0
  184. package/src/main/cashier/check_cashier.vue +483 -0
  185. package/src/main/city/city.vue +149 -0
  186. package/src/main/date/date.vue +260 -0
  187. package/src/main/order/order.js +19 -0
  188. package/src/main/order/order.vue +222 -0
  189. package/src/main/product/detail.vue +121 -0
  190. package/src/main/product/type.vue +108 -0
  191. package/src/main/search/search.vue +501 -0
  192. package/src/pages.json +337 -0
  193. package/src/plugins/CreatedComponentsPlugin.js +19 -0
  194. package/src/plugins/JsonRename.js +72 -0
  195. package/src/plugins/SetAppParams.js +171 -0
  196. package/src/project.js +18 -0
  197. package/src/utils/Cookie.js +68 -0
  198. package/src/utils/Runtime.js +105 -0
  199. package/src/utils/Storage.js +104 -0
  200. package/src/utils/XdNetwork.js +133 -0
  201. package/src/utils/helper.js +1321 -0
  202. package/src/utils/nourl.js +95 -0
  203. package/src/utils/project.js +17 -0
  204. package/src/utils/xd.auth.js +61 -0
  205. package/src/utils/xd.base.js +474 -0
  206. package/src/utils/xd.common.js +240 -0
  207. package/src/utils/xd.event.js +99 -0
  208. package/src/utils/xd.frame.js +96 -0
  209. package/src/utils/xd.path.js +96 -0
  210. package/src/utils/xdAppLog.js +170 -0
  211. package/src/utils/xdWxLog.js +302 -0
  212. package/src/utils/xdh5log.js +307 -0
  213. package/src/websetting.js +64 -0
  214. package/tsconfig.json +9 -0
  215. package/xd.less +180 -0
@@ -0,0 +1,791 @@
1
+ <template>
2
+ <view class="xd-store-cart" v-if="dataList.length > 0">
3
+ <view
4
+ class="xd-store-cart__item"
5
+ v-for="(item,index) in dataList"
6
+ :key="index"
7
+ >
8
+ <view class="xd-store-cart__store">
9
+ <view class="xd-store-cart__store-radio">
10
+ <xd-radio
11
+ size="mini"
12
+ :color="uiColor"
13
+ v-model="item.shop_selected"
14
+ @change="handleChangeToAll(item)"
15
+ ></xd-radio>
16
+ </view>
17
+ <view class="xd-store-cart__store-name">{{item.shop_name}}</view>
18
+ <view class="xd-store-cart__store-line" :style="{background: $mainColor}"></view>
19
+ </view>
20
+ <view class="xd-store-cart__products">
21
+ <uni-swipe-action>
22
+ <uni-swipe-action-item
23
+ :right-options="options"
24
+ @click="(e)=>{bindClick(e,product,item,idx,index)}"
25
+ @change="swipeChange(product,idx)"
26
+ v-for="(product,idx) in item['products']"
27
+ :key="product.key"
28
+ >
29
+ <view class="xd-store-cart__products-item">
30
+ <view class="xd-store-cart__products-item-radio">
31
+ <xd-radio
32
+ :color="uiColor"
33
+ :disabled="!(product['status'] === status)"
34
+ @change="handleProductChange(item)"
35
+ size="mini"
36
+ v-model="product.checked"
37
+ ></xd-radio>
38
+ </view>
39
+ <view
40
+ class="xd-store-cart__products-item-icon"
41
+ @click="toDetial(product,item)"
42
+ :style="{width: productWidth + 'rpx', height: productHeight + 'rpx'}"
43
+ >
44
+ <xd-image
45
+ mode="scaleToFill"
46
+ :width="productWidth"
47
+ :height="productHeight"
48
+ :image="product['thumb']"
49
+ ></xd-image>
50
+ <view
51
+ v-if="product['status'] !== status && product['msg']"
52
+ class="xd-store-cart__products-item-icon-tips"
53
+ >
54
+ <view>{{product['msg']}}</view>
55
+ </view>
56
+ </view>
57
+ <view
58
+ class="xd-store-cart__products-item-body"
59
+ @click="toDetial(product,item)"
60
+ >
61
+ <view class="xd-store-cart__products-item-body-name" >{{product['product_name']}}</view>
62
+ <view class="xd-store-cart__products-item-body-sku">{{product['product_sku_text']}}</view>
63
+ <view class="xd-store-cart__products-item-body-price">
64
+ <xd-unit :price="getProductPrice(product['price'])" unit="点" :iocn-size="0.4"></xd-unit>
65
+ </view>
66
+ </view>
67
+ <view class="xd-store-cart__products-item-number">
68
+ <xd-number-uni
69
+ :disabled="product['status'] !== status"
70
+ @change="(value)=>{handleAddChange(product, idx , item, index,value)}"
71
+ :min="min"
72
+ :max="max"
73
+ v-model="product['num']"
74
+ ></xd-number-uni>
75
+ </view>
76
+ </view>
77
+ </uni-swipe-action-item>
78
+ </uni-swipe-action>
79
+ </view>
80
+ <view v-if="0" class="xd-store-cart__btn">
81
+ <view>不含运费</view>
82
+ <view>合计:</view>
83
+ <view>
84
+ <xd-unit :price="getProductPrice(item['totalPrice'])" :font-size="36" unit="点" :iocn-size=".5"></xd-unit>
85
+ </view>
86
+ <view>
87
+ <xd-button btn-type="primary" radius="18rpx" @click="toConfirm(item)" size="mini">结算</xd-button>
88
+ </view>
89
+ <view class="xd-store-cart__btn-line" :style="{background: $mainColor}"></view>
90
+ </view>
91
+ </view>
92
+ </view>
93
+ </template>
94
+
95
+ <script>
96
+ import XdRadio from "@/components/XdRadio/XdRadio";
97
+ import XdNumberUni from "@/components/XdNumberUni/XdNumberUni";
98
+ import xdImage from "@/components/XdImage/XdImage";
99
+ import XdUnit from "@/components/XdUnit/XdUnit";
100
+ import UniSwipeActionItem from "@/components/swipeActionItem/UniSwipeActionItem";
101
+ import UniSwipeAction from "@/components/swipeAction/UniSwipeAction";
102
+ import XdMore from "@/components/XdMore/XdMore";
103
+ import XdButton from "@/components/XdButton/XdButton";
104
+ import XdImage from "@/components/XdImage/XdImage";
105
+
106
+ /**
107
+ * @description 带店铺商品信息 (XdCartList)
108
+ * @property radioColor {String} 选中按钮颜色值 默认:$mainColor
109
+ * @property isCannelBtn {Boolean} 滑动显示按钮 默认:65%
110
+ * @property confirmText {String} 确认按钮文本 默认:删除
111
+ * @property isAll {String} 是否全选 默认:true
112
+ * @property productWidth {Number} 产品图宽度 默认:180 单位:rpx
113
+ * @property productHeight {Number} 产品图高度 默认:138 单位:rpx
114
+ * @property min {Number} 购物车购买最小数量 默认:1
115
+ * @property max {Number} 购物车购买最大数量 默认:10
116
+ *
117
+ * @event {Function} onSelect 选中商品事件
118
+ * @event {Function} onCurtRemove 滑选删除事件
119
+ * @event {Function} onCurtSetNumber 重置数量事件
120
+ * @event {Function} onCartList 获取购物车列表数据
121
+ * @event {onPay} onPay 点击结算按钮事件
122
+ *
123
+ * @method {Function} setIsAll 设置全选/取消方法(this.$refs['xd-store-cart'].setIsAll(status);
124
+ */
125
+
126
+ export default {
127
+ name: "XdCartList",
128
+ components: {
129
+ XdImage,
130
+ XdButton,
131
+ XdMore,
132
+ XdUnit,
133
+ xdImage,
134
+ XdNumberUni,
135
+ XdRadio,
136
+ UniSwipeActionItem,
137
+ UniSwipeAction
138
+ },
139
+ props:{
140
+ radioColor: {
141
+ type: String,
142
+ default: '',
143
+ },
144
+ confirmText:{
145
+ type: String,
146
+ default: ''
147
+ },
148
+ isCannelBtn: {
149
+ type: Boolean,
150
+ default: false,
151
+ },
152
+ isAll: {
153
+ type: Boolean,
154
+ default: true,
155
+ },
156
+ productWidth: {
157
+ type: Number,
158
+ default: 180
159
+ },
160
+ productHeight: {
161
+ type: Number,
162
+ default: 138
163
+ },
164
+ min: {
165
+ type: Number,
166
+ default: 1,
167
+ },
168
+ max: {
169
+ type: Number,
170
+ default: 10,
171
+ },
172
+ },
173
+
174
+ data(){
175
+ return {
176
+ status: 1, //商品在线
177
+ uiColor: '', //主色调
178
+ options: [
179
+ {text: '取消', type: 'cannel', style: {backgroundColor: '#ccc', padding: '0 30rpx'}},
180
+ {text: '删除', type: 'confirm', style: {backgroundColor: 'red'}}
181
+ ],
182
+ storeTestSourceDataList: [
183
+ {
184
+ "shop_id": 3389,
185
+ "shop_name": "\u5fa1\u8776\u574a(\u516c\u660e\u5e97)(\u5149\u660e\u65b0)",
186
+ "shop_icon": "http:\/\/image.58yuecai.com\/img\/202008250\/4.jpg?x-oss-process=style\/200_200",
187
+ "products": [
188
+ {
189
+ "product_uuid": "759255d2-66db-11eb-9776-ae2a2986c9fc",
190
+ "product_id": 6935,
191
+ "product_sku": 16017,
192
+ "product_sku_text": "1\u78c5\n\t",
193
+ "product_name": "\u840c\u5ba0\u5154\u5154\u840c\u5ba0\u5154\u5154\u840c\u5ba0\u5154\u5154\u840c\u5ba0\u5154\u5154",
194
+ "thumb": "http:\/\/image.58yuecai.com\/img\/20200811\/254.jpg?x-oss-process=style\/200_200",
195
+ "price": 138.13,
196
+ "status": 0, //商品是否已下架 1=>正常 0=>异常
197
+ 'msg': '补货中', //补货中 已下架,
198
+ "num": 1
199
+ },
200
+ {
201
+ "product_uuid": "7592564a-66db-11eb-b2e4-ae2a2986c9fc",
202
+ "product_id": 6936,
203
+ "product_sku": 16020,
204
+ "product_sku_text": "1\u78c5\n\t",
205
+ "product_name": "\u5bff\u6bd4\u5357\u5c71",
206
+ "thumb": "http:\/\/image.58yuecai.com\/img\/20200811\/271.jpg?x-oss-process=style\/200_200",
207
+ "price": 13800,
208
+ "status": 0, //商品是否已下架
209
+ 'msg': '补货中', //补货中 已下架,
210
+ "num": 1
211
+ }
212
+ ]
213
+ },
214
+ {
215
+ "shop_id": 1591,
216
+ "shop_name": "\u5e78\u798f\u897f\u997c\u5eca\u574a\u5e97",
217
+ "shop_icon": "https:\/\/jfbcake.oss-cn-beijing.aliyuncs.com\/uploads\/20200826\/733372b7f9022ce6c127ffbe03c54cb5.jpg?x-oss-process=style\/200_200",
218
+ "products": [
219
+ {
220
+ "product_uuid": "e80e5fc8-ec26-11ea-9303-fabb3051d9e2",
221
+ "product_id": 2929,
222
+ "product_sku": 5693,
223
+ "product_sku_text": "8\u82f1\u5bf8",
224
+ "product_name": "\u51b0\u8bed\u7425\u73c0",
225
+ "thumb": "https:\/\/jfbcake.oss-cn-beijing.aliyuncs.com\/uploads\/20200709\/d924c414e7d57a1cb9e1e1109f8a83c7.jpg?x-oss-process=style\/200_200",
226
+ "price": 12900,
227
+ "status": 0,
228
+ 'msg': '补货中', //补货中 已下架,
229
+ "num": 1
230
+ },
231
+ {
232
+ "product_uuid": "0aaac314-ec27-11ea-bc14-fabb3051d9e2",
233
+ "product_id": 2930,
234
+ "product_sku": 5694,
235
+ "product_sku_text": "1\u78c5",
236
+ "product_name": "\u8292\u8292\u590f\u65e5",
237
+ "thumb": "https:\/\/jfbcake.oss-cn-beijing.aliyuncs.com\/uploads\/20200709\/e8762830c4914cb0fb698de13fff32a0.jpg?x-oss-process=style\/200_200",
238
+ "price": 12900,
239
+ "status": 1,
240
+ "num": 1
241
+ }
242
+ ],
243
+ },
244
+ ], //测试数据
245
+ dataList:[], //列表数据
246
+ }
247
+ },
248
+ created(){
249
+ this.uiColor = this.$mainColor;
250
+ if (this.radioColor) {
251
+ this.uiColor = this.radioColor;
252
+ }
253
+
254
+ //设置背景色
255
+ let tempOptions = [];
256
+ this.options.map((item)=>{
257
+ if(!this.isCannelBtn && item.type === 'cannel') {
258
+ return;
259
+ }
260
+ if(item.type === 'confirm') {
261
+ if(this.confirmText) {
262
+ item['text'] = this.confirmText;
263
+ }
264
+ tempOptions.push({...item, style: {backgroundColor: this.uiColor}}) ;
265
+ }else{
266
+ tempOptions.push(item);
267
+ }
268
+ });
269
+ this.options = tempOptions;
270
+
271
+ //获取购物车列表数据
272
+ this.getList();
273
+
274
+ },
275
+ methods:{
276
+ /**
277
+ * @description 获取商品价格(价格为整数)比如:5.32 = 532
278
+ */
279
+ getProductPrice(price){
280
+ return this.$xdUniHelper.divisionFloatNumber(price, 100);
281
+ },
282
+
283
+ /**
284
+ * @description 设置全选操作
285
+ */
286
+ setIsAll(value){
287
+ let list = [];
288
+ this.dataList.map((item) => {
289
+ let products = [];
290
+ item['shop_selected'] = value;
291
+ item.products.map((it) => {
292
+ if (it['status'] === this.status) {
293
+ it['checked'] = value;
294
+ }
295
+ products.push(it);
296
+ });
297
+ let temp = {...item, products};
298
+ this.resComputedPrice(temp)
299
+ list.push(temp);
300
+ });
301
+ this.dataList = list;
302
+ this.computedInit();
303
+ },
304
+
305
+ /**
306
+ * @description 初始化数据
307
+ * @param list
308
+ */
309
+ init(list) {
310
+ let data = list || this.$xdUniHelper.cloneDeep(this.storeTestSourceDataList);
311
+ let temp = [];
312
+ try {
313
+ data.map((item, i) => {
314
+ let tempProduct = [];
315
+ if (!item['shop_id']) {
316
+ throw new Error(`list[${i}]['shop_id] is require`);
317
+ }
318
+ if (!item['shop_name']) {
319
+ throw new Error(`list[${i}]['shop_name'] is require`);
320
+ }
321
+ if (!item['products']) {
322
+ throw new Error(`list[${i}]['products'] is require`);
323
+ }
324
+ let totalPrice = 0;
325
+ let shop_selected = [];
326
+ let shop_able = [];
327
+ item.products.map((product, index) => {
328
+ if (!product['product_uuid']) {
329
+ throw new Error(`list[${i}]['products'][${index}]['product_uuid'] is require`);
330
+ }
331
+ if (!product['product_id']) {
332
+ throw new Error(`list[${i}]['products'][${index}]['product_id'] is require`);
333
+ }
334
+ if (!product['product_name']) {
335
+ throw new Error(`list[${i}]['products'][${index}]['product_name'] is require`);
336
+ }
337
+
338
+ //设置是否选中
339
+ let check = this.isAll;
340
+ if (product.check) check = product.check;
341
+ if (product['status'] !== this.status) {
342
+ check = false;
343
+ }
344
+ if(product['status'] === this.status) shop_able.push(true)
345
+
346
+ if (check) shop_selected.push(true);
347
+
348
+ //计算商品小计
349
+ if(check && product['status'] === this.status) {
350
+ totalPrice = this.$xdUniHelper.addFloatNumber(
351
+ totalPrice,
352
+ this.$xdUniHelper.multiplyFloatNumber(product['price'], product['num'])
353
+ );
354
+ }
355
+
356
+ tempProduct.push({
357
+ ...product,
358
+ old_num: product['num'],
359
+ key: this.$xdUniHelper.randomChar(20),
360
+ checked: check
361
+ });
362
+ });
363
+ if(this.isAll) {
364
+ temp.push({
365
+ ...item,
366
+ shop_selected: shop_selected.length === shop_able.length,
367
+ products: tempProduct,
368
+ totalPrice
369
+ })
370
+ }
371
+ else {
372
+ temp.push({
373
+ ...item,
374
+ shop_selected: shop_selected.length === shop_able.length && this.isAll,
375
+ products: tempProduct,
376
+ totalPrice
377
+ })
378
+ }
379
+
380
+ });
381
+ this.dataList = temp;
382
+ console.log('List format',this.dataList);
383
+ this.computedInit();
384
+ } catch (e) {
385
+ console.error(e);
386
+ console.log('List format:', this.storeTestSourceDataList);
387
+ this.dataList = [];
388
+ this.computedInit();
389
+ }
390
+ },
391
+
392
+ computedInit(){
393
+ let totalPrice = 0;
394
+ let selectProduct = [];
395
+ let countNum = 0;
396
+ let totalNum = 0;
397
+ let isAll = true;
398
+ this.dataList.map((item)=>{
399
+ let products = [];
400
+ if(!item.shop_selected) isAll = false;
401
+ item.products.map((it)=>{
402
+ if(it.checked) {
403
+ products.push(it);
404
+ countNum++;
405
+ totalNum = totalNum + it.num;
406
+ }
407
+ });
408
+ let temp = {...item, products: products};
409
+ totalPrice = this.$xdUniHelper.addFloatNumber(totalPrice, item.totalPrice);
410
+
411
+ //店铺有选中的商品
412
+ if(products.length > 0) {
413
+ selectProduct.push(temp);
414
+ }
415
+ });
416
+ this.$emit('onSelect', {totalPrice, selectProduct, countNum, totalNum, isAll});
417
+ },
418
+
419
+ /**
420
+ * @description 获取购物车列表数据
421
+ */
422
+ getList(){
423
+ this.$emit('onCartList', (list) => {
424
+ if(this.$xdUniHelper.checkVarType(list) === 'array') {
425
+ this.init(list)
426
+ }else{
427
+ this.init(this.$xdUniHelper.cloneDeep(this.storeTestSourceDataList))
428
+ }
429
+ });
430
+ },
431
+
432
+ /**
433
+ * @description 设置购物车数量
434
+ * @param product 商品对象
435
+ * @param idx 商品对象所在位置
436
+ * @param item 门店对象
437
+ * @param index 门店所在位置
438
+ * @param value 购买数量
439
+ */
440
+ handleAddChange(product, idx, item, index , value){
441
+ if(value === ''){
442
+ console.log('handleAddChange', JSON.stringify(product))
443
+ let tempProduct = this.$xdUniHelper.cloneDeep(product);
444
+ let tempItem = this.$xdUniHelper.cloneDeep(item);
445
+ tempProduct['num'] = tempProduct['old_num'];
446
+ tempProduct['key'] = this.$xdUniHelper.randomChar(20);
447
+ tempItem.products.splice(idx, 1, tempProduct);
448
+ this.dataList.splice(index, 1, tempItem);
449
+ this.dataList = this.$xdUniHelper.cloneDeep(this.dataList);
450
+ console.log('handleAddChange', JSON.stringify(this.dataList))
451
+ this.resComputedPrice(tempItem);
452
+ return
453
+ }
454
+ console.log(product, idx, item, index, this.dataList);
455
+ this.$emit('onCurtSetNumber', product, item, (status) => {
456
+ let tempProduct = this.$xdUniHelper.cloneDeep(product);
457
+ let tempItem = this.$xdUniHelper.cloneDeep(item);
458
+ if(status === 1) {
459
+ tempProduct['old_num'] = tempProduct['num'];
460
+ }
461
+ if(status === 2) {
462
+ tempProduct['num'] = tempProduct['old_num'];
463
+ }
464
+ tempItem.products.splice(idx,1, tempProduct);
465
+ this.dataList.splice(index,1, tempItem);
466
+ this.resComputedPrice(tempItem);
467
+ });
468
+ },
469
+
470
+ /**
471
+ * @description 获取门店下正常商品数量
472
+ */
473
+ getStatusEqOneLen(item){
474
+ let temp = this.$xdUniHelper.cloneDeep(item);
475
+ let tempProducts = [];
476
+ temp['products'].map((value) => {
477
+ if (value.status === this.status) {
478
+ tempProducts.push(value);
479
+ }
480
+ });
481
+
482
+ return tempProducts.length;
483
+ },
484
+
485
+ /**
486
+ * @description 确认订单
487
+ */
488
+ toConfirm(item){
489
+ let temp = this.$xdUniHelper.cloneDeep(item);
490
+ let tempProducts = [];
491
+ temp['products'].map((value)=>{
492
+ if(value.checked) {
493
+ tempProducts.push(value);
494
+ }
495
+ });
496
+ temp['products'] = tempProducts;
497
+ this.$emit('onPay', temp)
498
+ },
499
+
500
+ /**
501
+ * @description 删除购物车
502
+ * @param product 产品对象
503
+ * @param item 店铺对象
504
+ * @param index 门店索引值
505
+ * @param idx 商品索引值
506
+ */
507
+ removeCartProduct(product, item , idx, index){
508
+ this.$emit('onCurtRemove', product, item , ()=>{
509
+ item['products'].splice(idx,1);
510
+ //当门店无购物车商品信息,直接删除门店信息
511
+ if(item['products'].length === 0) {
512
+ this.dataList.splice(index,1);
513
+ this.resComputedPrice(item);
514
+ return;
515
+ }
516
+ this.resComputedPrice(item);
517
+ });
518
+ },
519
+ bindClick(e, product, item, idx, index) {
520
+ if (e.position === 'right') {
521
+ console.log('removeCartProduct', product, item, idx , index);
522
+ this.removeCartProduct(product, item, idx, index);
523
+ }
524
+ },
525
+ swipeChange(e, index) {
526
+ },
527
+
528
+ /**
529
+ * @description 重新计算门店小计
530
+ * @param item 店铺对象
531
+ */
532
+ resComputedPrice(item){
533
+ let totalPrice = 0;
534
+ item['products'].map(value => {
535
+ if (value['status'] === this.status && value['checked']) {
536
+ totalPrice = this.$xdUniHelper.addFloatNumber(
537
+ totalPrice,
538
+ this.$xdUniHelper.multiplyFloatNumber(value['price'], value['num'])
539
+ );
540
+ }
541
+ });
542
+ item['totalPrice'] = totalPrice;
543
+ this.computedInit();
544
+ },
545
+
546
+ /**
547
+ * @description 选中商品信息
548
+ * @param item 店铺对象
549
+ */
550
+ handleProductChange(item){
551
+ let len = this.getStatusEqOneLen(item); //可选择商品数量
552
+ let selected = 0; //已选中
553
+ let select = 0; //未选中
554
+ item['products'].map((value)=>{
555
+ if(value.status === this.status) {
556
+ if (value.checked) selected++;
557
+ else select++;
558
+ }
559
+ });
560
+
561
+ if(selected === len) {
562
+ item.shop_selected = true;
563
+ }
564
+ else{
565
+ item.shop_selected = false;
566
+
567
+ }
568
+
569
+ this.resComputedPrice(item);
570
+ },
571
+
572
+
573
+ /**
574
+ * @description 门店数据全选/取消
575
+ * @param item 门店数据对象
576
+ */
577
+ handleChangeToAll(item){
578
+ console.log('handleChangeToAll', item);
579
+ item.products.map((value)=>{
580
+ if(value.status === this.status) {
581
+ value.checked = item.shop_selected;
582
+ }
583
+ });
584
+ this.resComputedPrice(item);
585
+ },
586
+
587
+ /**
588
+ * @description 查看产品详情事件
589
+ * @param item
590
+ * @param product
591
+ */
592
+ toDetial(product, item){
593
+ this.$emit('onToDetail', {item, product})
594
+ }
595
+
596
+ },
597
+ }
598
+
599
+ </script>
600
+
601
+ <style scoped lang="less">
602
+ /deep/ .uni-swipe_button-group {
603
+ & > view {
604
+ margin-left: unit(15,rpx);
605
+ }
606
+ }
607
+
608
+ .xd-store-cart {
609
+ padding: 0;
610
+ box-sizing: border-box;
611
+
612
+ &__item {
613
+ background: #fff;
614
+ border-radius: unit(10, rpx);
615
+ margin-bottom: unit(20,rpx);
616
+ padding: unit(19,rpx);
617
+ box-sizing: border-box;
618
+ }
619
+
620
+ &__store {
621
+ display: flex;
622
+ justify-content: flex-start;
623
+ align-items: center;
624
+ height: unit(70,rpx);
625
+ font-size: @xd-font-size-base;
626
+ position: relative;
627
+ padding-bottom: unit(10,rpx);
628
+ margin-bottom: unit(10,rpx);
629
+
630
+ &-radio {
631
+ margin-right: unit(10,rpx);
632
+ &-body {
633
+ width: unit(40,rpx);
634
+ height: unit(40, rpx);
635
+ display: flex;
636
+ justify-content: center;
637
+ align-items: center;
638
+
639
+ /deep/ .uni-radio-input,
640
+ /deep/ .uni-radio-wrapper {
641
+ width: unit(32, rpx);
642
+ height: unit(32, rpx);
643
+ margin: 0;
644
+ }
645
+
646
+ /deep/ .uni-radio-wrapper {
647
+ display: flex;
648
+ justify-content: center;
649
+ align-items: center;
650
+ width: unit(40, rpx);
651
+ height: unit(40, rpx);
652
+ }
653
+ }
654
+ }
655
+
656
+ &-name {
657
+ .uni-cut(1, 70);
658
+ line-height: unit(70,rpx);
659
+ font-size: @xd-font-size-lg - 2;
660
+ }
661
+
662
+ &-line {
663
+ height: 1px;
664
+ opacity: .2;
665
+ position: absolute;
666
+ bottom: 0;
667
+ left: 0;
668
+ right: 0;
669
+ }
670
+
671
+ }
672
+
673
+ &__products {
674
+ &-item {
675
+ display: flex;
676
+ justify-content: flex-start;
677
+ align-items: center;
678
+ position: relative;
679
+ margin-top: unit(19, rpx);
680
+ margin-bottom: unit(10,rpx);
681
+
682
+ /deep/ .xd-number__label {
683
+ display: none;
684
+ }
685
+
686
+ &-radio {
687
+ margin-right: unit(19,rpx);
688
+ flex-shrink: 0;
689
+ }
690
+
691
+ &-icon {
692
+ margin-right: unit(19, rpx);
693
+ flex-shrink: 0;
694
+ position: relative;
695
+
696
+ &-tips {
697
+ position: absolute;
698
+ left: 50%;
699
+ top: 50%;
700
+ transform: translate(-50%, -50%);
701
+ background: rgba(0, 0, 0, .4);
702
+ color: #666;
703
+ font-size: @xd-font-size-base;
704
+ display: flex;
705
+ justify-content: center;
706
+ align-items: center;
707
+ height: unit(120,rpx);
708
+ width: unit(120,rpx);
709
+ border-radius: 50%;
710
+ overflow: hidden;
711
+ box-shadow: rgba(0, 0, unit(10, rpx), rgba(0, 0, 0, .5));
712
+
713
+
714
+ & >view {
715
+ line-height:unit(40,rpx);
716
+ width: 100%;
717
+ text-align: center;
718
+ color: #f8f8f8;
719
+ text-shadow: rgba(0, 0, unit(10, rpx), rgba(0, 0, 0, .5));
720
+ }
721
+ }
722
+
723
+ /deep/ .xd-logo {
724
+ border-radius: unit(10,rpx);
725
+ overflow: hidden;
726
+ }
727
+ }
728
+
729
+ &-body {
730
+ flex: 1;
731
+ width: 0;
732
+
733
+ &.disabled {
734
+ opacity: 0.4;
735
+ }
736
+
737
+ &-name {
738
+ font-size: @xd-font-size-lg - 2;
739
+ .uni-cut(1, 36);
740
+ }
741
+ &-sku {
742
+ font-size: @xd-font-size-base;
743
+ padding: unit(10,rpx) 0;
744
+ color: @xd-text-color-grey;
745
+
746
+
747
+ }
748
+ }
749
+
750
+ &-number {
751
+ position: absolute;
752
+ bottom: 0;
753
+ right: 0;
754
+ }
755
+ }
756
+ }
757
+
758
+ &__btn {
759
+ margin-top: unit(19,rpx);
760
+ padding-top: unit(30,rpx);
761
+ position: relative;
762
+ display: flex;
763
+ justify-content: flex-end;
764
+ align-items: center;
765
+ padding-bottom: unit(10,rpx);
766
+
767
+ view:first-child {
768
+ font-size: @xd-font-size-base;
769
+ color: @xd-text-color-grey;
770
+ margin-right: unit(10,rpx);
771
+ }
772
+
773
+ view:nth-child(2) {
774
+ font-size: @xd-font-size-lg;
775
+ }
776
+
777
+ view:nth-child(3) {
778
+ margin-right: unit(20,rpx);
779
+ }
780
+
781
+ &-line {
782
+ height: 1px;
783
+ opacity: .2;
784
+ position: absolute;
785
+ top: 0;
786
+ left: 0;
787
+ right: 0;
788
+ }
789
+ }
790
+ }
791
+ </style>