Browse Source

Merge branch '促销活动购物车' into preview

xiaohaizhao 1 year ago
parent
commit
d22e054a41

+ 2 - 1
app.json

@@ -50,7 +50,8 @@
         "orderForm/modules/setBrand/index",
         "orderForm/rows",
         "dispatchBill/rows",
-        "dispatchBill/sentandback"
+        "dispatchBill/sentandback",
+        "activity/selectProduct/cart/index"
       ]
     },
     {

+ 4 - 2
packageA/activity/detail.js

@@ -169,6 +169,7 @@ Page({
 				"version": 1,
 				"content": {
 					nocache: true,
+					sa_brandid: this.data.detail.sa_brandid,
 					sa_promotionid: this.data.sa_promotionid,
 					sa_promotion_itemgroupid: this.data.active,
 					"where": {
@@ -177,7 +178,7 @@ Page({
 				}
 			}),
 		});
-		getApp().globalData.handleSelect = this.creadedOrderForm.bind(this);
+		// getApp().globalData.handleSelect = this.creadedOrderForm.bind(this);
 	},
 	creadedOrderForm({
 		list
@@ -210,7 +211,8 @@ Page({
 									"qty": v.qty,
 									price: v.price,
 									length: v.length,
-									width: v.width
+									width: v.width,
+									sa_promotion_itemsid: v.sa_promotion_itemsid
 								}
 							})
 						}

+ 22 - 0
packageA/activity/selectProduct/cart/footer.js

@@ -0,0 +1,22 @@
+Component({
+  options: {
+    addGlobalClass: true
+  },
+  properties: {
+    disabled: {
+      type: Boolean,
+      value: false
+    },
+    onClick: {
+      type: Function
+    }
+  },
+  data: {
+    badge: 0
+  },
+  methods: {
+    clickBut(e) {
+      this.triggerEvent("onClick", e.currentTarget.dataset.event)
+    },
+  }
+})

+ 4 - 0
packageA/activity/selectProduct/cart/footer.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 38 - 0
packageA/activity/selectProduct/cart/footer.scss

@@ -0,0 +1,38 @@
+.footer {
+	display: flex;
+	justify-content: center;
+	position: fixed;
+	bottom: 0;
+	width: 100vw;
+	min-height: 130rpx;
+	background-color: #fff;
+	box-shadow: rgba(0, 0, 0, 0.15) 0px 5rpx 15rpx 0px;
+	z-index: 999999999999999;
+
+	.but {
+		width: 690rpx;
+		height: 90rpx;
+		background: #FA8C16;
+		border-radius: 16rpx;
+		font-size: 28rpx;
+		font-weight: 600;
+		color: #FFFFFF;
+		margin-top: 10rpx;
+	}
+}
+
+.document-box {
+	width: 100vw;
+	box-sizing: border-box;
+	padding: 20rpx 30rpx;
+	background-color: #fff;
+
+	.document {
+		word-break: break-all;
+		white-space: pre-wrap;
+		font-size: 28rpx;
+		font-family: PingFang SC-Regular, PingFang SC;
+		color: #3874F6;
+		margin-bottom: 20rpx;
+	}
+}

+ 12 - 0
packageA/activity/selectProduct/cart/footer.wxml

@@ -0,0 +1,12 @@
+<view style="height: 200rpx;" />
+<view class="cu-bar bg-white tabbar border shop footer">
+	<view class="action" hover-class="navigator-hover" style="height: 100%;display: flex; flex-direction: column; align-items: center;" data-event="toindex" bindtap="clickBut">
+		<view class="cuIcon-cart">
+			<view class="cu-tag badge">{{badge}}</view>
+		</view>
+		促销购物车
+	</view>
+	<view hover-class="{{disabled?'none':'navigator-hover'}}" style="background: rgba({{disabled?'243,123,29,.7':'243,123,29,1'}});color: #fff;" class="submit" data-event="update" bindtap="{{disabled?'':'clickBut'}}">
+		加入促销购物车
+	</view>
+</view>

+ 381 - 0
packageA/activity/selectProduct/cart/index.js

@@ -0,0 +1,381 @@
+const _Http = getApp().globalData.http,
+	currency = require("../../../../utils/currency"),
+	CNY = sum => currency(sum, {
+		symbol: "¥",
+		precision: 2
+	}).format();
+let downCount = {};
+let ids = {};
+Page({
+	data: {
+		list: [],
+		results: [], //选中结果
+		sa_brandid: null, //当前选中品牌id
+		classList: [], //生成订单时所选
+		sum: 0, //价格合
+		allBrandList: [],
+		loading: false
+	},
+	onLoad(options) {
+		ids = JSON.parse(options.data);
+		this.getList()
+		this.setData({
+			hidePrice: wx.getStorageSync('hidePrice'),
+		})
+		getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
+	},
+	//修改定制
+	customizedProduct(item) {
+		return new Promise((resolve) => {
+			_Http.basic({
+				"id": 20220924104302,
+				"content": {
+					"sa_shoppingcartid": item.sa_shoppingcartid,
+					"qty": item.qty,
+					"width": item.width || 0,
+					"length": item.length || 0
+				},
+			}).then(res => {
+				console.log("修改定制", res)
+				wx.showToast({
+					title: res.msg != '成功' ? res.msg : '修改成功',
+					icon: "none"
+				});
+				this.getList()
+				resolve(true)
+			})
+		})
+	},
+	/* 获取列表 */
+	getList() {
+		_Http.basic({
+			"id": 20220924095302,
+			"content": {
+				nocache: true,
+				istool: 0,
+				...ids,
+				"pageNumber": 1,
+				"pageSize": 9999,
+				"where": {
+					"condition": ""
+				}
+			}
+		}).then(res => {
+			console.log('购物车列表', res)
+			this.selectComponent('#ListBox').RefreshToComplete();
+			this.selectComponent("#ListBox").setHeight(".head", this);
+			if (res.msg != '成功') return wx.showToast({
+				title: res.msg,
+				icon: "none"
+			})
+			let list = [],
+				allBrandList = [];
+			list = res.data.map(v => {
+				v.showPrice = CNY(v.gradeprice)
+				let obj = allBrandList.find(s => s.sa_brandid == v.sa_brandid);
+				if (obj) {
+					obj.results.push(v.sa_shoppingcartid)
+				} else {
+					allBrandList.push({
+						brandname: v.brandname,
+						sa_brandid: v.sa_brandid,
+						results: [v.sa_shoppingcartid],
+					})
+				}
+				return v
+			});
+			this.setData({
+				list,
+				allBrandList,
+				isGet: true
+			});
+			if (wx.getStorageSync('shopping1')) {
+				this.setData({
+					...wx.getStorageSync('shopping1')
+				});
+				this.computeSum();
+			}
+		})
+	},
+	clickBut(e) {
+		this.data.classList.length >= 2 ? wx.showToast({
+			title: '请选择订单领域(订单只允许同品牌/同领域的商品)',
+			icon: "none",
+			duration: 3000
+		}) : this.handleSubmit(0);
+	},
+	/* 提交 */
+	submit(e) {
+		this.handleSubmit(e.detail.value)
+	},
+	handleSubmit(index) {
+		let data = this.data.classList[index],
+			that = this;
+		wx.showModal({
+			title: '提示',
+			content: '是否确定生成促销订单',
+			complete: ({
+				confirm
+			}) => {
+				if (confirm) {
+					that.setData({
+						loading: true
+					})
+					_Http.basic({
+						"id": 20221128183202,
+						"content": {
+							istool: 0,
+							type: "促销订单",
+							"tradefield": data.type, //必选
+							...ids,
+							"items": data.list.map(v => {
+								return {
+									"sa_orderitemsid": 0,
+									"itemid": v.itemid,
+									"sa_brandid": v.sa_brandid,
+									"qty": v.qty,
+									width: v.width || 0,
+									length: v.length || 0,
+									sa_shoppingcartid: v.sa_shoppingcartid || 0,
+									sa_promotion_itemsid: v.sa_promotion_itemsid
+								}
+							})
+						}
+					}).then(res => {
+						console.log("转化订单", res)
+						that.setData({
+							loading: false
+						})
+						if (res.msg != '成功') return wx.showToast({
+							title: res.msg,
+							icon: "none"
+						});
+						getApp().globalData.getCollectCount()
+						wx.showModal({
+							title: '提示',
+							content: '生成成功!是否立即前往',
+							complete: (s) => {
+								if (s.confirm) {
+									wx.navigateTo({
+										url: '/packageA/orderForm/detail?id=' + res.data.sa_orderid,
+									})
+								}
+							}
+						});
+						that.getList();
+					})
+
+
+				}
+			}
+		})
+
+	},
+	/* 是否选择全部 */
+	setIsAll() {
+		let isAll = this.data.isAll;
+		//取消全选
+		if (isAll) {
+			this.setData({
+				sa_brandid: null,
+				results: []
+			})
+		} else {
+			//已选品牌产品情况下
+			if (this.data.sa_brandid) {
+				let obj = this.data.allBrandList.find(v => v.sa_brandid == this.data.sa_brandid)
+				this.setData({
+					results: obj.results
+				})
+			} else {
+				if (this.data.allBrandList.length == 0) return;
+				this.setData({
+					sa_brandid: this.data.allBrandList[0].sa_brandid,
+					results: this.data.allBrandList[0].results
+				})
+			}
+		};
+		this.computeSum();
+	},
+	/* 切换选中项 */
+	changeResults(e, my = false) {
+		const {
+			item
+		} = my ? e : e.currentTarget.dataset;
+		let results = this.data.results,
+			sa_brandid = this.data.sa_brandid;
+		if (sa_brandid && sa_brandid != item.sa_brandid) return;
+		if (results.length == 0) {
+			results.push(item.sa_shoppingcartid);
+			sa_brandid = item.sa_brandid;
+		} else {
+			let index = results.findIndex(v => v == item.sa_shoppingcartid)
+			if (index == -1) {
+				results.push(item.sa_shoppingcartid);
+			} else {
+				results.splice(index, 1);
+				if (results.length == 0) sa_brandid = null;
+			}
+		};
+		this.setData({
+			results,
+			sa_brandid
+		})
+		this.computeSum();
+	},
+	customization(e) {
+		const {
+			item
+		} = e.target.dataset;
+		if (item) this.selectComponent("#Custom").onClick(item)
+	},
+	/* 计算总价/产品领域分类 */
+	computeSum() {
+		let results = this.data.results,
+			sum = 0,
+			classList = [];
+		if (results.length) results = results.filter(v => {
+			let item = this.data.list.find(va => va.sa_shoppingcartid == v);
+			if (item) {
+				console.log(item.gradeprice)
+				sum = currency(sum).add(currency(item.qty).multiply(item.gradeprice)).value;
+				/* 领域分类 */
+				let index = classList.findIndex(value => value.type == item.tradefield_shoppingcart);
+				if (index == -1) {
+					classList.push({
+						type: item.tradefield_shoppingcart,
+						list: [item],
+						name: item.tradefield_shoppingcart + "(1件商品)"
+					})
+				} else {
+					classList[index].list.push(item)
+					classList[index].name = classList[index].type + `(${classList[index].list.length}件商品)`
+				}
+			};
+			return item
+		});
+		let sa_brandid = results.length ? this.data.sa_brandid : null;
+		wx.setStorageSync('shopping1', {
+			results,
+			sa_brandid
+		})
+		let isAll = false;
+		if (sa_brandid) {
+			let brand = this.data.allBrandList.find(v => v.sa_brandid == sa_brandid)
+			isAll = brand.results.length == results.length
+		}
+		console.log(sum)
+		this.setData({
+			sum: CNY(sum),
+			isAll,
+			results,
+			sa_brandid,
+			classList
+		});
+	},
+	/* 删除产品 */
+	deteleItem(e) {
+		const {
+			item
+		} = e.currentTarget.dataset;
+		wx.showModal({
+			title: '提示',
+			content: `是否确认删除${item.itemname}?`,
+			complete: ({
+				confirm
+			}) => {
+				e.detail.instance.close();
+				if (confirm) _Http.basic({
+					"id": 20220924095202,
+					"content": {
+						...ids,
+						"sa_shoppingcartids": [item.sa_shoppingcartid],
+
+					}
+				}).then(res => {
+					wx.showToast({
+						title: res.msg != '成功' ? res.msg : "删除成功",
+						icon: "none"
+					});
+					if (res.msg != '成功') return;
+					this.getList(true)
+					getApp().globalData.getCollectCount()
+				})
+			}
+		})
+	},
+	/* 输入框失去焦点调整数量 */
+	inputBlur(e) {
+		const {
+			index
+		} = e.currentTarget.dataset;
+		let item = this.data.list[index];
+		let qty = 0;
+		if (item.orderminqty > e.detail.value) {
+			wx.showToast({
+				title: '输入数量低于最低起订量!',
+				icon: "none"
+			})
+			qty = item.orderminqty;
+		} else if (item.orderminqty < e.detail.value) {
+			var currencyRounding = value => currency(value, {
+				increment: item.orderaddqty
+			});
+			qty = currency(currencyRounding(currency(e.detail.value).subtract(item.orderminqty)).format()).add(item.orderminqty).value;
+
+		} else {
+			qty = e.detail.value;
+		}
+		this.setData({
+			[`list[${index}].qty`]: 0
+		});
+		this.setData({
+			[`list[${index}].qty`]: qty
+		});
+		this.computeSum();
+		clearTimeout(downCount['count' + index])
+		downCount['count' + index] = setTimeout(() => {
+			_Http.basic({
+				"id": 20220924104302,
+				"content": {
+					"sa_shoppingcartid": item.sa_shoppingcartid,
+					"qty": item.qty,
+					"width": item.width || 0,
+					"length": item.length || 0
+				},
+			}, false).then(res => {
+				console.log("修改数量", res)
+			})
+		}, 2000)
+	},
+	/* 步进器调整数量 */
+	stepperChange(e) {
+		const {
+			index
+		} = e.currentTarget.dataset;
+		let item = this.data.list[index];
+		if (e.type == 'plus') {
+			item.qty += item.orderaddqty
+		} else {
+			item.qty -= item.orderaddqty
+		}
+		this.setData({
+			[`list[${index}]`]: item
+		})
+		this.computeSum();
+		clearTimeout(downCount['count' + index])
+		downCount['count' + index] = setTimeout(() => {
+			_Http.basic({
+				"id": 20220924104302,
+				"content": {
+					"sa_shoppingcartid": item.sa_shoppingcartid,
+					"qty": item.qty,
+					"width": item.width || 0,
+					"length": item.length || 0
+				},
+			}, false).then(res => {
+				console.log("修改数量", res)
+			})
+		}, 2000)
+	}
+})

+ 9 - 0
packageA/activity/selectProduct/cart/index.json

@@ -0,0 +1,9 @@
+{
+	"component": true,
+	"usingComponents": {
+		"van-checkbox": "@vant/weapp/checkbox/index",
+		"van-stepper": "@vant/weapp/stepper/index",
+		"van-swipe-cell": "@vant/weapp/swipe-cell/index",
+		"custom": "../../../../pages/index/collect/modules/custom"
+	}
+}

+ 178 - 0
packageA/activity/selectProduct/cart/index.scss

@@ -0,0 +1,178 @@
+page {
+	padding-bottom: calc(230rpx + env(safe-area-inset-bottom) / 2) !important;
+}
+
+.item-box {
+	position: relative;
+	width: 100vw;
+	background-color: #fff;
+	margin-bottom: 20rpx;
+	padding-bottom: 16rpx;
+	box-sizing: border-box;
+
+	.top {
+		display: flex;
+		padding: 20rpx 30rpx 0rpx;
+		box-sizing: border-box;
+
+
+		.image {
+			width: 128rpx;
+			height: 128rpx;
+			border-radius: 16rpx;
+			overflow: hidden;
+			margin-right: 20rpx;
+			flex-shrink: 0;
+		}
+
+		.content {
+			position: relative;
+			flex: 1;
+
+			.title {
+				display: flex;
+				align-items: center;
+				justify-content: space-between;
+				height: 40rpx;
+
+				.line-1 {
+					display: block;
+					width: 500rpx;
+					font-size: 28rpx;
+					font-family: PingFang SC-Semibold, PingFang SC;
+					font-weight: 600;
+					color: #333333;
+				}
+
+				.iconfont {
+					position: absolute;
+					width: 60rpx;
+					height: 60rpx;
+					line-height: 60rpx;
+					right: 0;
+					flex-shrink: 0;
+				}
+			}
+
+			.exp {
+				line-height: 34rpx;
+				font-size: 24rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				color: #999999;
+				margin-top: 8rpx;
+			}
+
+			.price {
+				position: absolute;
+				font-size: 28rpx;
+				font-weight: 600;
+				color: #FF3B30;
+				right: 10rpx;
+			}
+		}
+
+	}
+
+	.bottom {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		height: 58rpx;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+		margin-top: 12rpx;
+
+		.check {
+			display: flex;
+			align-items: center;
+			height: 100%;
+			width: 380rpx;
+			font-size: 24rpx;
+			font-family: PingFang SC-Regular, PingFang SC;
+			color: #999999;
+		}
+
+		.input-class {
+			width: 120rpx;
+		}
+	}
+}
+
+.cell-right {
+	background-color: #E54D42;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	color: #fff;
+	font-weight: 700;
+	font-size: 28rpx;
+	width: 65px;
+	height: 100%;
+}
+
+.footer-box {
+	position: fixed;
+	bottom: 0;
+	padding: 0;
+	z-index: 99;
+
+	.footer {
+		width: 100vw;
+		min-height: 130rpx;
+		z-index: 999;
+		display: flex;
+		justify-content: space-between;
+		padding: 0 30rpx;
+		box-sizing: border-box;
+		background-color: #fff;
+		box-shadow: rgba(0, 0, 0, 0.15) 0px 5rpx 15rpx 0px;
+
+
+		.left {
+			flex: 1;
+			color: #333333;
+
+			.selected {
+				font-size: 24rpx;
+				color: #999;
+			}
+
+			.sum {
+				height: 40rpx;
+				line-height: 40rpx;
+				font-size: 28rpx;
+				font-family: PingFang SC-Medium, PingFang SC;
+				font-weight: 500;
+				margin-top: 10rpx;
+
+				text {
+					color: #FF3B30;
+				}
+			}
+
+			.transport {
+				height: 34rpx;
+				line-height: 34rpx;
+				font-size: 24rpx;
+				font-family: PingFang SC-Regular, PingFang SC;
+				margin-top: 8rpx;
+
+				text {
+					color: #FF3B30;
+				}
+			}
+		}
+
+		.but {
+			width: 230rpx;
+			height: 90rpx;
+			background: #3874F6;
+			border-radius: 16rpx;
+			font-size: 28rpx;
+			font-weight: 600;
+			color: #FFFFFF;
+			margin-top: 10rpx;
+		}
+	}
+
+}

+ 74 - 0
packageA/activity/selectProduct/cart/index.wxml

@@ -0,0 +1,74 @@
+<view class="head" />
+<custom id="Custom" />
+<Yl_ListBox id='ListBox' bind:getlist='getList'>
+	<van-swipe-cell wx:for="{{list}}" wx:key="itemid" id="swipe-cell" right-width="{{ 65 }}" async-close data-item="{{item}}" bind:close="deteleItem">
+		<view url="#" class="item-box">
+			<view class="top" catch:tap="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>
+						<van-loading slot="loading" type="spinner" size="20" vertical />
+						<text slot="error">加载失败</text>
+					</van-image>
+				</view>
+				<view class="content">
+					<view class="title">
+						<text class="line-1">{{item.itemname}}</text>
+						<van-checkbox shape='square' disabled="{{sa_brandid && sa_brandid!=item.sa_brandid}}" icon-size='24rpx' value="{{ decide.checked(item.sa_shoppingcartid,results) }}" />
+					</view>
+					<view class="exp">编号:{{item.itemno}}</view>
+					<!-- <view class="exp">规格:{{item.spec ||" --"}}</view> -->
+					<view class="exp">型号:{{item.model ||" --"}}</view>
+					<view class="exp">品牌:{{item.brandname ||" --"}}</view>
+					<view class="exp">领域:{{item.tradefield_shoppingcart ||" --"}}</view>
+					<view class="exp" wx:if="{{item.iscustomsize}}" data-item="{{item}}" catch:tap="customization" style="color:#085CDF;">
+						长:{{item.length}} / 宽:{{item.width}}
+						<van-icon name="arrow-down" />
+					</view>
+					<view class="price" style="bottom: {{item.iscustomsize?'40rpx':'0rpx'}};">{{handleHide.query(item.showPrice,hidePrice)}}/{{item.unitname}}</view>
+				</view>
+			</view>
+			<view class="bottom">
+				<view class="check label-class">
+					起订量:{{item.orderminqty}},增减量:{{item.orderaddqty}}
+				</view>
+				<van-stepper value="{{ item.qty }}" min="{{item.orderminqty}}" step="{{item.orderaddqty}}" input-class='input-class' data-index="{{index}}" bind:minus='stepperChange' bind:plus='stepperChange' bind:blur='inputBlur' />
+			</view>
+		</view>
+		<view slot="right" class="cell-right">删 除</view>
+	</van-swipe-cell>
+	<Yl_Empty wx:if="{{list.length === 0}}" />
+	<view style="height: 200px;" />
+</Yl_ListBox>
+
+
+<view class="footer-box">
+	<view class="footer">
+		<view class="left">
+			<view style="margin-top: 8rpx;">
+				<van-checkbox icon-size="26rpx" shape='square' value="{{ isAll }}" bind:change="setIsAll">全选 <text class="selected">已选{{results.length}}件</text></van-checkbox>
+			</view>
+			<view class="sum">
+				合计:<text>{{handleHide.query(sum,hidePrice)}}</text>
+			</view>
+			<view class="transport">
+				{{logistics}}
+			</view>
+		</view>
+		<picker wx:if="{{classList.length>=2}}" range='{{classList}}' range-key='name' disabled='{{!results.length}}' bindchange="submit">
+			<van-button custom-class='but' disabled='{{!results.length}}' loading='{{loading}}' loading-text="生成中..." bind:click="clickBut">生成订单</van-button>
+		</picker>
+		<van-button wx:else custom-class='but' disabled='{{!results.length}}' loading='{{loading}}' loading-text="生成中..." bind:click="clickBut">生成订单</van-button>
+	</view>
+</view>
+
+
+<wxs module="decide">
+	module.exports = {
+		checked: function (id, list) {
+			return list.some(function (v) {
+				return v == id
+			});
+		}
+	}
+</wxs>
+<wxs src="/utils/hidePrice.wxs" module="handleHide" />

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

@@ -13,7 +13,8 @@ Page({
     showName: "itemname",
     newPrice: "price",
     oldPrice: "oldprice",
-    resultList: []
+    resultList: [],
+    sa_brandid: null,
   },
   onLoad(options) {
     if (options.params) {
@@ -33,6 +34,69 @@ Page({
     this.getList()
     getApp().globalData.customizedProduct = this.customizedProduct.bind(this);
   },
+  onShow() {
+    this.getCollectCount()
+  },
+  getCollectCount() {
+    return _Http.basic({
+      "id": 20220927093202,
+      "content": {
+        sa_promotionid: this.data.params.content.sa_promotionid
+      }
+    }).then(res => {
+      console.log("促销购物车数量", res.data)
+      this.selectComponent("#Footer").setData({
+        badge: res.data.num || 0
+      })
+    });
+  },
+  updateCart({
+    detail
+  }) {
+    if (detail == "toindex") {
+      wx.navigateTo({
+        url: `/packageA/activity/selectProduct/cart/index?data=${
+          JSON.stringify({
+            "sa_brandid": this.data.params.content.sa_brandid,
+            "sa_promotionid": this.data.params.content.sa_promotionid,
+          })
+        }`,
+      })
+    } else {
+      _Http.basic({
+        "id": 20231024110003,
+        "content": {
+          sa_promotionid: this.data.params.content.sa_promotionid,
+          items: this.data.resultList.map(v => {
+            return {
+              "sa_brandid": this.data.params.content.sa_brandid,
+              "sa_promotionid": this.data.params.content.sa_promotionid,
+              "itemid": v.itemid,
+              "qty": v.qty,
+              "itemno": v.itemno,
+              "tradefield": v.tradefield.map(s => s.tradefield).join(","),
+              sa_promotion_itemsid: v.sa_promotion_itemsid,
+              "width": v.width || 0,
+              "length": v.length || 0,
+            }
+          })
+        },
+      }).then(res => {
+        console.log("批量添加购物车", res)
+        wx.showToast({
+          title: res.msg == '成功' ? '添加成功' : res.msg,
+          icon: "none"
+        })
+        if (res.msg == '成功') {
+          this.setData({
+            result: [],
+            resultList: [],
+          })
+          this.getCollectCount();
+        }
+      })
+    }
+  },
   customization(e) {
     let {
       item
@@ -150,7 +214,6 @@ Page({
       resultList
     });
   },
-
   /* 提交 */
   submit() {
     let result = this.data.result,

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

@@ -3,6 +3,7 @@
     "van-checkbox": "@vant/weapp/checkbox/index",
     "van-stepper": "@vant/weapp/stepper/index",
     "list": "../modules/list/index",
-    "custom": "../../../pages/index/collect/modules/custom"
+    "custom": "../../../pages/index/collect/modules/custom",
+    "footer": "./cart/footer"
   }
 }

+ 6 - 4
packageA/activity/selectProduct/index.wxml

@@ -23,7 +23,7 @@
 					长:{{item.length||0}} / 宽:{{item.width||0}}
 					<van-icon name="arrow-down" />
 				</view>
-
+				<view class="exp">特征码:{{item.signaturecode ||" --"}}</view>
 				<view class="exp">可购数量:{{item.groupqty==0?'不限购':(item.groupqty-item.saledqty)<=0?'已售罄':item.maxQty}} </view>
 				</view>
 			</view>
@@ -39,15 +39,17 @@
 	<view style="height: 100rpx;" />
 	<Yl_Empty wx:if="{{list.length==0}}" />
 </Yl_ListBox>
-
+<footer id='Footer' disabled='{{!result.length}}' bind:onClick='updateCart' />
 <!-- 底部 -->
-<view style="height: 130rpx;" />
+<!-- <view style="height: 130rpx;" />
 <view class="footer">
 	<view class="left">
 		已选{{result.length}}个
 	</view>
 	<van-button custom-class='but' disabled='{{!result.length}}' bind:click="submit">{{butText}}</van-button>
-</view>
+</view> -->
+
+
 
 <wxs module="decide">
 	module.exports = {

+ 7 - 0
project.private.config.json

@@ -64,6 +64,13 @@
           "query": "id=1803",
           "launchMode": "default",
           "scene": null
+        },
+        {
+          "name": "促销活动",
+          "pathName": "packageA/activity/detail",
+          "query": "id=2660",
+          "launchMode": "default",
+          "scene": null
         }
       ]
     }