zpj il y a 2 ans
Parent
commit
b1b9ad3f3c

+ 2 - 1
pages-takeout/confirm-mod/edit-code.vue

@@ -10,7 +10,7 @@
 				
 				<view class="scroll-view-css">
 					<view class="" v-for="(item,i) in value" :key="i">
-						<input type="text" v-model="value[i]">
+						<input type="text" v-model="value[i]" maxlength="20" placeholder="未输入取件码" placeholder-class="input-p fc-FB3D03">
 					</view>
 				</view>
 			</view>
@@ -19,6 +19,7 @@
 </template>
 
 <script>
+	import tools from "@/service/tools";
 	export default {
 		props:['value'],
 		data(){

+ 14 - 36
pages-takeout/confirm-order.vue

@@ -18,20 +18,6 @@
 							class="fs-28 fc-9">{{addressData.phone||''}}</span>
 					</view>
 				</view>
-
-				<!-- <view class="box-input flex-justify-space align-items-center box-border-box p-b-20 mb-20" @click="selectFun(3)">
-					<view class="fs-28 fw-600">预计送达</view>
-					<view class="align-items-center">
-						<view class="fs-28 fw-400 fc-41ABF5">预计 12:30 送达</view>
-						<image class="right-icon" src="@/static/img/toRight.png" mode=""></image>
-					</view>
-				</view> -->
-
-				<!-- <view  class="box-input flex-justify-space box-border-box p-b-20 mb-20">
-					<view class="fs-28 fw-600">配送方式</view>
-					<view class="fs-24 fw-400 sd-box fc-FB3D03">送达宿舍</view>
-				</view> -->
-
 				<view class="p-b-20">
 					<view class=" flex-justify-space box-border-box p-b-20">
 						<view class="fs-28 fw-600">取件码</view>
@@ -51,7 +37,6 @@
 
 			<view class="box-card box-border-box bgc-f mb-20">
 				<view class="mb-32 b-b-F9F9F9">
-					<!-- <view class="fs-28 fw-600 mb-24">宋氏重庆鸡公煲(重工业店)宋氏重庆鸡公煲(重工业店)宋氏重庆鸡公煲(重工业店)</view> -->
 					<view class="flex-justify-space mb-28" v-for="(item,i) in cardData.goods_list" :key="i">
 						<image class="goods-img" :src="item.serve_image" mode="aspectFill"></image>
 						<view class="w376">
@@ -64,14 +49,6 @@
 						<view class="fs-32 fw-600">¥{{Number(item.number * Number(item.price)).toFixed(2)}}</view>
 					</view>
 				</view>
-				<!-- <view class="flex-justify-space mb-24">
-					<view class="fs-28 fw-400">打包费</view>
-					<view class="fs-32 fw-600">¥3</view>
-				</view> -->
-				<!-- <view class="flex-justify-space mb-24">
-					<view class="fs-28 fw-400">配送费</view>
-					<view class="fs-32 fw-600">¥3</view>
-				</view> -->
 				<view class="flex-justify-space mb-24 p-b-20 b-b-F9F9F9" @click="selectFun(1)">
 					<view class="fs-28 fw-400">优惠券</view>
 					<view class="align-items-center">
@@ -94,17 +71,6 @@
 					<view class="fs-28 fw-600 w158 mr-12">备注</view>
 					<input class="flex-1 text-align-right fs-28" type="text" placeholder="请填写你的备注">
 				</view>
-				<!-- <view class="fs-28 fw-600 mb-16">平台将通过服务通知向你推送最新动态</view>
-				<view class="p-16 bgc-F3F4F6 b-rad-12 tz-an-f">
-					<view class="fc-0 fw-400 fs-24 mb-4">是否电话通知</view>
-					<view class="fc-9 fw-400 fs-24">若开启,则订单送达系统自动曝光(电话)通知</view>
-					<view class="tz-an">
-						<view class="r-right" @click="fromData.is_default == 1?fromData.is_default=0:fromData.is_default=1"
-						:class="fromData.is_default == 0?'n-r':'s-r'">
-							<view class="r-y"></view>
-						</view>
-					</view>
-				</view> -->
 				<view class="p-b-20"></view>
 			</view>
 
@@ -256,11 +222,23 @@
 			giveTime(e) {
 				console.log(e);
 			},
-			toSave() {
+			toSave() {				
 				if (!this.fromData.address_id) {
 					return tools.error('请先选择地址')
 				}
-
+				
+				let flag = false;
+				flag = this.fromData.pickup_code.every(item => item)
+				if (!flag) {
+					return tools.error('请先输入取件码')
+				}
+				
+				let codeRule = /^[A-Za-z0-9-]+$/
+				let flagRule = this.fromData.pickup_code.every((item) => {return codeRule.test(item)});
+				if(!flagRule){
+					return tools.error('请输入正确的取件码')	
+				}
+				
 				if (this.isAJAX) {
 					return
 				}

+ 21 - 15
pages-takeout/replace-take.vue

@@ -292,25 +292,31 @@
 				this.$refs.popupBuy.open()
 			},
 			createOrder() {
+				if (!this.addressData.site_id) {
+					return tools.error('请选择站点')
+				}
 				if (this.pickup_code.length == 0) {
 					return tools.error('请选择商品')
 				}
-				let flag = this.pickup_code.every((item) => {
-					return item.code
-				});
-				if (flag) {
-					let arr = [];
-					this.pickup_code.forEach((v) => {
-						arr.push(v.code)
-					})
-					let pickup_code = arr.join(',')
-					uni.setStorageSync('isConfirmAddressFlag', false);
-					uni.navigateTo({
-						url: 'pages-takeout/confirm-order?pickup_code=' + pickup_code + '&type=2'
-					})
-				} else {
-					tools.error('请输入取件码')
+				let flag = this.pickup_code.every((item) => {return item.code});
+				if (!flag) {
+					return tools.error('请输入取件码')	
 				}
+				let codeRule = /^[A-Za-z0-9-]+$/
+				let flagRule = this.pickup_code.every((item) => {return codeRule.test(item.code)});
+				if(!flagRule){
+					return tools.error('请输入正确的取件码')	
+				}
+
+				let arr = [];
+				this.pickup_code.forEach((v) => {
+					arr.push(v.code)
+				})
+				let pickup_code = arr.join(',')
+				uni.setStorageSync('isConfirmAddressFlag', false);
+				uni.navigateTo({
+					url: 'pages-takeout/confirm-order?pickup_code=' + pickup_code + '&type=2'
+				})
 			},
 			// 增加
 			addNumber(type, item) {

+ 5 - 4
pages/index/index.vue

@@ -318,6 +318,11 @@
 			this.page = 1;
 			this.goodsList = [];
 			this.getGoodsList();
+			
+			let userToken = uni.getStorageSync('token')
+			if(userToken){
+				this.couponHome()
+			}
 		},
 		onPageScroll(e) {
 			if (e.scrollTop > 1) {
@@ -335,7 +340,6 @@
 			}
 		},
 		onReachBottom() {
-			console.log('触底刷新');
 			if (this.goodsList.length < this.total) {
 				this.page += 1;
 				this.getGoodsList();
@@ -352,9 +356,6 @@
 				}
 			})
 		},
-		mounted() {
-			this.couponHome()
-		},
 		methods: {
 			change(e) {
 				this.current = e.detail.current

+ 3 - 1
service/ajax.js

@@ -40,7 +40,8 @@ export const request = (url, method, data, show = false) => {
 			},500)
            
           } else if (res.data.code * 1 === 403) {
-           tools.error('请求过快!!')
+			resolve(res.data)
+			tools.error('请求过快!!')
           }else {
             resolve(res.data)
           }
@@ -50,6 +51,7 @@ export const request = (url, method, data, show = false) => {
             url: '/pages/login/index'
           });
         } else{
+		  resolve(res.data)
           tools.error('网络错误!!')
         }
       },