Browse Source

工具修改

xiaohaizhao 2 năm trước cách đây
mục cha
commit
d989c1b0c6

+ 1 - 1
packageA/tool/index.wxml

@@ -5,7 +5,7 @@
 <Tabs wx:for="{{typeList}}" active="{{item.active}}" wx:key="{{index}}" rowIndex="{{index}}" list="{{item.list}}" bind:onChange="typeChange" name='itemclassname' box-class='brand-box' tab-class='brand-tab-class' active-class='brand-active-class' />
 <view class="division" />
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
-	<List list="{{list}}" />
+	<List list="{{list}}" userrole='{{userrole}}' />
 </Yl_ListBox>
 <!-- 筛选条件 -->
 <Yl_Filtrate id='Filtrate' list="{{filter}}" bind:handle="handleFilter" dateRange='{{false}}' />

+ 52 - 1
packageA/tool/modules/list/index.js

@@ -1,5 +1,56 @@
+const _Http = getApp().globalData.http;
+
 Component({
   properties: {
-    list: Array
+    list: Array,
+    userrole: String
+  },
+  options: {
+    addGlobalClass: true
+  },
+  methods: {
+    showTips() {
+      wx.showToast({
+        title: '请选择领域添加',
+        icon: "none"
+      })
+    },
+    addToCart(e) {
+      let {
+        item
+      } = e.currentTarget.dataset;
+      _Http.basic({
+        "id": 20220924095102,
+        "content": {
+          "sa_brandid": item.brand[0].sa_brandid, //品牌id
+          "itemid": item.itemid, //货品id
+          "qty": 1, //数量
+          "itemno": item.itemno, //货品编号
+          tradefield: item.tradefield[e.detail.value || 0].tradefield || ''
+        },
+      }).then(res => {
+        console.log("加入购物车", res)
+        if (res.msg != '成功') return wx.showToast({
+          title: res.msg,
+          icon: "none"
+        });
+
+        _Http.basic({
+          "id": 20220927093202,
+          "content": {}
+        }, false).then(res => {
+          console.log("购物车数量", res)
+          getApp().globalData.num = res.data.num;
+          if (this.data.userrole == '经销商') getCurrentPages()[getCurrentPages().length - 1].selectComponent("#Float").setNum(res.data.num)
+          setTimeout(() => {
+            wx.showToast({
+              title: '加入成功',
+              icon: "none",
+              icon: "none"
+            });
+          }, 200);
+        });
+      })
+    }
   }
 })

+ 19 - 16
packageA/tool/modules/list/index.scss

@@ -1,4 +1,5 @@
 .product {
+	position: relative;
 	display: flex;
 	width: 100vw;
 	padding: 20rpx 30rpx;
@@ -68,26 +69,28 @@
 		}
 
 		.price {
-			display: flex;
-			width: 100%;
 			height: 40rpx;
-			align-items: center;
-			justify-content: space-between;
+			line-height: 40rpx;
 			margin-top: 14rpx;
-
-			view {
-				font-size: 28rpx;
-				font-family: PingFang SC-Medium, PingFang SC;
-				font-weight: 550;
-				color: #3874F6;
-			}
-
-			text {
-				font-size: 24rpx;
-				color: #888888;
-			}
+			font-size: 28rpx;
+			font-family: PingFang SC-Medium, PingFang SC;
+			font-weight: 550;
+			color: #3874F6;
 		}
 	}
+
+	.icon-gouwuche {
+		position: absolute;
+		height: 80rpx;
+		line-height: 90rpx;
+		width: 120rpx;
+		border-radius: 8rpx;
+		font-size: 28rpx;
+		color: #FA8C16;
+		bottom: 6rpx;
+		right: 0rpx;
+		text-align: center;
+	}
 }
 
 .line-1 {

+ 9 - 4
packageA/tool/modules/list/index.wxml

@@ -1,5 +1,5 @@
 <!-- /packageA/market/detail?id={{item.sa_itemgroupid}}&itemno={{item.itemno}}&istool=1 -->
-<navigator class="product" url="#" wx:for="{{list}}" wx:key="index">
+<view class="product" wx:for="{{list}}" wx:key="index">
     <view class="image-box">
         <van-image width="100%" wx:if="{{item.attinfos[0]}}" height="100%" fit="cover" src="{{item.attinfos[0].subfiles[0].url}}" use-loading-slot use-error-slot lazy-load>
             <van-loading slot="loading" type="spinner" size="20" vertical />
@@ -20,10 +20,15 @@
         </view>
         <view class="price">
             <view>
-                ¥ {{item.marketprice}}
+                ¥ {{item.marketprice}}/{{item.unitname}}
             </view>
-            <text>× {{item.unitname}}</text>
         </view>
+        <block wx:if="{{userrole!='业务员'}}">
+            <picker wx:if="{{item.tradefield.length>=2}}" range='{{item.tradefield}}' range-key='tradefield' data-item="{{item}}" bindchange='addToCart'>
+                <navigator url="#" class="iconfont icon-gouwuche" bindtap="showTips" />
+            </picker>
+            <navigator url="#" class="iconfont icon-gouwuche" data-item="{{item}}" bindtap="addToCart" />
+        </block>
     </view>
-</navigator>
+</view>
 <Yl_Empty wx:if="{{list.length === 0}}" />

+ 1 - 1
packageA/toolBill/detail.js

@@ -276,7 +276,7 @@ Page({
 		content.pageNumber = 1;
 		content.pageSize = (page.data.content.pageNumber - 1) * page.data.content.pageSize;
 		_Http.basic({
-			"id": 20230111141104,
+			"id": 20230105161503,
 			content
 		}).then(res => {
 			console.log("更新订单列表", res)

+ 0 - 4
packageA/toolBill/index.js

@@ -85,10 +85,6 @@ Page({
         });
         this.getList(true);
     },
-    onShow(){
-        // thisgetList
-        this.getList(true);
-    },
     onReady() {
         this.setListHeight()
     },