Kaynağa Gözat

小菊优化

shish 4 yıl önce
ebeveyn
işleme
b0b5725d89

+ 88 - 90
hdApp/src/admin/billing/affirmGhs.vue

@@ -405,98 +405,96 @@ export default {
         console.log(this.couponText)
       }).catch(err => {})
     },
-		getGhsData(id) {
-			getGhsDataApi({id:id}).then(res => {
-				this.ghsMsg = res.data;
-				console.log('res.data',this.ghsMsg)
-				this.purchaseFreight(this.ghsMsg);
-			});
-		},
-		countAllPrices(e){
-			this.allPrices = this.allPrices+Number(this.form.sendCost)
-			console.log('e',e)
-			console.log('this.form.sendCost',Number(this.form.sendCost))
-			console.log('this.form.sendCost',this.form.sendCost)
-			console.log('this.allPrices',this.allPrices)
-		},
-
-		// api
-		_getDet() {
-			let data = uni.getStorageSync("modifyShopB");
-			if (this.$util.isEmpty(data)) return;
-			Object.keys(this.form).forEach((i, index) => {
-				// if (i != 'password') {
-				this.form[i] = data[i];
-				// }
-			});
-		},
-
-		purchaseFreight(info) {
-			const product = this.selectList.map(ele => {
-				return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
-			});
-			let params = {
-				ghsId: this.options.id,
-				product: JSON.stringify(product),
-				province: info.province,
-				city:info.city,
-				address:info.address,
-				floor:info.floor,
-				long: info.long,
-				lat: info.lat,
-				sendTime: this.sendTime,
-			};
-			freight(params).then(res => {
-				this.form.sendCost = res.data.sedCost;
-			});
-		},
-		confirmFn(options) {
-			createOrder(options).then(res => {
-				// this.$msg("下单成功");
-				this.resetSelectInfoByType(this.pageType);
-				const {
-					data: { id, orderSn }
-				} = res;
-				let url = `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
-				uni.redirectTo({
-					url: url,
-					success: result => {},
-					fail: () => {},
-					complete: () => {}
-				});
-			});
-		},
-		affirmFormSubmit(){
-			const product = this.list.map(ele => {
-				return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
+	getGhsData(id) {
+		getGhsDataApi({id:id}).then(res => {
+			this.ghsMsg = res.data;
+			console.log('res.data',this.ghsMsg)
+			this.purchaseFreight(this.ghsMsg);
+		});
+	},
+	countAllPrices(e){
+		this.allPrices = this.allPrices+Number(this.form.sendCost)
+		console.log('e',e)
+		console.log('this.form.sendCost',Number(this.form.sendCost))
+		console.log('this.form.sendCost',this.form.sendCost)
+		console.log('this.allPrices',this.allPrices)
+	},
+	_getDet() {
+		let data = uni.getStorageSync("modifyShopB");
+		if (this.$util.isEmpty(data)) return;
+		Object.keys(this.form).forEach((i, index) => {
+			this.form[i] = data[i];
+		});
+	},
+	purchaseFreight(info) {
+		const product = this.selectList.map(ele => {
+			return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
+		});
+		let params = {
+			ghsId: this.options.id,
+			product: JSON.stringify(product),
+			province: info.province,
+			city:info.city,
+			address:info.address,
+			floor:info.floor,
+			long: info.long,
+			lat: info.lat,
+			sendTime: this.sendTime,
+		};
+		freight(params).then(res => {
+			this.form.sendCost = res.data.sedCost;
+		});
+	},
+	confirmFn(options) {
+		createOrder(options).then(res => {
+			this.resetSelectInfoByType(this.pageType);
+			const {
+				data: { id, orderSn }
+			} = res;
+			let url = `/admin/billing/result?orderId=${id}&orderSn=${orderSn}`;
+			uni.redirectTo({
+				url: url,
+				success: result => {},
+				fail: () => {},
+				complete: () => {}
 			});
-			let parameter = {
-				getType:this.form.sendType,
-				sendTime:this.sendTime,
-				sendCost:this.form.sendType==2?'':this.form.sendCost,
-				remark:this.remark,
-				product:JSON.stringify(product),
-				ghsId:this.ghsMsg.id,
-        		couponId: this.form.couponId
-			}
-			let self = this;
-			uni.showModal({
-				title: '提示',
-				content: '确认提交?',
-				success: function (res) {
-					if (res.confirm) {
-						createOrder(parameter).then(res => {
-							const {data: { orderSn,realPrice,count,hasDebtPay }} = res;
-							self.pageTo({url: `/pagesPurchase/wechatPay?type=2&orderSn=${orderSn}&realPrice=${realPrice}&count=${count}&hasDebtPay=${hasDebtPay}`, type: 2})
-							setTimeout(() => {
-								uni.removeStorageSync('selectCouponInfo')
-								self.resetSelectInfoByType(self.pageType);
-							}, 600)
-						});
-					}
+		});
+	},
+	affirmFormSubmit(){
+		const product = this.list.map(ele => {
+			return { productId: ele.id, bigNum: ele.bigCount, smallNum: ele.smallCount,classId:ele.classId,itemId:ele.itemId };
+		});
+		let xj = uni.getStorageSync("ghsXj"+this.ghsMsg.id)
+		let params = {
+			getType:this.form.sendType,
+			sendTime:this.sendTime,
+			sendCost:this.form.sendType==2?'':this.form.sendCost,
+			remark:this.remark,
+			product:JSON.stringify(product),
+			ghsId:this.ghsMsg.id,
+			couponId: this.form.couponId,
+			xj:JSON.stringify(xj)
+		}
+		let self = this;
+		uni.showModal({
+			title: '提示',
+			content: '确认提交?',
+			success: function (res) {
+				if (res.confirm) {
+					createOrder(params).then(res => {
+						const {data: { orderSn,realPrice,count,hasDebtPay }} = res;
+						self.pageTo({url: `/pagesPurchase/wechatPay?type=2&orderSn=${orderSn}&realPrice=${realPrice}&count=${count}&hasDebtPay=${hasDebtPay}`, type: 2})
+						setTimeout(() => {
+							uni.removeStorageSync('selectCouponInfo')
+							self.resetSelectInfoByType(self.pageType);
+							//删除小菊的记忆
+          					uni.removeStorageSync("ghsXj"+params.ghsId)
+						}, 600)
+					});
 				}
-			});
-		},
+			}
+		});
+	},
     numberAdd(arg1, arg2) {
       var r1, r2, m, n;
       try {

+ 5 - 0
hdApp/src/api/shop/ext.js

@@ -0,0 +1,5 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+export const getGhsXj = data => {
+	return https.get('/shop-ext/get-ghs-xj', data)
+}

+ 49 - 45
hdApp/src/components/module/app-commodity.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="item-cmd_bx" @click="customNum">
+	<view class="item-cmd_bx" @click="customNum(info.variety)">
 		<view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
 			<image :src="info.cover" v-if="isImg"></image>
 		</view>
@@ -16,19 +16,17 @@
 					<view v-if="Number(info.discountPrice)>0" class="price" >¥{{ info.discountPrice }}</view>
 					<view v-else class="price" >¥{{ info.price }}</view>
 				</view>
-
 				<view class="price" v-else></view>
 				<view style="text-align: right" >
 					<view class="open-bx" >
-						<i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
-						<text class="num" @click.stop="customNum">
+						<i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
+						<text class="num">
 							<text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
 							<text v-if="smallCount > 0">/</text>
 							<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
 						</text>
-						<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click.stop="addEvents"></i>
+						<i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click.stop="addEvents(info.variety)"></i>
 					</view>
-					<text style="padding-right: 55rpx">还剩 {{ info.stock > showMaxStock ? showMaxStock : info.stock }}</text>
 				</view>
 			</view>
 			<view class="num-open_bx flex-space" v-if="type == COMMODITY_TYPE.CHANGE">
@@ -39,7 +37,6 @@
 					<allSelectInput :inputType="'digit'" :isActive="isAloneAllActive" :isFocus="isAloneAllFocus" :value="changeAutoPrice" :placeholder="'自动调价'"
 									@deleteInputVal="deleteInputVal" @initAllInput="initAloneAllInput" @moveAllInput="moveAllInput">
 					</allSelectInput>
-					<!--<input class="change-input" v-model="changeAutoPrice" type="digit" placeholder="自动调价"  selection-start="0" selection-end="1" />-->
 					<i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
 					<view class="btn-box" @click="changePriceEvent">确定</view>
 				</view>
@@ -52,18 +49,13 @@
 import { COMMODITY_TYPE } from "@/utils/declare";
 import AppImg from "@/components/app-img";
 import { autoPriceByIdApi, changePriceByIdApi } from '@/api/product/index'
-// import productMins from "@/mixins/productContrapose";
 import animationMins from "@/mixins/animation";
-
 import allSelectInput from "@/components/module/allSelectInput";
 import allSelectInputMins from "@/mixins/allSelectInput";
-//报错暂时注释
-//import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue'
 export default {
 	name: "Commodity",
 	components: {
 		AppImg,allSelectInput
-		//easyLoadimage
 	},
 	mixins: [animationMins,allSelectInputMins],
 	props: {
@@ -158,51 +150,64 @@ export default {
 		showBigImg(){
 			this.$emit("showBigCover", this.info);
 		},
-		addEvents() {
-			const ratio = Number(this.info.ratio);
-			if(this.offVerifyRepertory){
-				if(this.info.stock<=0){uni.showToast({title:'库存不足',icon:'none'});return;}
-				if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(this.info.bigNum) * ratio + Number(this.info.smallNum)) {
-					this.$msg("库存不足");
-					return
+		addEvents(variety) {
+			if(variety == 0){
+				const ratio = Number(this.info.ratio);
+				if(this.offVerifyRepertory){
+					if(this.info.stock<=0){
+						uni.showToast({title:'没有货了',icon:'none'})
+						return
+					}
+					if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(this.info.bigNum) * ratio + Number(this.info.smallNum)) {
+						this.$msg("库存只剩"+this.info.bigNum);
+						return
+					}
 				}
+				this.animationFun('add');
+				this.$emit("add", this.info);
+			}else{
+				//去特殊品种页
+				this.$emit("goToSpecialVariety", this.info);
 			}
-
-			this.animationFun('add');
-			// let params = {
-			// 	...this.info,
-			// 	bigCount: this.bigCount,
-			// 	smallCount: this.smallCount
-			// };
-			// this.$emit("add", this.info,params);
-			this.$emit("add", this.info);
 		},
-		delEvent() {
-			this.animationFun('del');
-			console.log(this.info,'this.info')
-			this.$emit("del", this.info);
+		delEvent(variety) {
+			if(variety == 0){
+				this.animationFun('del');
+				console.log(this.info,'this.info')
+				this.$emit("del", this.info);
+			}else{
+				//去特殊品种页
+				this.$emit("goToSpecialVariety", this.info);
+			}
 		},
 		changePriceEvent(event) {
 			this.isFocus = false;
 			this.isAlterMoney = true;
 
 		},
-		customNum() {
-			if(this.info.stock<=0){uni.showToast({title:'库存不足',icon:'none'});return;}
-			// if(!this.info.bigCount){
-			if(!this.bigCount && !this.smallCount){
-				let params = {
+		customNum(variety) {
+			if(variety == 0){
+				if(this.info.stock<=0){
+					uni.showToast({title:'没有货了',icon:'none'})
+					return
+				}
+				if(!this.bigCount && !this.smallCount){
+					let params = {
+						...this.info,
+						bigCount: this.bigCount,
+						smallCount: this.smallCount
+					};
+					this.$emit("addOneEvent", this.info,params);
+				}
+				this.$emit("customNum", {
 					...this.info,
 					bigCount: this.bigCount,
 					smallCount: this.smallCount
-				};
-				this.$emit("addOneEvent", this.info,params);
+				});
+			}else{
+				//去特殊品种页
+				this.$emit("goToSpecialVariety", this.info);
 			}
-			this.$emit("customNum", {
-				...this.info,
-				bigCount: this.bigCount,
-				smallCount: this.smallCount
-			});
 		}
 	}
 };
@@ -307,5 +312,4 @@ export default {
 		}
 	}
 }
-
 </style>

+ 1 - 72
hdApp/src/mixins/product.js

@@ -457,11 +457,6 @@ export default {
 			}else{
 				price = item.bigCount * Number(item.goodsStyleList[item.goodsStyleSelectIndex].price);
 			}
-			// let sum = 0;
-			// if()
-			// 	Number(bigCount) * Number(bigPrice) +
-			// 	Number(smallCount) * Number(smallPrice);
-			// price = Math.round(sum * 100) / 100;
 			return price;
 		},
 		/**
@@ -551,7 +546,7 @@ export default {
 							) {
 								list[index].bigCount = Number(item.bigNum);
 								list[index].smallCount = Number(item.smallNum);
-								this.$msg("库存不足");
+								this.$msg("库存还剩"+item.bigNum);
 								return;
 							}
 						}
@@ -592,15 +587,11 @@ export default {
 				}
 			}
 			this.setSelectInfoByType({ type: this.pageType, info: list });
-			// this.$forceUpdate();
 		},
 
 		addCustomNumEvent(item,params1,type) {
 			const list = this.selectList;
-
-			// if (!has) {}
 			let info = { classId: item.classId, id: item.id };
-
 			const classInfo =
 				this.productInfo &&
 				this.productInfo.find(element => {
@@ -611,7 +602,6 @@ export default {
 					return ele.id == item.id;
 				});
 			}
-
 			let params = {
 				...info,
 				bigCount: 0, //扎数
@@ -625,7 +615,6 @@ export default {
 			this.$nextTick(()=>{
 				this.customNum(params1)
 			})
-			// this.$forceUpdate();
 		},
 		/**
 			* 减去商品
@@ -655,66 +644,6 @@ export default {
 			}
 			this.setSelectInfoByType({type: this.pageType, info: list});
 		},
-
-		// 	const list = this.selectList;
-		// 	let has = false;
-		// 	for (let index = 0; index < list.length; index++) {
-		// 		const element = list[index];
-		// 		if (element.id == item.id && element.classId == item.classId) {
-		// 			has = true;
-		//
-		// 			if (element.bigCount > 0) {
-		// 				if(!this.isSmallCount){list[index] = { ...element, bigCount: --element.bigCount };}
-		// 			}
-		// 			if (element.smallCount > 0) {
-		// 				if(this.isSmallCount){list[index] = { ...element, smallCount: --element.smallCount };}
-		// 			}
-		//
-		// 			if (this.isLimit) {
-		// 				const { bigCount, smallCount } = list[index];
-		// 				//超过库存时 设置为库存最大值
-		// 				const ratio = Number(item.ratio);
-		// 				if (
-		// 					Number(bigCount) * ratio + Number(smallCount) >
-		// 					Number(item.bigNum) * ratio + Number(item.smallNum)
-		// 				) {
-		// 					list[index].bigCount = Number(item.bigNum);
-		// 					list[index].smallCount = Number(item.smallNum);
-		// 				}
-		// 			}
-		// 			if (element.bigCount == 0 && element.smallCount == 0) {
-		// 				list.splice(index, 1);
-		// 			}
-		//
-		// 			break;
-		// 		}
-		// 	}
-		// 	if (!has) {
-		// 		let info = { classId: item.classId, id: item.id };
-		//
-		// 		const classInfo =
-		// 			this.productInfo &&
-		// 			this.productInfo.find(element => {
-		// 				return element.classId == item.classId && element.child;
-		// 			});
-		// 		if (classInfo) {
-		// 			info = classInfo.child.find(ele => {
-		// 				return ele.id == item.id;
-		// 			});
-		// 		}
-		// 		let params = {
-		// 			...info,
-		// 			bigCount: 1, //扎数
-		// 			smallCount: 0, //支数
-		// 			autoPrice: 0 //调价价格
-		// 		};
-		//
-		// 		list.push(params);
-		// 	}
-		// 	this.setSelectInfoByType({ type: this.pageType, info: list });
-		// 	// this.$forceUpdate();
-		// },
-		// //减去所有商品
 		delAllEvent(item) {
 			const list = this.selectList;
 			for (let index = 0; index < list.length; index++) {

+ 7 - 0
hdApp/src/pages.json

@@ -891,6 +891,13 @@
 						"navigationBarTitleText": "订单详情",
 						"enablePullDownRefresh": true
 					}
+				},
+				{
+					"path": "xj",
+					"style": {
+						"navigationBarTitleText": "选择小菊颜色",
+						"enablePullDownRefresh": true
+					}
 				}
 			]
 		},

+ 65 - 10
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -12,7 +12,7 @@
       </view>
     </view>
 		<view class="input-wrap" >
-			<app-search-module v-model="py" placeholder="输入关键词,支持拼音首字母搜索" @input="searchFn" />
+			<app-search-module v-model="py" placeholder="输入拼音首字母搜索" @input="searchFn" />
 		</view>
 		<view class="scroll-middle_bx">
 			<scroll-view scroll-y scroll-with-animation class="tab-view" :scroll-top="scrollTop" >
@@ -50,6 +50,7 @@
 									@addOneEvent="addCustomNumEvent"
 									@del="delEvent"
 									@showBigCover="showBigCover"
+									@goToSpecialVariety="goToSpecialVariety"
 								></Commondity>
 							</view>
 						</template>
@@ -152,6 +153,8 @@ export default {
 			myClass: 'fadeIn',
 			shopId:0,
 			infoData:{},
+			xjData:{},
+			xjDataInfo:{}
 		};
 	},
 	onPullDownRefresh() {
@@ -176,6 +179,57 @@ export default {
 			}
 		}
 	},
+	onShow(){
+		if(this.xjData.hasUpdate == 1){
+			console.log('this.xjData',this.xjData)
+			console.log('this.xjDataInfo',this.xjDataInfo)
+
+			const list = this.selectList;
+
+			this.customData = this.xjDataInfo
+
+			if(this.xjData.cancel == 1){
+				this.customData.bigCount = 0
+				this.customData.smallCount = 0
+				console.log('this.customData',this.customData)
+				this.affirm({index:0})
+			}else{
+
+				//判断list有没有数据,没有需要初始化
+				const list = this.selectList;
+				let has = false
+				for (let index = 0; index < list.length; index++) {
+					const element = list[index];
+					if (element.id == this.xjDataInfo.id && element.classId == this.xjDataInfo.classId) {
+						has = true
+					}
+				}
+
+				if(has == false){
+					let params = {
+						...this.xjDataInfo,
+						bigCount: null, //扎数
+						smallCount: null, //支数
+						autoPrice: null, //调价价格
+						realityWeight: null, //调价价格
+						userPrice: null, //调价价格
+					};
+					list.push(params);
+					this.setSelectInfoByType({ type: this.pageType, info: list });
+				}
+
+				this.customData.bigCount = this.xjData.stock
+				this.customData.smallCount = 0
+				this.customData.bigPrice = this.xjData.price
+				this.customData.price = this.xjData.price
+				this.customData.itemPrice = this.xjData.price
+				this.customData.userPrice = (Number(this.xjData.stock) * Number(this.xjData.price)).toFixed(2)
+
+				this.affirm({index:1})
+			}
+		}
+		this.xjData = {}
+	},
 	onLoad() {
 	},
 	onUnload() {
@@ -200,6 +254,15 @@ export default {
 
 	},
 	methods: {
+		//去特殊品种页,如小菊等
+		goToSpecialVariety(info){
+			this.xjDataInfo = info
+			if(info.stock <= 0){
+				uni.showToast({title:"没有库存",icon:"none"})
+			}else{
+				this.$util.pageTo({url: "/pagesPurchase/xj",query: {stock:info.stock,price: info.price,ghsId:this.option.id}})
+			}
+		},
 	    showPopup() {
 	        this.popupShow = true;
 	    },
@@ -261,10 +324,7 @@ export default {
 		scroll_detail(options){
 			if(options.detail.scrollTop > 20) {
 				this.myClass = 'fadeOut'
-			} else {
-				//this.myClass = 'fadeIn'
 			}
-			//options  为滚动信息。  options.detail.scrollTop  值为相对于scroll-view。
 			if(!uni.getStorageSync("resolve")){
 				this.get_node_details(options);
 			};
@@ -272,8 +332,6 @@ export default {
 		rightScroll(e) {
 			if(e.detail.scrollTop > 20) {
 				this.myClass = 'fadeOut'
-			} else {
-				//this.myClass = 'fadeIn'
 			}
 		},
 		//自定义数量
@@ -285,9 +343,6 @@ export default {
 				this.customData.bigCount = 	this.customData.bigCount==0?null:this.customData.bigCount;
 				this.isFocus = true;
 			})
-			// this.$nextTick(()=>{
-			// 	this.initAllInput();
-			// })
 		},
 		toPage() {
 			this.$util.pageTo({
@@ -350,7 +405,7 @@ export default {
 				//超过库存时 设置为库存最大值 1
 				if (Number(bigCount) * ratioNum + Number(smallCount) > Number(bigNum) * ratioNum + Number(smallNum)) {
 					uni.showToast({
-						title: '库存不足',
+						title: '库存还剩'+bigNum,
 						icon: "none"
 					});
 					this.customData.bigCount = 0;

+ 343 - 0
hdApp/src/pagesPurchase/xj.vue

@@ -0,0 +1,343 @@
+<template>
+	<view class="billing_box_bg">
+    	<view class="input-wrap">
+			<text>剩余:{{option.stock}}扎</text><text style="margin-left:50rpx;">单价:{{option.price}}</text>
+		</view>
+		<view class="scroll-middle_bx">
+			<block>
+				<view class="item_list_bx"  style="width: 100%">
+					<view v-for="(xjItem,xjIndex) in xjList" :key="xjIndex">
+						<view>
+							<view class="item-cmd_bx">
+								<view class="img_bx" style="background:#eeeeee">
+									<image :src="xjItem.cover"></image>
+								</view>
+								<view class="cmd-info_bx">
+									<view class="tit">{{ xjItem.name || "" }}</view>
+									<view class="kc"></view>
+									<view class="num-open_bx">
+										<view class="open-bx warn">
+											数量:<input class="change-input" @focus="xjNum = ''" 
+											placeholder-style="color:#CCCCCC" v-model="numList[xjItem.id]" type="digit" placeholder="请填写" />
+										</view>
+									</view>
+								</view>
+							</view>
+						</view>
+					</view>
+					<view>
+						<button class="admin-button-com big default" @click="clearXj()">清除全部</button>
+						<button class="admin-button-com big default" @click="goBack()" style="margin-left:65rpx;padding:30rpx 55rpx 30rpx 55rpx;">返回</button>
+						<button class="admin-button-com big blue" @click="confirmXj()" style="margin-left:65rpx;padding:30rpx 65rpx; 30rpx 65rpx;" >确认</button>
+					</view>
+				</view>
+			</block>
+		</view>
+	</view>
+</template>
+<script>
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import { mapGetters } from "vuex";
+import { getGhsXj } from "@/api/shop/ext"
+export default {
+	name: "xj",
+	components: {
+		AppWrapperEmpty,
+	},
+	mixins: [],
+	data() {
+		return {
+			xjNum:'',
+			xjList:[],
+			xjData:[],
+			numList:[],
+		};
+	},
+	computed:{
+		...mapGetters(["getMyShopInfo","getLoginInfo"]),
+	},
+	onLoad() {
+
+		let history = uni.getStorageSync("ghsXj"+this.option.ghsId)
+		if(!this.$util.isEmpty(history)){
+			history.forEach((item,index)=>{
+				this.numList[item.id] = item.num
+			})
+		}
+
+	},
+	onPullDownRefresh() {
+	},
+	onShow(){
+	},
+	methods: {
+		clearXj(){
+			uni.removeStorageSync("ghsXj"+this.option.ghsId)
+			if(!this.$util.isEmpty(this.numList)){
+				console.log('this.numList',this.numList)
+				this.numList.forEach((item,index,arr)=>{
+					arr[index]=''
+				})
+				this.$forceUpdate();
+				console.log('this.numList',this.numList)
+			}
+
+			//返回上一页带参数
+			let pages = getCurrentPages();
+			let prevPage = pages[ pages.length - 2 ];
+			//修改上一页data里面的xjData
+			prevPage.$vm.xjData = {price:null,stock:0,hasUpdate:1,cancel:1}
+			uni.navigateBack({});
+
+		},
+		goBack(){
+			//返回上一页带参数
+			let pages = getCurrentPages();
+			let prevPage = pages[ pages.length - 2 ];
+			//修改上一页data里面的xjData
+			prevPage.$vm.xjData = {price:this.option.price,stock:0,hasUpdate:0,cancel:0}
+			uni.navigateBack({});
+		},
+		confirmXj(){
+
+			let arr = []
+			this.numList.forEach((num,id)=>{
+				if(!this.$util.isEmpty(num) && Number(num)>0){
+					arr.push({id:id,num:num})
+				}
+			})
+
+			if(this.$util.isMoney(this.option.price) == false){
+				this.$msg("请填写单价")
+				return false
+			}
+
+			let totalNum = 0
+			arr.forEach((item)=>{
+				totalNum = (Number(item.num) + Number(totalNum)).toFixed(0)
+			})
+			if(totalNum <= 0){
+				this.$msg("请填写数量")
+				return false
+			}
+
+			if(totalNum > Number(this.option.stock)){
+				this.$msg("数量超过总库存")
+				return false
+			}
+
+			uni.setStorageSync("ghsXj"+this.option.ghsId, arr)
+
+			//返回上一页带参数
+			let pages = getCurrentPages();
+			let prevPage = pages[ pages.length - 2 ];
+			//修改上一页data里面的xjData
+			prevPage.$vm.xjData = {price:this.option.price,stock:totalNum,hasUpdate:1,cancel:0}
+			uni.navigateBack({});
+
+		},
+		init(){
+			getGhsXj({ghsId:this.option.ghsId}).then(res => {
+				this.xjList = res.data.list
+				console.log('list',this.xjList)
+			});
+		}
+	}
+};
+</script>
+
+<style lang="scss" scoped>
+.billing_box_bg {
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	.input-wrap {
+		font-size:30rpx;
+		display: flex;
+		padding: 22px 20px 22px 30px;
+		.search-bar {
+			flex: 1;
+		}
+		.city-select {
+			display: flex;
+			flex-shrink: 0;
+			align-items: center;
+			margin-right: 15upx;
+			margin-left: 45px;
+			background-color: #ffff;
+			.iconfont {
+				margin-left: 20upx;
+				font-size: 30upx;
+			}
+		}
+	}
+	.scroll-middle_bx {
+		flex: 1;
+		display: flex;
+		width: 100%;
+		height: 100%;
+	}
+	.tab-view {
+		height: 100%;
+		width: 170upx;
+		flex-shrink: 0;
+		background-color: #f0f2f6;
+		.tab-bar-item {
+			position: relative;
+			width: 170upx;
+			height: 90upx;
+			box-sizing: border-box;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			font-size: 26upx;
+			color: #444;
+			font-weight: 400;
+			.tag {
+				display: flex;
+				padding: 0 20px;
+				align-items: center;
+				position: absolute;
+				right: 0;
+				top: 0;
+				height: 32px;
+				background: #ff2842;
+				border-radius: 16px;
+				color: #fff;
+				font-size: 20px;
+			}
+			&:last-child{
+				margin-bottom: 110upx;
+			}
+		}
+		.active {
+			position: relative;
+			color: $mainColor;
+			font-size: 26px;
+			background: #fff;
+		}
+		.active::before {
+			content: "";
+			position: absolute;
+			border-left: 8upx solid $mainColor;
+			height: 100%;
+			left: 0;
+		}
+	}
+	.right-box {
+		height: 100%;
+		flex: 1;
+		box-sizing: border-box;
+	}
+	.item_list_bx {
+		padding: 10px 40px;
+	}
+	.item_list_title {
+		margin-bottom: 20px;
+		font-size: 24px;
+		font-weight: 600;
+		color: #666666;
+	}
+	.select-cmd_bx {
+		& .kc {
+			color: #999999;
+			font-size: 28px;
+			font-weight: 400;
+			margin-bottom: 60px;
+			text-align: center;
+			margin-top: 10px;
+		}
+		& .num_bx {
+			display: flex;
+			align-items: center;
+			margin-bottom: 80px;
+			& > input {
+				width: 212px;
+				height: 80px;
+				border: 1px solid #dddddd;
+				border-radius: 4px;
+				text-align: center;
+				margin-right: 24px;
+			}
+		}
+	}
+}
+.item-cmd_bx {
+	position: relative;
+	margin-bottom: 20px;
+	.img_bx {
+		height: 160px;
+		width: 160px;
+		position: absolute;
+		left: 0px;
+		top: 0px;
+		image{
+			width: 100%;
+			height: 100%;
+		}
+	}
+	.cmd-info_bx {
+		position: relative;
+		padding-left: 177px;
+		&.active{
+			&:before{
+				content: ' ';
+				height: 22rpx;
+				width: 22rpx;
+				border-width: 2rpx 2rpx 0 0;
+				border-color: #b2b2b2;
+				border-style: solid;
+				-webkit-transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
+				transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
+				position: absolute;
+				top: 50%;
+				margin-top: -12rpx;
+				right: 30rpx;
+			}
+		}
+
+		& .tit {
+			font-size: 30px;
+			font-weight: 700;
+			color: #333333;
+		}
+		& .kc {
+			color: #999999;
+			font-size: 24px;
+			padding: 10px 0 24px;
+		}
+		& .num-open_bx {
+			display: flex;
+			align-items: center;
+			& .price {
+				font-size: 28px;
+				color: #999999;
+				flex: 1;
+			}
+			& .open-bx {
+				color: #333333;
+				text{
+					font-size: 24rpx;
+				}
+				*.warn {
+					color: $redColor;
+				}
+			}
+		}
+	}
+}
+.change-input {
+	width: 285px;
+	height: 60px;
+	line-height: 60px;
+	text-align: center;
+	background: #ffffff;
+	border: 1px solid #b4b4b4;
+	border-radius: 4px;
+	font-size: 25px;
+	color:#5e5d5d;
+	position: relative;
+	left:120rpx;
+	top:-36rpx;
+}
+</style>

+ 8 - 2
hdApp/src/utils/util.js

@@ -99,6 +99,11 @@ const checkName = str => {
 	return /^[\u4E00-\u9FA5A-Za-z\s]+(·[\u4E00-\u9FA5A-Za-z]+)*$/.test(str);
 };
 
+//是否金额
+const isMoney = money =>{
+	return /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/.test(money)
+}
+
 /** *
  * 检查登录
  * @parmas query 拼接得参数对象
@@ -309,5 +314,6 @@ export default {
 	getCheckLogin,
 	numberFormat,
 	isString,
-	unique
-};
+	unique,
+	isMoney
+};