فهرست منبع

选择产品界面问题

xiaohaizhao 2 سال پیش
والد
کامیت
fb7b62a491

+ 25 - 30
packageA/activity/detail.js

@@ -79,6 +79,9 @@ Page({
 					let image = value.attinfos.find(v => v.fileType == "image");
 					value.cover = image ? image.cover : "";
 				}
+				if (value.gradeprice) value.gradeprice = (value.gradeprice - 0).toFixed(2)
+				if (value.oldprice) value.oldprice = (value.oldprice - 0).toFixed(2)
+				if (value.price) value.price = (value.price - 0).toFixed(2)
 				return value;
 			})
 			this.setData({
@@ -177,34 +180,22 @@ Page({
 			title: '提示',
 			content: '是否确定创建促销订单?',
 			complete: (res) => {
-				if (res.confirm) _Http.basic({
-					"id": 20221108111402,
-					content: {
-						sa_orderid: 0,
-						sa_accountclassid: that.data.detail.sa_accountclassid,
-						rec_contactsid: 0,
-						pay_enterpriseid: 0,
-						sa_contractid: 0,
-						sa_projectid: 0,
-						sa_promotionid: that.data.detail.sa_promotionid,
-						"sa_brandid": that.data.detail.sa_brandid, //品牌ID
-						"type": "促销订单", //订单类型
-						"tradefield": that.data.detail.tradefield.join(','), //必选
-					}
-				}).then(res => {
-					console.log("创建促销订单", res);
-					wx.showToast({
-						title: res.msg != '成功' ? res.msg : '创建成功',
-						icon: "none"
-					});
-					/* 绑定产品 */
+				if (res.confirm)
 					_Http.basic({
-						"id": 20221109093602,
+						"id": 20221128183202,
 						"content": {
-							"sa_orderid": res.data.sa_orderid,
-							"sa_contractid": res.data.sa_contractid,
-							"sys_enterpriseid": res.data.sys_enterpriseid,
-							"type": "促销订单",
+							istool: 0,
+							type: "促销订单",
+							sa_orderid: 0,
+							sa_accountclassid: that.data.detail.sa_accountclassid,
+							rec_contactsid: 0,
+							pay_enterpriseid: 0,
+							sa_contractid: 0,
+							sa_projectid: 0,
+							sa_promotionid: that.data.detail.sa_promotionid,
+							"sa_brandid": that.data.detail.sa_brandid, //品牌ID
+							"type": "促销订单", //订单类型
+							"tradefield": that.data.detail.tradefield.join(','), //必选
 							"items": list.map(v => {
 								return {
 									"sa_orderitemsid": 0,
@@ -214,14 +205,18 @@ Page({
 								}
 							})
 						}
-					}).then(s => {
-						if (s.msg == '成功') setTimeout(() => {
+					}).then(res => {
+						console.log("转化促销订单", res)
+						wx.showToast({
+							title: res.msg != '成功' ? res.msg : '创建成功',
+							icon: "none"
+						});
+						if (res.msg == '成功') setTimeout(() => {
 							wx.redirectTo({
 								url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
 							});
-						}, 500)
+						}, 300)
 					})
-				})
 			}
 		})
 	},

+ 4 - 1
packageA/activity/detail.wxml

@@ -19,7 +19,7 @@
 	<view class="tags">
 		<text wx:if="{{detail.type}}">{{detail.type}}</text>
 		<text wx:if="{{detail.brandname}}">{{detail.brandname}}</text>
-		<text wx:if="{{detail.tradefield}}">{{detail.tradefield}}</text>
+		<text wx:if="{{detail.tradefield.length}}">{{detail.tradefield}}</text>
 	</view>
 	<view class="exp">活动周期:{{detail.begdate || ' --'}}</view>
 	<view class="exp">结束时间:{{detail.enddate || ' --'}}</view>
@@ -56,6 +56,9 @@
 				<view class="price line-1">
 					价格:<text class="num">¥{{handleHide.query(item.gradeprice || item.price,hidePrice)}}元</text><text wx:if="{{item.gradeprice<item.oldprice ||item.price<item.oldprice}}" style="text-decoration:line-through; color:#999;">/{{handleHide.query(item.oldprice,hidePrice)}}元</text>
 				</view>
+				<view class="subfield line-1">
+					限购数量:{{item.groupqty==0?'不限购':(item.groupqty-item.saledqty)<=0?'已售罄':item.groupqty}}
+				</view>
 			</view>
 		</view>
 	</navigator>

+ 1 - 1
packageA/activity/modules/list/index.wxml

@@ -15,7 +15,7 @@
 			<view wx:if="{{item.brandname}}" style="background: #FA8C16;">
 				{{item.brandname}}
 			</view>
-			<view wx:if="{{item.tradefield}}" style="background: #FA8C16;">
+			<view wx:if="{{item.tradefield.length}}" style="background: #FA8C16;">
 				{{item.tradefield}}
 			</view>
 		</view>

+ 4 - 2
packageA/activity/selectProduct/index.js

@@ -54,6 +54,9 @@ Page({
         }
         if (newPrice) value.newPrice = CNY(value[newPrice] || 0);
         if (oldPrice) value.oldPrice = CNY(value[oldPrice] || 0);
+        value.orderminqty = value.packageqty || value.orderminqty; //起订量优先取包装数量
+        if (!value.saledqty) value.saledqty = 0;
+        value.maxQty = value.groupqty == 0 ? "" : value.groupqty - value.saledqty; //有限购 设置最高可订购数量
         value.qty = value.orderminqty;
         return value;
       })
@@ -72,7 +75,6 @@ Page({
     let {
       id
     } = e.currentTarget.dataset, result = this.data.result;
-    console.log(e)
     result.some(v => v == id) ? result = result.filter(v => v != id) : result.push(id)
     this.setData({
       result
@@ -128,7 +130,7 @@ Page({
     this.getList(true);
   },
   onReady() {
-    this.selectComponent("#ListBox").setHeight(".total", this);
+    this.selectComponent("#ListBox").setHeight(".search", this);
   },
   /* 步进器输入框失去焦点 */
   inputBlur(e) {

+ 2 - 1
packageA/activity/selectProduct/index.json

@@ -1,6 +1,7 @@
 {
   "usingComponents": {
     "van-checkbox": "@vant/weapp/checkbox/index",
-    "van-stepper": "@vant/weapp/stepper/index"
+    "van-stepper": "@vant/weapp/stepper/index",
+    "list":"../modules/list/index"
   }
 }

+ 11 - 13
packageA/activity/selectProduct/index.wxml

@@ -1,9 +1,6 @@
 <van-search class="search" value="{{ params.content.where.condition }}" shape="round" placeholder="请输入搜索关键词" bind:search='startSearch' bind:clear='onClear' />
-<view class="total">共{{params.content.total}}个</view>
-
 <Yl_ListBox id='ListBox' bind:getlist='getList'>
-	<navigator url="#" wx:for="{{list}}" wx:key="itemid" class="item-box" data-id="{{item[idname]}}" bindtap="changeResult">
-
+	<navigator url="#" wx:for="{{list}}" wx:key="itemid" class="item-box" data-id="{{item[idname]}}" bindtap="{{item.groupqty!=0 && item.maxQty<=0?'':'changeResult'}}">
 		<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||item.attinfos[0].url||item.cover}}" use-loading-slot use-error-slot lazy-load>
@@ -14,24 +11,25 @@
 			<view class="content">
 				<view class="title">
 					<text class="line-1">{{item.itemname}}</text>
-					<van-checkbox custom-class="iconfont" shape='square' icon-size='24rpx' value="{{ decide.checked(item.itemid,result) }}" />
+					<van-checkbox wx:if="{{!(item.groupqty!=0 && item.maxQty<=0)}}" custom-class="iconfont" shape='square' icon-size='24rpx' value="{{ decide.checked(item.itemid,result) }}" />
 				</view>
 				<view class="exp">编号:{{item.itemno}}</view>
 				<view class="exp">规格:{{item.spec ||" --"}}</view>
 				<view class="exp">型号:{{item.model ||" --"}}</view>
 				<view class="exp"><text style="font-size: 24rpx;font-weight: 600;color: #FF3B30;">{{item.newPrice}}</text><text style="font-size: 20rpx; text-decoration:line-through; margin-left: 6rpx;">¥{{item.oldprice}}</text></view>
+				<view class="exp">可购数量:{{item.groupqty==0?'不限购':(item.groupqty-item.saledqty)<=0?'已售罄':item.maxQty}}</view>
+				</view>
 			</view>
-		</view>
-		<view class="bottom">
-			<view class="check" bindtap="changeResults" data-item="{{item}}">
-				<view class="label-class">
-					起订量:{{item.orderminqty}},增减量:{{item.orderaddqty}}
+			<view class="bottom">
+				<view class="check" bindtap="changeResults" data-item="{{item}}">
+					<view class="label-class">
+						起订量:{{item.orderminqty}},增减量:{{item.orderaddqty}}
+					</view>
 				</view>
+				<van-stepper value="{{ item.qty }}" min="{{item.orderminqty}}" max="{{item.maxQty||'99999999'}}" disabled="{{item.groupqty!=0 && item.maxQty<=0}}" step="{{item.orderaddqty}}" input-class='input-class' data-index="{{index}}" data-iscatch="catch" catch:minus='stepperChange' catch:plus='stepperChange' catch:blur='inputBlur' />
 			</view>
-			<van-stepper value="{{ item.qty }}" min="{{item.orderminqty}}" step="{{item.orderaddqty}}" input-class='input-class' data-index="{{index}}" data-iscatch="catch" catch:minus='stepperChange' catch:plus='stepperChange' catch:blur='inputBlur' />
-		</view>
 	</navigator>
-
+	<view style="height: 100rpx;" />
 	<Yl_Empty wx:if="{{list.length==0}}" />
 </Yl_ListBox>