shish 4 лет назад
Родитель
Сommit
7edb179d44

+ 1 - 8
ghsApp/src/admin/billing/affirm.vue

@@ -21,7 +21,7 @@
                   <view class="info-line">
                     <text class="item-type"></text>
                     <text class="item-count">
-                      <text v-if="item.bigCount > 0">{{`${item.bigCount}`}}扎</text>
+                      <text>{{`${item.bigCount}`}}扎</text>
                     </text>
                   </view>
                 </view>
@@ -38,14 +38,7 @@
             </view>
           </view>
         </view>
-        <!-- 登录信息 -->
         <view class="module-com input-line-wrap">
-        <!--
-          <view class="tab-box flex-space">
-            <view class="flex-center tab" :class="isBilling?'active':''" @tap="isBilling=true">开单</view>
-            <view class="flex-center tab" :class="isBilling?'':'active'" @tap="isBilling=false">报损</view>
-          </view>
-        -->
 					<view class="" v-if="isBilling">
           <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selectCustom">
             <view class="tui-title">客户</view>

+ 1 - 1
ghsApp/src/admin/billing/index.vue

@@ -175,7 +175,7 @@ export default {
 				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.customData.userPrice = this.xjData.price
 
 				this.affirm({index:1})
 			}

+ 5 - 3
ghsApp/src/mixins/product.js

