zpj 2 лет назад
Родитель
Сommit
0c3adf3fa3

+ 12 - 0
api/coupon.js

@@ -0,0 +1,12 @@
+import {request} from '../service/ajax.js'
+
+const newsUrl = '/api/coupon/'
+// 领取优惠卷
+export const receiveCoupon = (data) => request(newsUrl + 'receive', 'post', { ...data },false)
+
+// 领卷中心优惠卷列表
+export const couponGrant = (data) => request(newsUrl + 'grant', 'post', { ...data },false)
+// 我的优惠卷
+export const couponMember = (data) => request(newsUrl + 'member', 'post', { ...data },false)
+// 优惠卷使用规则
+export const couponRule = (data) => request(newsUrl + 'rule', 'post', { ...data },false)

+ 11 - 0
api/groupOrder.js

@@ -0,0 +1,11 @@
+import {request} from '../service/ajax.js'
+
+const newsUrl = '/api/group/'
+// 获取团购商品
+export const groupList = (data) => request(newsUrl + 'list', 'post', { ...data },false)
+// 团购详情
+export const groupInfo = (data) => request(newsUrl + 'info', 'post', { ...data },false)
+// 下单
+export const groupCreate = (data) => request(newsUrl + 'create', 'post', { ...data },false)
+// 支付订单
+export const groupPay = (data) => request(newsUrl + 'pay', 'post', { ...data },false)

+ 4 - 3
pages-address/edit-add.vue

