Browse Source

购物车

xiaohaizhao 2 years ago
parent
commit
756eec7585

+ 3 - 0
packageA/shopping/modules/standard/index.js

@@ -1,6 +1,9 @@
 const _Http = getApp().globalData.http;
 let downCount = {};
 Component({
+  options: {
+    addGlobalClass: true,
+  },
   properties: {
     figure: Number
   },

+ 1 - 1
packageA/shopping/modules/standard/index.wxml

@@ -1,7 +1,7 @@
 <navigator url="#" wx:for="{{list}}" wx:key="itemid" class="item-box">
 	<view class="top" bindtap="changeResults" data-item="{{item}}">
 		<view class="image">
-			<van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url}}" use-loading-slot use-error-slot lazy-load>
+			<van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url||item.attinfos[0].url||item.cover}}" use-loading-slot use-error-slot lazy-load>
 				<van-loading slot="loading" type="spinner" size="20" vertical />
 				<text slot="error">加载失败</text>
 			</van-image>

+ 7 - 3
packageA/shopping/modules/tool/index.js

@@ -1,6 +1,9 @@
 const _Http = getApp().globalData.http;
 let downCount = {};
 Component({
+  options: {
+    addGlobalClass: true,
+  },
   properties: {
     figure: Number
   },
@@ -169,7 +172,8 @@ Component({
     deteleItem(e) {
       const {
         item
-      } = e.currentTarget.dataset;
+      } = e.currentTarget.dataset,
+      that = this;
       _Http.basic({
         "id": 20220924095202,
         "content": {
@@ -181,9 +185,9 @@ Component({
           icon: "none"
         });
         this.setData({
-          list: this.data.list.filter(v => v.sa_shoppingcartid != item.sa_shoppingcartid)
+          list: that.data.list.filter(v => v.sa_shoppingcartid != item.sa_shoppingcartid)
         })
-        if (this.data.results.some(v => v == item.sa_shoppingcartid)) this.changeResults({
+        if (that.data.results.some(v => v == item.sa_shoppingcartid)) that.changeResults({
           item
         }, true);
         getApp().globalData.num = getApp().globalData.num - 1;

+ 2 - 2
packageA/shopping/modules/tool/index.wxml

@@ -1,7 +1,7 @@
 <navigator url="#" wx:for="{{list}}" wx:key="itemid" class="item-box">
     <view class="top" bindtap="changeResults" data-item="{{item}}">
         <view class="image">
-            <van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url}}" use-loading-slot use-error-slot lazy-load>
+            <van-image width="100%" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url||item.attinfos[0].url||item.cover}}" use-loading-slot use-error-slot lazy-load>
                 <van-loading slot="loading" type="spinner" size="20" vertical />
                 <text slot="error">加载失败</text>
             </van-image>
@@ -25,7 +25,7 @@
                 起订量:{{item.orderminqty}},增减量:{{item.orderaddqty}}
             </van-checkbox>
         </view>
-		<van-stepper value="{{ item.qty }}" min="{{item.orderminqty}}" step="{{item.orderaddqty}}" disable-input input-class='input-class' data-index="{{index}}" catch:change="stepperChange" />
+        <van-stepper value="{{ item.qty }}" min="{{item.orderminqty}}" step="{{item.orderaddqty}}" disable-input input-class='input-class' data-index="{{index}}" catch:change="stepperChange" />
         <!-- <van-stepper value="{{ item.qty }}" input-class='input-class' data-index="{{index}}" catch:change="stepperChange" /> -->
     </view>
 </navigator>