@@ -111,9 +111,6 @@ export default {
 		}
 	},
 	onShow(){
-		if (this.autoLoad) {
-			this.initData();
-		}
 		//修改花材
 		if(this.option.modifyProductKey){
 			if(uni.getStorageSync('selectList'+this.option.modifyProductKey)){
@@ -132,6 +129,11 @@ export default {
 	},
 	methods: {
 		...mapActions(["setSelectInfoByType", "resetSelectInfoByType"]),
+		init(){
+			if (this.autoLoad) {
+				this.initData();
+			}
+		},
 		//记忆已选的花材
 		rememberProduct(){
 			if(this.pageType == 'bill' && !this.$util.isEmpty(this.option.customId)){

+ 3 - 3
ghsApp/src/pagesPurchase/add.vue

@@ -144,9 +144,9 @@ export default {
 		if(uni.getStorageSync('selectList'+this.pageType)){
 			this.setSelectInfoByType({ type: this.pageType, info: uni.getStorageSync('selectList'+this.pageType) });
 		}
-		this.shopId = this.getMyShopInfo.id;
-		let type = '';
-		this.initData({ type, shopId: this.shopId,status:0});
+		//this.shopId = this.getMyShopInfo.id;
+		//let type = '';
+		//this.initData({ type, shopId: this.shopId,status:0});
 	},
 	onLoad() {
 		this.shopId = this.getMyShopInfo.id;

+ 172 - 163
hdApp/src/admin/billing/affirmGhs.vue

@@ -7,12 +7,10 @@
 	height: 100%;
 	display: flex;
 	flex-direction: column;
-
 	.affirm-view {
 		flex: 1;
 		padding: 20px;
 		background-color: #f0f2f6;
-
 		.commodity-view {
 			display: flex;
 			flex-direction: column;
@@ -99,16 +97,15 @@
 			margin-bottom: 20px;
 			border-radius: 10px;
 			overflow: hidden;
-      padding-top: 20rpx;
+      		padding-top: 20rpx;
 			.ghs-msg{
 				padding: 0 20rpx 20rpx;
-					// height: 60rpx;
-				font-size: 28rpx;
+				font-size: 32rpx;
 				&.active{
 					color: #868686;
 					font-size: 24rpx;
 				}
-				i{color: #62ed73;font-size: 32rpx}
+				i{color: #62ed73;font-size: 48rpx}
 			}
 
 			.member-wrap {
@@ -221,24 +218,39 @@
 				<!-- 登录信息 -->
 				<view class="module-com input-line-wrap">
 
+					<!--
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
 						<view class="tui-title ">送货</view>
 						<button @click="form.sendType=1" class="admin-button-com mini-btn" :class="form.sendType==1?'blue':'default'">配送</button>
 						<button @tap="form.sendType=2" class="admin-button-com mini-btn" :class="form.sendType==2?'blue':'default'">自取</button>
+					</tui-list-cell> 
+					-->
+
+					<tui-list-cell class="line-cell" :hover="false" :arrow="true">
+						<view class="tui-title ">配送时间</view>
+						
+						<picker mode="date" :value="sendTimeWant" @change="bindDateChange" style="width:400rpx;">
+                        <view class="uni-input">{{sendTimeWant || '默认今天'}}</view>
+                    	</picker>
+
 					</tui-list-cell>
 
-            <appTimer :placeholder="'默认30分钟后配送'" @confirm="onConfirm" :sendTime="sendTime"></appTimer>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="form.sendType == 1">
 						<view class="tui-title ">运费</view>
 						<input type="number" placeholder="" @input="countAllPrices" v-model="form.sendCost" placeholder-class="tui-placeholder" disabled>
 					</tui-list-cell>
-          <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="toCoupon">
+
+					<!--
+          			<tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="toCoupon">
 						<view class="tui-title ">红包/抵用券</view>
 						<view class="coupon_box">{{couponText}}</view>
 					</tui-list-cell>
+					-->
+
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
-						<textarea style="height: 100rpx" v-model="remark" placeholder="备注"/>
+						<textarea style="height: 100rpx" v-model="remark" placeholder="这里写备注"/>
 					</tui-list-cell>
+
 				</view>
 			</form>
 		</view>
@@ -272,7 +284,7 @@ import appAddressGroup from "@/components/app-address-group";
 import appFormSend from "@/components/app-form-send";
 import appSendTime from "@/components/app-send-time";
 const formUtil = require("@/utils/formValidation.js");
-// import { createOrder } from "@/api/order/index";
+import AppDatePicker from "@/components/app-date-picker";
 import { getGhsDataApi } from "@/api/ghs/index";
 import { freight,createOrder } from "@/api/purchase/index";
 import { mapActions, mapGetters } from "vuex";
@@ -285,12 +297,13 @@ export default {
 		AppAvatarModule,
 		SimpleAddress,
 		AppAreaSel,
-    appSendTime,
+    	appSendTime,
 		AppCustomerSel,
 		appFormRadioBtn,
 		appAddressGroup,
 		appFormSend,
-    appTimer
+    	appTimer,
+		AppDatePicker
 	},
 	mixins: [productMins],
 	data() {
@@ -298,7 +311,7 @@ export default {
 			list:[],
 			autoLoad: false,
 			ghsMsg:'',
-			sendTime:'',
+			sendTimeWant:'',
 			remark:'',
 			form: {
 				debt:1,//结算方式 1欠款订单 0正常订单
@@ -310,20 +323,20 @@ export default {
 				receiveAddress: "",
 				receiveLong: "",
 				receiveLat: "",
-				sendType: 1,
+				sendType: 2,
 				sendSide: "2",
 				sendDate: "",
-				sendTime: "",
+				sendTimeWant: "",
 				sendCost: "",
 				customId: "",
 				product: "",
-        couponId: '0'
+        		couponId: '0'
 			},
-			// 详细地址
-			// showRegion: false,
 			showCustomer: false,
-      couponSumText: '',
-      couponText: ''
+      		couponSumText: '',
+      		couponText: '',
+			today:'',
+			monthLater:''
 		};
 	},
 	onLoad(e) {
@@ -338,8 +351,8 @@ export default {
 				title: this.getMerchantInfo.name
 			});
 		}
-    
 		this.getGhsData(e.id);
+
 	},
 	onShow() {
 		console.log(this.selectList,'selectList')
@@ -382,147 +395,147 @@ export default {
 		init() {
 			this._getDet();
 		},
-    onConfirm(val) {
-      this.sendTime = val
-    },
-	toPhone(phone){
-		let amount = this.form.sendType == 1 ? this.allPrice+Number(this.form.sendCost) : this.allPrice
-		uni.makePhoneCall({
-			phoneNumber: phone
-		});
-	},
-    toCoupon() {
-      let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
-      console.log(amount)
-      this.pageTo({url: '/admin/coupon/selectCouponList?price=' + amount})
-    },
-    // 是否有可用优惠券、红包
-    hasCoupon() {
-      let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
-      shopHouponHas({amount}).then(res => {
-        console.log(377, res)
-        this.couponText = res.data.has ? '有红包可用' : ''
-        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)
-	},
-	_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: () => {}
+		bindDateChange(e){
+			let date = e.detail.value;
+			this.sendTimeWant = date
+		},
+		toPhone(phone){
+			let amount = this.form.sendType == 1 ? this.allPrice+Number(this.form.sendCost) : this.allPrice
+			uni.makePhoneCall({
+				phoneNumber: phone
 			});
-		});
-	},
-	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)
-					});
+		},
+		toCoupon() {
+		let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
+		console.log(amount)
+		this.pageTo({url: '/admin/coupon/selectCouponList?price=' + amount})
+		},
+		// 是否有可用优惠券、红包
+		hasCoupon() {
+		let amount = this.form.sendType == 1 ? this.numberAdd(this.allPrice, Number(this.form.sendCost)) : this.allPrice
+		shopHouponHas({amount}).then(res => {
+			this.couponText = res.data.has ? '有红包可用' : ''
+			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)
+		},
+		_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,
+				sendTimeWant: this.sendTimeWant,
+			};
+			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: () => {}
+				});
+			});
+		},
+		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,
+				sendTimeWant:this.sendTimeWant,
+				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 {
+				r1 = arg1.toString().split(".")[1].length
+			} catch (e) {
+				r1 = 0
 			}
-		});
-	},
-    numberAdd(arg1, arg2) {
-      var r1, r2, m, n;
-      try {
-          r1 = arg1.toString().split(".")[1].length
-      } catch (e) {
-          r1 = 0
-      }
-      try {
-          r2 = arg2.toString().split(".")[1].length
-      } catch (e) { 
-          r2 = 0 
-      } 
-      m = Math.pow(10, Math.max(r1, r2))
-      n = (r1 >= r2) ? r1 : r2;
-      return ((arg1 * m + arg2 * m) / m).toFixed(n);
-  },
-  NumberSub(arg1, arg2) {
-    var re1, re2, m, n;
-    try {
-        re1 = arg1.toString().split(".")[1].length;
-    } catch (e) {
-    re1 = 0;
-    }
-    try {
-        re2 = arg2.toString().split(".")[1].length;
-    } catch (e) {
-        re2 = 0;
-    }
-    m = Math.pow(10, Math.max(re1, re2)); 
-    n = (re1 >= re2) ? re1 : re2;
-    return ((arg1 * m - arg2 * m) / m).toFixed(n);
-  },
+			try {
+				r2 = arg2.toString().split(".")[1].length
+			} catch (e) { 
+				r2 = 0 
+			} 
+			m = Math.pow(10, Math.max(r1, r2))
+			n = (r1 >= r2) ? r1 : r2;
+			return ((arg1 * m + arg2 * m) / m).toFixed(n);
+		},
+		NumberSub(arg1, arg2) {
+			var re1, re2, m, n;
+			try {
+				re1 = arg1.toString().split(".")[1].length;
+			} catch (e) {
+			re1 = 0;
+			}
+			try {
+				re2 = arg2.toString().split(".")[1].length;
+			} catch (e) {
+				re2 = 0;
+			}
+			m = Math.pow(10, Math.max(re1, re2)); 
+			n = (re1 >= re2) ? re1 : re2;
+			return ((arg1 * m - arg2 * m) / m).toFixed(n);
+		},
 		// 表单验证
 		async formSubmit(e) {
 			try {
@@ -537,10 +550,6 @@ export default {
 					await this.initMerchantInfo();
 				}
 				formData.shopId = this.getMerchantInfo.id;
-
-				console.log(9999, formData);
-				// this.confirmFn(formData);
-				// let rules = rules.concat(temp);
 				let checkRes = formUtil.validation(formData, []);
 				// 验证通过!
 				if (!checkRes) {