@@ -131,9 +131,10 @@
 						tools.success('操作成功');
 						this.isAJAX = false;
 						setTimeout(()=>{
-							uni.reLaunch({
-								url: '/pages-address/address'
-							})
+							uni.navigateBack({
+								delta: 1
+							});
+							uni.setStorageSync('isConfirmAddressFlag',true);
 						},1500)
 					}else{
 						tools.success('操作失败');

+ 22 - 2
pages-buy/group.vue

@@ -41,16 +41,36 @@
 </template>
 
 <script>
+	import {groupList} from '@/api/groupOrder.js';
+	import tools from "@/service/tools";
+	import EnBlank from "@/components/en-utils/en-blank/en-blank";
 	export default {
+		components:{EnBlank},
 		data(){
 			return{
-				
+				page:1,
+				total:0,
+				list:[],
 			}
 		},
-		onShow() {
+		onReachBottom() {
+			console.log('触底刷新');
 			
 		},
+		onShow() {
+			this.getList();
+		},
 		methods:{
+			getList(){
+				let school_id = uni.getStorageSync('school_id');
+				groupList({school_id:school_id,page:this.page}).then((res)=>{
+					if(res.code === 1){
+						this.list = [...this.list,...res.data.items];
+						this.total = res.data.total;
+					}
+				})
+			},
+			
 			setWidth(total,num){
 				let w  = 0
 				let tH = 434;

+ 74 - 62
pages-my/my-ticket.vue

@@ -2,115 +2,127 @@
 	<view class="my-ticket flex-common-css iPhone-bottom">
 		<Nav title="我的优惠券" titleColor="#333" bgckgroundBox='#fff'></Nav>
 		<view class="tab-box flex-justify-around bgc-f ">
-			<view class="tab-but flex-1 flex-direction align-items-center" @click="tabStitle(index)"
-				v-for="(item, index) in tabList" :key="index">
-				<view class="fs-32 mb-18" :class="tabNum==index?'fc-41ABF5':'fc-3'">
-					{{item}}
+			<view class="tab-but flex-1 flex-direction align-items-center" 
+				v-for="(item, index) in tabList" :key="index" @click="tabStitle(item.status)">
+				<view class="fs-32 mb-18" :class="status==item.status?'fc-41ABF5':'fc-3'">
+					{{item.name}}
 				</view>
-				<view v-show="tabNum==index" class="tab-hr bgc-41ABF5"></view>
+				<view v-show="status==item.status" class="tab-hr bgc-41ABF5"></view>
 			</view>
 		</view>
-		<scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
+		
+		<view v-if="itemData.length === 0" class="scroll-view-css">
+			<EnBlank :customSrc='true'>
+				<template v-slot:blankImg>
+					<image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
+				</template>
+			</EnBlank>
+		</view>
+		
+		<scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
 			<view class="list-box">
 				<view class="item-box display-flex mb-20" v-for="(item,index) in itemData" :key="index">
 					<view class="item-left flex-direction align-items-center flex-justify-center"
-						:class="item.type == 0?'bgc-FCE7E2':'bgc-E6E6E6'">
+						:class="status == 1?'bgc-FCE7E2':'bgc-E6E6E6'">
 						<view class="align-items-center">
-							<view class="fs-30 fw-600" :class="item.type == 0?'fc-FB3D03':'fc-9'">¥</view>
-							<view class="fs-48 fw-600" :class="item.type == 0?'fc-FB3D03':'fc-9'">10</view>
-						</view>
-						<view class="fs-24" :class="item.type == 0?'fc-6':'fc-9'">
-							满90元可用
+							<view class="fs-30 fw-600" :class="status == 1?'fc-FB3D03':'fc-9'">¥</view>
+							<view class="fs-48 fw-600" :class="status == 1?'fc-FB3D03':'fc-9'">{{item.money}}</view>
 						</view>
+						<view class="fs-24" :class="status == 1?'fc-6':'fc-9'">{{item.desc}}</view>
 						<view class="ball"></view>
 						<view class="ball-two"></view>
 					</view>
-					<view class="item-hr" :class="item.type == 0?'':'item-hr-two'"></view>
+					<view class="item-hr" :class="status == 1?'':'item-hr-two'"></view>
 					<view class="item-right flex-1 bgc-f">
 						<view class="fs-28 mb-12 ticket-name text-overflow-ellipsis"
-							:class="item.type == 0?'fc-3':'fc-9'">
+							:class="status == 1?'fc-3':'fc-9'">
 							{{item.name}}
 						</view>
-						<view class="fs-24 mb-12" :class="item.type == 0?'fc-FB3D03':'fc-9'">
-							2024.05.08-2024.05.24
+						<view class="fs-24 mb-12" :class="status == 1?'fc-FB3D03':'fc-9'">
+							{{item.time_str}}
 						</view>
 						<view class="flex-justify-space">
-							<view class="fs-24" :class="item.type == 0?'fc-3':'fc-9'">
-								券类型:外卖券
+							<view class="fs-24" :class="status == 1?'fc-3':'fc-9'">
+								券类型:{{item.scene == 1?'外卖券':'代取券'}}
 							</view>
-							<view class="align-items-center" @click="goToUrl(1)">
-								<view class="fs-24 fc-9">
-									规则
-								</view>
+							<view class="align-items-center" @click="goToUrl(1,item)">
+								<view class="fs-24 fc-9">规则</view>
 								<image class="toRight" src="@/static/img/toRight.png" mode=""></image>
 							</view>
 						</view>
-						<view class="item-but fc-FB3D03" v-if="item.type == 0" @click="goToUrl(0)">
-							去使用
-						</view>
-						<image class="item-img" src="@/static/img/my/ysy.png" mode="" v-else-if="item.type == 1">
-						</image>
+						<view class="item-but fc-FB3D03" v-if="status == 1" @click="goToUrl(0,item)">去使用</view>
+						<image class="item-img" src="@/static/img/my/ysy.png" mode="" v-else-if="status == 2"></image>
 						<image class="item-img" src="@/static/img/my/ysx.png" mode="" v-else></image>
 					</view>
 				</view>
 			</view>
 		</scroll-view>
 		<view class="bot-but flex-justify-center align-items-center bgc-f" @click="goToUrl(2)">
-			<view class="fc-41ABF5 fs-32 fw-600 mr-8">
-				去领券中心
-			</view>
+			<view class="fc-41ABF5 fs-32 fw-600 mr-8">去领券中心</view>
 			<image class="toRight" src="@/static/img/my/to-right.png" mode=""></image>
 		</view>
 	</view>
 </template>
 
 <script>
+	import {couponMember} from '@/api/coupon.js';
+	import tools from "@/service/tools";
+	import EnBlank from "@/components/en-utils/en-blank/en-blank";
+	
 	export default {
-		components: {},
+		components: {EnBlank},
 		data() {
 			return {
-				tabList: ['待使用', '已使用', '已失效'],
-				tabNum: 0,
-				itemData: [{
-						type: 0,
-						name: '优惠券名称优惠券名称惠券名'
-					},
-					{
-						type: 0,
-						name: '优惠券名称'
-					}, {
-						type: 1,
-						name: '优惠券名称'
-					}, {
-						type: 2,
-						name: '优惠券名称优惠券名称惠券名'
-					},
-					{
-						type: 2,
-						name: '优惠券名称优惠券名称惠券名'
-					},
-					{
-						type: 2,
-						name: '优惠券名称优惠券名称惠券名'
-					}
-				]
+				tabList: [{name:'待使用',status:1}, {name:'已使用',status:2},{name:'已过期',status:3},],
+				status: 1,
+				page:1,
+				itemData: [],
+				total:0,
 			};
 		},
-		mounted() {},
+		onShow() {
+			this.page = 1;
+			this.itemData = [];
+			this.getList();
+		},
 		methods: {
-			tabStitle(index) {
-				this.tabNum = index
+			getList(){
+				couponMember({page:this.page,status:this.status}).then((res)=>{
+					if(res.code === 1){
+						this.itemData = [...this.itemData,...res.data.items];
+						this.total = res.data.total;
+					}
+				})
+			},
+			tabStitle(status) {
+				if(this.status != status){
+					this.status = status
+					this.page = 1;
+					this.itemData = [];
+					this.getList();
+				}
+				
 			},
 			scrolltolower() {
-				//触底
+				if(this.itemData.length < this.total){
+					this.page += 1;
+					this.getList();
+				}
 			},
-			goToUrl(type) {
+			goToUrl(type,item) {
 				if(type == 0) {
 					// 去使用
+					if(item.scene == 1){
+						// 去外卖
+					}else{
+						uni.navigateTo({
+							url:'/pages-takeout/replace-take'
+						})
+					}
 				}else if(type == 1) {
 					// 规则
 					uni.navigateTo({
-						url:'/pages-my/rule-info'
+						url:'/pages-my/rule-info?id=' + item.id
 					})
 				}else {
 					// 领券中心

+ 45 - 30
pages-my/rule-info.vue

@@ -5,67 +5,82 @@
 			<view class="contetn-box">
 				<view class="item-box display-flex mb-20">
 					<view class="item-left flex-direction align-items-center flex-justify-center"
-						:class="ticketData.type == 0?'bgc-FCE7E2':'bgc-E6E6E6'">
+						:class="ticketData.status == 1?'bgc-FCE7E2':'bgc-E6E6E6'">
 						<view class="align-items-center">
-							<view class="fs-30 fw-600" :class="ticketData.type == 0?'fc-FB3D03':'fc-9'">¥</view>
-							<view class="fs-48 fw-600" :class="ticketData.type == 0?'fc-FB3D03':'fc-9'">10</view>
+							<view class="fs-30 fw-600" :class="ticketData.status == 1?'fc-FB3D03':'fc-9'">¥</view>
+							<view class="fs-48 fw-600" :class="ticketData.status == 1?'fc-FB3D03':'fc-9'">{{ticketData.money||''}}</view>
 						</view>
-						<view class="fs-24" :class="ticketData.type == 0?'fc-6':'fc-9'">
-							满90元可用
+						<view class="fs-24" :class="ticketData.status == 1?'fc-6':'fc-9'">
+							{{ticketData.desc||''}}
 						</view>
 						<view class="ball"></view>
 						<view class="ball-two"></view>
 					</view>
-					<view class="item-hr" :class="ticketData.type == 0?'':'item-hr-two'"></view>
+					<view class="item-hr" :class="ticketData.status == 1?'':'item-hr-two'"></view>
 					<view class="item-right flex-1 bgc-f">
 						<view class="fs-28 mb-12 ticket-name text-overflow-ellipsis fw-600"
-							:class="ticketData.type == 0?'fc-3':'fc-9'">
-							{{ticketData.name}}
+							:class="ticketData.status == 1?'fc-3':'fc-9'">
+							{{ticketData.name||''}}
 						</view>
-						<view class="fs-24 mb-12" :class="ticketData.type == 0?'fc-FB3D03':'fc-9'">
-							2024.05.08-2024.05.24
+						<view class="fs-24 mb-12" :class="ticketData.status == 1?'fc-FB3D03':'fc-9'">
+							{{ticketData.start_time||''}}
 						</view>
 						<view class="flex-justify-space">
-							<view class="fs-24" :class="ticketData.type == 0?'fc-3':'fc-9'">
-								券类型:外卖券
+							<view class="fs-24" :class="ticketData.status == 1?'fc-3':'fc-9'">
+								券类型:{{ticketData.scene_str||''}}
 							</view>
 						</view>
-						<image class="item-img" src="@/static/img/my/ysy.png" mode="" v-if="ticketData.type == 1">
+						<image class="item-img" src="@/static/img/my/ysy.png" mode="" v-if="ticketData.status == 2">
 						</image>
-						<image class="item-img" src="@/static/img/my/ysx.png" mode="" v-if="ticketData.type == 2"></image>
+						<image class="item-img" src="@/static/img/my/ysx.png" mode="" v-if="ticketData.status == 3"></image>
 					</view>
 				</view>
-				<view class="but-box" v-if="ticketData.type == 0">
-					<view class="but fs-32 fc-f fw-500" @click="goToUrl()">
-						去使用
-					</view>
-				</view>
-				<view class="fs-34 fw-600 fc-0 mb-12">
-					使用范围
+				<view class="but-box" v-if="ticketData.status == 1">
+					<view class="but fs-32 fc-f fw-500" @click="goToUrl()">去使用</view>
 				</view>
-				<view class="describe fs-28 fc-6" v-html=""></view>
+				<view class="fs-34 fw-600 fc-0 mb-12">使用范围</view>
+				<view class="describe fs-28 fc-6">{{ticketData.str||''}}</view>
 			</view>
 		</scroll-view>
 	</view>
 </template>
 
 <script>
+	import {couponRule} from '@/api/coupon.js';
+	import tools from "@/service/tools";
+	
 	export default {
 		components: {},
 		data() {
 			return {
-				ticketData: {
-					type: 0,
-					name: '优惠券名称优惠券名称惠券名'
-				}
+				ticketData: {},
+				id:"",
 			};
 		},
-		onLoad(data) {},
-		mounted() {},
+		onLoad(e) {
+			if(e.id){
+				this.id = e.id;
+				this.getRole();
+			}
+		},
 		methods: {
-			scrolltolower() {
-				console.log('触底');
+			getRole(){
+				couponRule({id:this.id}).then((res)=>{
+					if(res.code === 1){
+						this.ticketData = res.data
+					}
+				})
+			},
+			goToUrl(){
+				if(this.ticketData.scene == 1){
+					// 去外卖
+				}else{
+					uni.navigateTo({
+						url:'/pages-takeout/replace-take'
+					})
+				}
 			},
+			scrolltolower() {},
 		},
 	}
 </script>

+ 48 - 24
pages-my/ticket-centre.vue

@@ -4,7 +4,16 @@
 		<image class="lqzx-bg" src="@/static/img/my/lqzx-bg.png" mode=""></image>
 		<image @click="goToUrl" class="wdyhq" src="@/static/img/my/wdyhq.png" mode=""></image>
 		<view class="lqzx-blank"></view>
-		<scroll-view :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
+		
+		<view v-if="itemData.length === 0" class="scroll-view-css">
+			<EnBlank :customSrc='true'>
+				<template v-slot:blankImg>
+					<image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
+				</template>
+			</EnBlank>
+		</view>
+		
+		<scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
 			<view class="liat-box ">
 				<view class="item-box display-flex mb-20" v-for="(item,index) in itemData" :key="index">
 					<view class="item-right flex-direction flex-justify-center flex-1 bgc-f">
@@ -12,21 +21,19 @@
 							{{item.name}}
 						</view>
 						<view class="fs-24 fc-6">
-							有效时间:2024.05.08-2024.05.24
+							有效时间:{{item.start_time}} - {{item.end_time}}
 						</view>
 					</view>
 					<view class="item-hr"></view>
 					<view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
 						<view class="align-items-center">
 							<view class="fs-30 fw-600 fc-FB3D03">¥</view>
-							<view class="fs-48 fw-600 fc-FB3D03">10</view>
+							<view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
 						</view>
 						<view class="fs-24 mb-18 fc-6">
-							满90元可用
-						</view>
-						<view class="but-box fs-28 fc-f" @click="receive">
-							立即领取
+							{{item.desc}}
 						</view>
+						<view class="but-box fs-28 fc-f" @click="receive(item)">立即领取</view>
 						<view class="ball"></view>
 						<view class="ball-two"></view>
 					</view>
@@ -37,34 +44,51 @@
 </template>
 
 <script>
+	import {couponGrant,receiveCoupon} from '@/api/coupon.js';
+	import tools from "@/service/tools";
+	import EnBlank from "@/components/en-utils/en-blank/en-blank";
 	export default {
-		components: {},
+		components: {EnBlank},
 		data() {
 			return {
-				itemData: [{
-						type: 0,
-						name: '优惠券名称优惠券名称惠券名名称惠券名'
-					},
-					{
-						type: 0,
-						name: '优惠券名称'
-					}
-				]
+				itemData: [],
+				isAJAX:false,
 			};
 		},
-		onLoad(data) {},
-		mounted() {},
+		onShow(){
+			this.getList();
+		},
 		methods: {
+			getList(){
+				let operate_id = uni.getStorageSync('operate_id');
+				couponGrant({operate_id:operate_id}).then((res)=>{
+					if(res.code === 1){
+						this.itemData = res.data;
+					}
+				})
+			},
+			
 			goToUrl() {
 				uni.navigateTo({
 					url:'/pages-my/my-ticket'
 				})
 			},
-			scrolltolower() {
-				console.log('触底');
-			},
-			receive() {
-				// 立即领取
+			scrolltolower() {},
+			receive(item) {
+				if(this.isAJAX){
+					return
+				}
+				this.isAJAX = true;
+				receiveCoupon({grant_id:item.grant_id,coupon_id:item.coupon_id}).then((res)=>{
+					if(res.code === 1){
+						this.isAJAX = false;
+						tools.success('领取成功');
+						this.getList();
+					}else{
+						this.isAJAX = false;
+						tools.success('领取失败');
+					}
+				})
 			}
 		},
 	}

+ 102 - 29
pages-takeout/confirm-mod/coupon.vue

@@ -8,21 +8,28 @@
 				</view>
 				
 				<view class="flex-justify-around">
-					<view @click="setType(1)" class="fs-28 fw-600 mb-24" :class="type == 1?'fc-41ABF5':''">可用优惠券(1)</view>
-					<view @click="setType(2)" class="fs-28 fw-600 mb-24" :class="type == 2?'fc-41ABF5':''">可领优惠券(2)</view>
+					<view @click="setType(1)" class="fs-28 fw-600 mb-24" :class="type == 1?'fc-41ABF5':''">可用优惠券({{expressCouponData.coupon.length}})</view>
+					<view @click="setType(2)" class="fs-28 fw-600 mb-24" :class="type == 2?'fc-41ABF5':''">可领优惠券({{expressCouponData.receive.length}})</view>
 				</view>
 				
 				
 				<view class="scroll-view-css" v-if="type == 1">
-					<scroll-view :scroll-y="true" class="scroll-view-css">
-						<view class="item-box display-flex mb-20" v-for="(item,i) in 10" :key="i">
+					<view v-if="expressCouponData.coupon.length === 0" class="scroll-view-css">
+						<EnBlank :customSrc='true'>
+							<template v-slot:blankImg>
+								<image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
+							</template>
+						</EnBlank>
+					</view>
+					<scroll-view v-else :scroll-y="true" class="scroll-view-css">
+						<view class="item-box display-flex mb-20" v-for="(item,i) in expressCouponData.coupon" :key="i" @click="setFun(item)">
 							<view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
 								<view class="align-items-center">
 									<view class="fs-30 fw-600 fc-FB3D03">¥</view>
-									<view class="fs-48 fw-600 fc-FB3D03">10</view>
+									<view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
 								</view>
 								<view class="fs-24" :class="item.type == 0?'fc-6':'fc-9'">
-									满90元可用
+									{{item.desc}}
 								</view>
 								<view class="ball"></view>
 								<view class="ball-two"></view>
@@ -30,37 +37,39 @@
 							<view class="item-hr"></view>
 							<view class="item-right flex-1 bgc-f">
 								<view class="fs-28 fw-600 mb-12 ticket-name text-overflow-ellipsis w382">
-									优惠券名称优惠券名称惠券名优惠券名称优惠券名称惠券名优惠券名称优惠券名称惠券名
+									{{item.name}}
 								</view>
 								<view class="fs-24 mb-12 fc-FB3D03">
-									2024.05.08-2024.05.24
-								</view>
-								<view class="flex-justify-space">
-									<view class="fs-24 fc-6">
-										券类型:外卖券
-									</view>
+									{{item.start_time}} - {{item.end_time}}
 								</view>
 							</view>
 							
-							<image v-if="id==i" class="s-icon" src="@/static/img/common/y-select.png" mode=""></image>
+							<image v-if="coupon_id==item.id" class="s-icon" src="@/static/img/common/y-select.png" mode=""></image>
 							<image v-else class="s-icon"src="@/static/img/common/n-select.png" mode=""></image>
 						</view>
 					</scroll-view>
 				</view>
 				
 				<view class="scroll-view-css" v-else>
-					<view class="scroll-view-css">
-						<view class=" display-flex mb-20" v-for="(item,index) in 10" :key="index">
+					<view v-if="expressCouponData.receive.length === 0" class="scroll-view-css">
+						<EnBlank :customSrc='true'>
+							<template v-slot:blankImg>
+								<image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
+							</template>
+						</EnBlank>
+					</view>
+					<view v-else class="scroll-view-css">
+						<view class=" display-flex mb-20" v-for="(item,i) in expressCouponData.receive" :key="i">
 							<view class="item-right flex-direction flex-justify-center flex-1 bgc-f">
 								<view class="fs-28 mb-12 ticket-name text-overflow-ellipsis fc-3 fw-600">
-									优惠券名称优惠券名称优惠券名称优惠券名称优
+									{{item.name}}
 								</view>
 								<view class="fs-24 fc-6 mb-12">
-									有效时间:2024.05.08-2024.05.24
+									有效时间:{{item.start_time}} - {{item.end_time}}
 								</view>
 								<view class="flex-justify-space">
 									<view class="fs-24 fc-6">
-										券类型:外卖券
+										券类型:{{item.scene == 1?'外卖券':'代取券'}}
 									</view>
 								</view>
 							</view>
@@ -68,38 +77,72 @@
 							<view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
 								<view class="align-items-center">
 									<view class="fs-30 fw-600 fc-FB3D03">¥</view>
-									<view class="fs-48 fw-600 fc-FB3D03">10</view>
+									<view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
 								</view>
 								<view class="fs-24 mb-18 fc-6">
-									满90元可用
-								</view>
-								<view class="but-box fs-28 fc-f">
-									立即领取
+									{{item.desc}}
 								</view>
+								<view class="but-box fs-28 fc-f" @click="getFun(item)">立即领取</view>
 								<view class="ball"></view>
 								<view class="ball-two"></view>
 							</view>
 						</view>
 					</view>
 				</view>
-				
 			</view>
 		</uni-popup>
 	</view>
 </template>
 
 <script>
+	import EnBlank from "@/components/en-utils/en-blank/en-blank";
+	import {getExpressCoupon} from '@/api/express.js';
+	import {receiveCoupon} from '@/api/coupon.js';
+	import tools from "@/service/tools";
+	
 	export default {
+		components:{EnBlank},
 		data(){
 			return{
-				type:1,//1可用 2可领
-				id:1,
+				type:1,//1可用类型 2可领类型
+				coupon_id:1,
+				dataType:'',//1外卖 2代取 3干洗
+				isAJAX:false,
+				
+				// 代取优惠券
+				expressCouponData:{
+					coupon:[],//可用
+					receive:[],//可领
+				},
 			}
 		},
 		methods:{
-			getList(){
-				this.openPop();
+			getList(e,id){
+				if(id){
+					this.coupon_id = id;
+				}else{
+					this.coupon_id = '';
+				}
+				this.dataType = Number(e)
+				if(e == 1){
+					
+				}else if(e == 2){
+					this.getExpressCoupon()
+				}
 			},
+			
+			// 代取 获取优惠券
+			getExpressCoupon(){
+				let operate_id = uni.getStorageSync('operate_id');
+				getExpressCoupon({operate_id:operate_id}).then((res)=>{
+					if(res.code === 1){
+						this.expressCouponData = res.data;
+						this.openPop();
+					}
+				})
+			},
+			
+			
 			setType(type){
 				if(type != this.type){
 					this.type = type
@@ -111,6 +154,36 @@
 			closeCoupon(){
 				this.$refs.popupCoupon.close();
 			},
+			
+			setFun(item){
+				this.$emit('giveCouPon',item);
+				this.closeCoupon();
+			},
+			
+			getFun(item){
+				if(this.isAJAX){
+					return
+				}
+				this.isAJAX = true;
+				receiveCoupon({grant_id:item.grant_id,coupon_id:item.coupon_id}).then((res)=>{
+					if(res.code === 1){
+						this.isAJAX = false;
+						tools.success('领取成功');
+						this.resetList();
+					}else{
+						this.isAJAX = false;
+						tools.success('领取失败');
+					}
+				})
+			},
+			
+			resetList(){
+				if(this.dataType == 1){
+					
+				}else if(this.dataType == 2){
+					this.getExpressCoupon()
+				}
+			},
 		},
 	}
 </script>

+ 8 - 0
pages-takeout/confirm-mod/select-address.vue

@@ -59,6 +59,14 @@
 				list:[],
 			}
 		},
+		onShow() {
+			this.list = [];
+			getAddressList().then((res)=>{
+				if(res.code === 1){
+					this.list = res.data;
+				}
+			})
+		},
 		methods:{
 			getList(){
 				getAddressList().then((res)=>{

+ 22 - 31
pages-takeout/confirm-order.vue

@@ -68,25 +68,25 @@
 					<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="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">
-						<view class="fs-32 fc-FB3D03 fw-600">-¥3</view>
+						<view :class="fromData.coupon_id?'fc-FB3D03 fw-600 fs-32':'fw-400 fs-28'">{{fromData.coupon_id?'-¥'+ quanMoney:'请选择优惠券'}}</view>
 						<image class="right-icon" src="@/static/img/toRight.png" mode=""></image>
 					</view>
-				</view> -->
+				</view>
 				<view class="text-align-right p-b-20">
 					<span class="fc-9 fs-28">共{{cardData.total_num||0}}件,</span>
 					<span class="fw-400 fc-0 fs-28">合计¥</span>
-					<span class="fw-600 fc-0 fs-44">{{cardData.total_price||0}}</span>
+					<span class="fw-600 fc-0 fs-44">{{(cardData.total_price - quanMoney) < 0?'0':(cardData.total_price - quanMoney)||0}}</span>
 				</view>
 			</view>
 			
 			
 			<view class="box-card box-border-box bgc-f mb-20">
-				<view class="flex-justify-space b-b-F9F9F9 p-b-20 mb-24">
-					<view class="fs-28 fw-600 w158">备注</view>
-					<input class="text-align-right fs-28" type="text" placeholder="请填写你的需求">
+				<view class="flex-justify-space b-b-F9F9F9  mb-24">
+					<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">
@@ -117,7 +117,7 @@
 			<view class="flex-justify-space">
 				<view class="align-items-flex-end box-1">
 					<span class="fs-28 fc-f fw-600">¥</span>
-					<span class="fs-44 fc-f fw-600">{{cardData.total_price||0}}</span>
+					<span class="fs-44 fc-f fw-600">{{(cardData.total_price - quanMoney) < 0?'0':(cardData.total_price - quanMoney)||0}}</span>
 				</view>
 				<view class="text-align-center box-2 fs-32 fc-f fw-600" @click="toSave()">立即支付</view>
 			</view>
@@ -160,30 +160,28 @@
 				},
 				addressData:{},
 				
-				quanInfo:{
-					
-				},
-				quanData:{
-					coupon:[],//可用
-					receive:[],//可领
-				},
-				
 				cardData:{
 					goods_list:[],
 				},
 				
+				quanMoney:"",
+				
 				isAJAX:false,
 			}
 		},
 		onLoad(e) {
 			this.type = Number(e.type)
-			if(e.pickup_code){
+			if(this.type == 2){
 				this.fromData.pickup_code = e.pickup_code.split(',').map(String)
-				console.log(this.fromData.pickup_code);
 				this.getCard();
 			}
 			this.getAddressDefault();
-			this.getExpressCoupon();
+		},
+		onShow() {
+			let isConfirmAddressFlag = uni.getStorageSync('isConfirmAddressFlag');
+			if(isConfirmAddressFlag){
+				this.selectFun(2);
+			}
 		},
 		methods:{
 			// 获取购物车
@@ -194,15 +192,7 @@
 					}
 				})
 			},
-			// 获取优惠券
-			getExpressCoupon(){
-				let operate_id = uni.getStorageSync('operate_id');
-				getExpressCoupon({operate_id:operate_id}).then((res)=>{
-					if(res.code === 1){
-						this.quanData = res.data;
-					}
-				})
-			},
+			
 			// 获取默认地址
 			getAddressDefault(){
 				getAddressDefault().then((res)=>{
@@ -218,7 +208,7 @@
 			selectFun(type){
 				if(type === 1){
 					// 选择优惠券
-					this.$refs.coupon.getList();
+					this.$refs.coupon.getList(this.type,this.fromData.coupon_id);
 				}else if(type === 2){
 					// 选择地址
 					if(this.addressData.id){
@@ -234,7 +224,8 @@
 				}
 			},
 			giveCouPon(e){
-				console.log(e);
+				this.quanMoney = Number(e.money);
+				this.fromData.coupon_id = e.id;
 			},
 			giveAddress(e){
 				this.addressData = e;
@@ -271,7 +262,7 @@
 									this.isAJAX = false;
 									setTimeout(()=>{
 										uni.switchTab({
-											url:"/pages/index/index"
+											url:"/pages/order/index"
 										})
 									},1500)
 								  },

+ 43 - 43
pages-takeout/replace-take.vue

@@ -117,17 +117,17 @@
 					</view>
 				</view>
 				
-				<view class="shop-buttom-money box-border-box" @click="createOrder()">
+				<view class="shop-buttom-money box-border-box" >
 					<view class="shop-buttom-money-1 flex-justify-space align-items-center">
-						<image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
-						<view class="shop-buttom-num fs-24 fc-f text-align-center">{{cardData.total_num}}</view>
-						<view class="">
+						<image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill" @click="closeCardBox()"></image>
+						<view class="shop-buttom-num fs-24 fc-f text-align-center" @click="closeCardBox()">{{cardData.total_num}}</view>
+						<view class="" @click="closeCardBox()">
 							<view class="">
 								<span class="fw-600 fs-24 fc-f">¥</span>
 								<span class="fw-600 fs-44 fc-f">{{cardData.total_price||0}}</span>
 							</view>
 						</view>
-						<view class="shop-buttom-money-2 text-align-center fs-32 fc-f fw-600">去结算</view>
+						<view class="shop-buttom-money-2 text-align-center fs-32 fc-f fw-600" @click="createOrder()">去结算</view>
 					</view>
 				</view>
 			</view>
@@ -165,6 +165,8 @@
 					total_num:0,
 					total_price:0,
 				},
+				
+				isInitial:true,
 			}
 		},
 		onShow() {
@@ -184,6 +186,7 @@
 			this.addressData.site_address = uni.getStorageSync('site_address');
 			this.addressData.site_logo = uni.getStorageSync('site_logo');
 			
+			this.isInitial = true;
 			this.getList();
 		},
 		methods:{
@@ -203,41 +206,23 @@
 					if(res.code === 1){
 						this.cardData = res.data;
 						if(this.cardData.total_num > 0){
-							this.cardData.goods_list.forEach(v=>{
-								this.list.forEach(t=>{
-									if(v.goods_id === t.id){
-										t.number = v.number
+							for (let i = 0; i < this.list.length; i++) {
+								for (let n = 0; n < this.cardData.goods_list.length; n++) {
+									if(this.list[i].id == this.cardData.goods_list[n].goods_id){
+										this.list[i].number = this.cardData.goods_list[n]. number;
+										break
 									}else{
-										t.number = 0
+										this.list[i].number = 0
 									}
-								})
-							})
-							for (let i = 0; i < this.cardData.total_num; i++) {
-								let obj = {code:''};
-								this.pickup_code.push(obj);
+								}
+							}
+							// 初始设置code 输入框数量
+							if(this.isInitial){
+								for (let i = 0; i < this.cardData.total_num; i++) {
+									let obj = {code:''};
+									this.pickup_code.push(obj);
+								}
 							}
-						}else{
-							this.list.forEach(t=>{
-								t.number = 0;
-							})
-						}
-					}
-				})
-			},
-			resetCard(){
-				getShopIngList({type:2}).then((res)=>{
-					if(res.code === 1){
-						this.cardData = res.data;
-						if(this.cardData.total_num > 0){
-							this.cardData.goods_list.forEach(v=>{
-								this.list.forEach(t=>{
-									if(v.goods_id === t.id){
-										t.number = v.number
-									}else{
-										t.number = 0
-									}
-								})
-							})
 						}else{
 							this.list.forEach(t=>{
 								t.number = 0;
@@ -254,14 +239,22 @@
 					url:'pages-takeout/replace-mod/select-site?site_id=' + this.addressData.site_id
 				})
 			},
+			closeCardBox(){
+				this.$refs.popupBuy.close();
+			},
 			openBuyCrad(){
 				if(!this.addressData.site_id){
-					tools.error('请选择站点')
-				}else{
-					this.$refs.popupBuy.open()
+					return tools.error('请选择站点')
+				}
+				if(this.pickup_code.length == 0){
+					return tools.error('请选择商品')
 				}
+				this.$refs.popupBuy.open()
 			},
 			createOrder(){
+				if(this.pickup_code.length == 0){
+					return tools.error('请选择商品')
+				}
 				let flag = this.pickup_code.every((item)=>{return item.code});
 				if(flag){
 					let arr = [];
@@ -269,6 +262,7 @@
 						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'
 					})
@@ -276,7 +270,7 @@
 					tools.error('请输入取件码')
 				}
 			},
-			
+			// 增加
 			addNumber(type,item){
 				if(this.isAJAX){
 					return
@@ -290,13 +284,15 @@
 						let obj = {code:''};
 						this.pickup_code.push(obj);
 						this.$forceUpdate();
-						this.resetCard();
+						this.isInitial = false;
+						this.getCard();
 					}else{
 						this.isAJAX = false;
 						tools.error('添加操作失败')
 					}
 				})
 			},
+			// 减少
 			redNumber(type,item){
 				if(item.number > 0){
 					if(this.isAJAX){
@@ -310,7 +306,8 @@
 							item.number -= 1;
 							this.pickup_code.pop();
 							this.$forceUpdate();
-							this.resetCard();
+							this.isInitial = false;
+							this.getCard();
 						}else{
 							this.isAJAX = false;
 							tools.error('减少操作失败')
@@ -324,6 +321,7 @@
 				setShopIngDel({type:2}).then((res)=>{
 					if(res.code === 1){
 						this.pickup_code = [];
+						this.isInitial = false;
 						this.getCard();
 					}else{
 						tools.error('清空失败')
@@ -341,6 +339,7 @@
 			height: 88rpx;
 		}
 		.right-only-right-red{
+			box-sizing: border-box;
 			width: 44rpx;
 			height: 44rpx;
 			line-height: 40rpx;
@@ -349,6 +348,7 @@
 			color: #41ABF5;
 		}
 		.right-only-right-add{
+			box-sizing: border-box;
 			width: 44rpx;
 			height: 44rpx;
 			line-height: 40rpx;

+ 6 - 3
service/ajax.js

@@ -33,9 +33,12 @@ export const request = (url, method, data, show = false) => {
           tools.hideLoading();
           if (res.data.code * 1 === 401) {
             uni.clearStorageSync()
-            uni.reLaunch({
-              url: '/pages/login/index'
-            });
+			setTimeout(()=>{
+				uni.reLaunch({
+				  url: '/pages/login/index'
+				});
+			},500)
+           
           } else if (res.data.code * 1 === 403) {
            tools.error('请求过快!!')
           }else {

+ 1 - 1
service/router.js

@@ -14,7 +14,7 @@ const router = createRouter({
     routes: [...ROUTES]
 });
 //全局路由前置守卫
-const whiteList = ['/pages/login/index','/pages/index/index','/pages/order/index','/pages/me/index']
+const whiteList = ['/pages/login/index','/pages/index/index','/pages/order/index','/pages/me/index','/pages-address/select-school']
 
 router.beforeEach((to, from, next) => {
     let userToken = uni.getStorageSync('token')