zs %!s(int64=2) %!d(string=hai) anos
pai
achega
d43c6b4dd1
Modificáronse 3 ficheiros con 565 adicións e 187 borrados
  1. 453 0
      pagesHome/group/group.vue
  2. 108 187
      pagesMy/dough/handle.vue
  3. 4 0
      pagesMy/order/afterInfo.vue

+ 453 - 0
pagesHome/group/group.vue

@@ -0,0 +1,453 @@
+<template>
+	<mobile-frame>
+		<view class="main">
+			<view class="one">
+				<button size="mini" @tap="toDislog">查询条件</button>
+			</view>
+			<view class="two">
+				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+					<view class="list-scroll-view">
+						<view class="list" v-for="(item,index) in list" :key="index" @tap="toInfo(item)">
+							<view class="list_1">
+								<view class="list_1_1">
+									<view class="shopname">
+										<text class="iconfont icon-shangdian"></text>
+										<text>{{item.shop.name}}</text>
+									</view>
+									<view class="status">
+										{{item.zhStatus||'暂无'}}
+									</view>
+								</view>
+								<view class="list_1_2">
+									<view class="goods">
+										<view class="goods_1">
+											<image class="image" v-if="item.spec.file&&item.spec.file.length>0"
+												:src="item.spec.file&&item.spec.file.length>0?item.spec.file[0].url:''"
+												mode=""></image>
+											<image class="image" v-else
+												:src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''"
+												mode=""></image>
+										</view>
+										<view class="goods_2">
+											<view class="goodsname textOver">
+												{{item.goods.name}}
+											</view>
+											<view class="time" v-if="item.leader">
+												团长:{{item.leader.name}}
+											</view>
+											<view class="time">
+												开始时间:{{item.start_time}}
+											</view>
+											<view class="time">
+												结束时间:{{item.end_time}}
+											</view>
+											<view class="time">
+												人数限制:{{item.person_limit}}人
+											</view>
+										</view>
+									</view>
+								</view>
+							</view>
+							<view class="btn">
+								<button type="default" size="mini" @tap.stop="toJion(item)">参加团购</button>
+							</view>
+						</view>
+						<view class="is_bottom" v-if="is_bottom">
+							<text>{{config.bottom_title}}</text>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+			<view class="dialog" v-if="dialog.show==true">
+				<view class="dialog_1" v-if="dialog.type=='1'">
+					<uni-forms ref="form" :modelValue="searchInfo" :rules="rules" label-width="auto">
+						<uni-forms-item label="商品名称" name="goods">
+							<uni-easyinput type="text" v-model="searchInfo.goods" placeholder="请输入商品名称" />
+						</uni-forms-item>
+						<uni-forms-item label="状态" name="status">
+							<picker class="picker" mode="selector" :range="statusList" @change="statusChange"
+								range-key="label">
+								<view>{{status_name||'请选择状态'}}</view>
+							</picker>
+						</uni-forms-item>
+					</uni-forms>
+					<view class="btn">
+						<button type="primary" @click="onSubmit" size="mini">确定</button>
+						<button type="primary" @click="dialogClose" size="mini">取消</button>
+					</view>
+				</view>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				// 系统设置
+				config: {},
+				// 设备信息
+				system: {},
+				user: {},
+				searchInfo: {},
+				list: [],
+				total: 0,
+				skip: 0,
+				limit: 6,
+				page: 0,
+				// 数据是否触底
+				is_bottom: false,
+				scrollTop: 0,
+				// 字典表
+				statusList: [],
+				status_name: "",
+				// 条件弹出框
+				dialog: {
+					show: false,
+					type: '1'
+				}
+			};
+		},
+		onLoad: function(e) {
+			const that = this;
+			that.searchConfig();
+		},
+		onShow: async function(e) {
+			const that = this;
+			await that.searchOther();
+			await that.watchlogin();
+			await that.search();
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			that.clearPage();
+			await that.search();
+			uni.stopPullDownRefresh();
+		},
+		methods: {
+			// 查询基本设置
+			searchConfig() {
+				const that = this;
+				uni.getStorage({
+					key: 'config',
+					success: function(res) {
+						if (res.data) that.$set(that, `config`, res.data)
+						// 设备平台信息
+						let config = that.$config;
+						that.$set(that, `system`, config.system);
+					},
+					fail: function(err) {
+						console.log(err);
+					}
+				})
+			},
+			// 监听用户是否登录
+			watchlogin() {
+				const that = this;
+				uni.getStorage({
+					key: 'token',
+					success: function(res) {
+						let user = that.$jwt(res.data);
+						if (user) that.$set(that, `user`, user)
+					}
+				})
+			},
+			async search() {
+				const that = this;
+				let info = {
+					skip: that.skip,
+					limit: that.limit,
+					status:'0'
+				}
+				let res = await that.$api(`/group/userView`, 'GET', {
+					...info,
+					...that.searchInfo
+				}, 'group');
+				if (res.errcode == '0') {
+					let list = [...that.list, ...res.data];
+					for (let val of list) {
+						if (val.status) val.zhStatus = that.searchStatus(val.status)
+					}
+					that.$set(that, `list`, list);
+					that.$set(that, `total`, res.total)
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+						icon: 'none'
+					})
+				}
+			},
+			// 查询状态
+			searchStatus(e) {
+				const that = this;
+				let data = that.statusList.find((i) => i.value == e);
+				if (data) return data.label
+				else return '暂无'
+			},
+			// 参加团购
+			toJion(e) {
+				const that = this;
+				that.clearPage();
+				uni.navigateTo({
+					url: `/pagesHome/group/share?id=${e.goods._id}&group=${e._id}`
+				})
+			},
+			// 分页
+			toPage(e) {
+				const that = this;
+				let list = that.list;
+				let limit = that.limit;
+				if (that.total > list.length) {
+					uni.showLoading({
+						title: '加载中',
+						mask: true
+					})
+					let page = that.page + 1;
+					that.$set(that, `page`, page)
+					let skip = page * limit;
+					that.$set(that, `skip`, skip)
+					that.search();
+					uni.hideLoading();
+				} else that.$set(that, `is_bottom`, true)
+			},
+			toScroll(e) {
+				const that = this;
+				let up = that.scrollTop;
+				that.$set(that, `scrollTop`, e.detail.scrollTop);
+				let num = Math.sign(up - e.detail.scrollTop);
+				if (num == 1) that.$set(that, `is_bottom`, false);
+			},
+			// 查询条件
+			toDislog() {
+				const that = this;
+				that.$set(that, `searchInfo`, {})
+				that.$set(that, `status_name`, '')
+				that.$set(that, `dialog`, {
+					show: true,
+					type: '1'
+				})
+			},
+			// 状态选择
+			statusChange(e) {
+				const that = this;
+				let data = that.statusList[e.detail.value];
+				if (data) {
+					that.$set(that.searchInfo, `status`, data.value);
+					that.$set(that, `status_name`, data.label);
+				}
+			},
+			// 关闭弹框
+			dialogClose() {
+				const that = this;
+				that.clearPage();
+				that.search();
+				that.$set(that, `dialog`, {
+					show: false,
+					type: '1'
+				})
+			},
+			// 查询
+			onSubmit() {
+				const that = this;
+				that.clearPage();
+				that.search();
+				that.$set(that, `dialog`, {
+					show: false,
+					type: '1'
+				})
+			},
+			// 查询其他信息
+			async searchOther() {
+				const that = this;
+				let res;
+				// 查询状态
+				res = await that.$api(`/dictData`, 'GET', {
+					code: 'group_status'
+				})
+				if (res.errcode == '0') that.$set(that, `statusList`, res.data);
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 6)
+				that.$set(that, `page`, 0)
+			}
+		},
+
+	}
+</script>
+
+<style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			padding: 2vw;
+			text-align: center;
+
+			button {
+				background-color: #23B67A;
+				color: #ffffff;
+			}
+		}
+
+		.two {
+			position: relative;
+			flex-grow: 1;
+			background-color: var(--f9Color);
+
+			.list {
+				background-color: #fff;
+				border: 1px solid var(--f5Color);
+				padding: 2vw;
+				margin: 0 2vw 2vw 2vw;
+				border-radius: 5px;
+
+				.list_1 {
+					.list_1_1 {
+						display: flex;
+						justify-content: space-between;
+						margin: 0 0 2vw 0;
+
+						.shopname {
+							text:last-child {
+								padding: 0 0 0 2vw;
+							}
+						}
+
+						.status {
+							color: var(--ff0Color);
+						}
+					}
+
+					.list_1_2 {
+						border-bottom: 1px solid #f1f1f1;
+
+						.goods {
+							display: flex;
+							padding: 0 0 2vw 0;
+
+							.goods_1 {
+								width: 20vw;
+								height: 20vw;
+
+								.image {
+									width: 100%;
+									height: 100%;
+									border-radius: 5px;
+								}
+							}
+
+							.goods_2 {
+								width: 70vw;
+								padding: 0 0 0 2vw;
+
+								.goodsname {
+									font-size: 16px;
+									margin: 0 0 1vw 0;
+								}
+
+								.specs {
+									font-size: 14px;
+									color: #858585;
+								}
+
+								.time {
+									font-size: 13px;
+									color: #858585;
+								}
+							}
+						}
+					}
+
+					.other {
+						padding: 0 0 2vw 0;
+						margin: 2vw 0;
+						text-align: right;
+						border-bottom: 1px solid #f1f1f1;
+
+						text {
+							font-size: 14px;
+							padding: 0 0 0 2vw;
+						}
+					}
+				}
+
+				.btn {
+					text-align: right;
+					margin: 1vw 0 0 0;
+					button {
+						margin: 0 1vw 0 0;
+					}
+				}
+			}
+		}
+	}
+
+	.dialog {
+		position: fixed;
+		width: 96vw;
+		height: 100vh;
+		background-color: #ffffff;
+		z-index: 99999;
+		display: flex;
+		flex-direction: column;
+		padding: 2vw;
+
+		.uni-input {
+			border: #f1f1ff 1px solid;
+			padding: 2vw 2vw;
+			border-radius: 1vw;
+		}
+
+		.picker {
+			border: 1px solid #3333;
+			border-radius: 5px;
+			padding: 2vw;
+		}
+
+		.btn {
+			text-align: center;
+			button {
+				margin: 0 2vw 2vw 2vw;
+				background-color: #23B67A;
+				color: #ffffff;
+			}
+
+			.name {
+				color: var(--f85Color);
+				font-size: var(--font14Size);
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
+
+	.is_bottom {
+		text-align: center;
+
+		text {
+			padding: 2vw 0;
+			display: inline-block;
+			color: #858585;
+			font-size: 14px;
+		}
+	}
+</style>

+ 108 - 187
pagesMy/dough/handle.vue

@@ -59,16 +59,9 @@
 							</view>
 							<view class="btn">
 								<button type="default" size="mini" @tap.stop="toView(item,'order')">详细信息</button>
-								<button v-if="item.status=='0'||item.status=='1'" size="mini"
-									@tap.stop="toCancel(item)">取消订单</button>
-								<button v-if="item.status=='0'" size="mini" @tap.stop="toPay(item)">支付</button>
 								<button v-if="item.status=='2'||item.status=='3'||item.status=='2-'" size="mini"
 									@tap.stop="toLogi(item)">查看物流</button>
-								<button v-if="item.status=='2'&&item.is_afterSale!=true" size="mini"
-									@tap.stop="toConfirm(item)">确认收货</button>
-								<button v-if="item.status=='2'||item.status=='2-'&&item.is_afterSale!=true" size="mini"
-									@tap.stop="toReject(item)">拒收</button>
-								<button v-if="item.status=='3'" size="mini" @tap.stop="toAfter(item)">申请售后</button>
+								<button v-if="item.is_afterSale==true" size="mini" @tap.stop="toHandle(item)">售后处理</button>
 							</view>
 						</view>
 						<view class="is_bottom" v-if="is_bottom">
@@ -94,6 +87,31 @@
 						<button type="primary" @click="onSubmit" size="mini">确定</button>
 						<button type="primary" @click="dialogClose" size="mini">取消</button>
 					</view>
+				</view><view class="dialog_1" v-else-if="dialog.type=='2'">
+					<uni-forms ref="form" :modelValue="afterInfo" :rules="rules" label-width="auto">
+						<uni-forms-item label="售后类型" name="zhType">
+							<uni-easyinput disabled  type="text" v-model="afterInfo.zhType" placeholder="请输入售后类型" />
+						</uni-forms-item>
+						<uni-forms-item label="售后状态" name="zhStatus">
+							<uni-easyinput disabled  type="text" v-model="afterInfo.zhStatus" placeholder="请输入售后状态" />
+						</uni-forms-item>
+						<uni-forms-item label="申请理由" name="zhReason">
+							<uni-easyinput disabled  type="text" v-model="afterInfo.zhReason" placeholder="请输入申请理由" />
+						</uni-forms-item>
+						<uni-forms-item label="退款金额" name="money">
+							<uni-easyinput disabled  type="text" v-model="afterInfo.money" placeholder="请输入退款金额" />
+						</uni-forms-item>
+						<uni-forms-item label="售后申请时间" name="apply_time">
+							<uni-easyinput disabled  type="text" v-model="afterInfo.apply_time" placeholder="请输入售后申请时间" />
+						</uni-forms-item>
+						<uni-forms-item label="申请售后描述" name="customer_name">
+							<uni-easyinput disabled  type="text" v-model="afterInfo.customer_name" placeholder="请输入申请售后描述" />
+						</uni-forms-item>
+					</uni-forms>
+					<view class="btn">
+						<button type="primary" @click="toAgree(true)" size="mini">同意</button>
+						<button type="primary" @click="toAgree(false)" size="mini">不同意</button>
+					</view>
 				</view>
 			</view>
 		</view>
@@ -112,6 +130,7 @@
 				id: '',
 				searchInfo: {},
 				list: [],
+				afterInfo:{},
 				total: 0,
 				skip: 0,
 				limit: 6,
@@ -121,6 +140,12 @@
 				scrollTop: 0,
 				// 字典表
 				statusList: [],
+				// 售后类型
+				typeList:[],
+				// 售后状态
+				astatusList:[],
+				// 理由
+				reasonList:[],
 				status_name: "",
 				// 条件弹出框
 				dialog: {
@@ -251,6 +276,69 @@
 					type: '1'
 				})
 			},
+			// 售后处理
+			async toHandle(e){
+				const that = this; 
+				let res = await that.$api(`/groupAfterSale`, 'GET', {
+					order:e._id,
+					customer:e.customer._id
+				}, 'group')
+				if (res.errcode == '0') {
+					for (let val of res.data) {
+						let type = that.typeList.find(i => i.value == val.type)
+						if (type) val.zhType = type.label;
+						let status = that.astatusList.find(i => i.value == val.status)
+						if (status) val.zhStatus = status.label;
+						let reason = that.reasonList.find(i => i.value == val.reason)
+						if (reason) val.zhReason = reason.label;
+					}
+					that.$set(that, `afterInfo`, res.data[0]);
+				}
+				that.$set(that, `dialog`, {
+					show: true,
+					type: '2'
+				})
+			},
+			// 售后同意
+			async toAgree(e){
+				const that = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定处理该订单吗?',
+					success: async function(res) {
+						if (res.confirm) {
+							let arr = await that.$api(`/groupAfterSale/${that.afterInfo._id}`, 'POST', {
+								leader_suggest: e
+							}, 'group')
+							if (arr.errcode == '0') {
+								uni.showToast({
+									title: '处理完成',
+									icon: 'none'
+								})
+								that.$set(that, `dialog`, {
+									show: false,
+									type: '2'
+								})
+								that.$set(that, `afterInfo`, {})
+								that.clearPage();
+								that.search();
+							} else {
+								uni.showToast({
+									title: arr.errmsg,
+									icon: 'none'
+								})
+								that.$set(that, `dialog`, {
+									show: false,
+									type: '2'
+								})
+								that.$set(that, `afterInfo`, {})
+								that.clearPage();
+								that.search();
+							}
+						}
+					}
+				});
+			},
 			// 状态选择
 			statusChange(e) {
 				const that = this;
@@ -288,120 +376,6 @@
 					url: `/pagesMy/dough/info?id=${item._id}`
 				})
 			},
-			// 取消订单-未支付||取消订单-已支付
-			toCancel(e) {
-				const that = this;
-				uni.showModal({
-					title: '提示',
-					content: '确定取消订单吗?',
-					success: async function(res) {
-						if (res.confirm) {
-							if (e.status == '0') {
-								const arr = await that.$api(`/orderDeal/cancel`, 'POST', {
-									order_id: e._id
-								}, 'group');
-								if (arr.errcode == '0') {
-									uni.showToast({
-										title: '申请取消订单完成',
-										icon: 'none'
-									})
-									that.clearPage();
-									that.search();
-								} else {
-									uni.showToast({
-										title: arr.errmsg,
-										icon: 'none'
-									})
-								}
-							} else {
-								if (e.is_afterSale != true) {
-									let arr = await that.$api(`/groupAfterSale`, 'POST', {
-										order: e._id,
-										type: '4'
-									}, 'group')
-									if (arr.errcode == '0') {
-										uni.showToast({
-											title: '申请取消订单完成',
-											icon: 'none'
-										})
-										that.clearPage();
-										that.search();
-									} else {
-										uni.showToast({
-											title: arr.errmsg,
-											icon: 'none'
-										})
-									}
-								} else {
-									uni.showToast({
-										title: `该订单有售后处理中`,
-										icon: 'none'
-									})
-								}
-							}
-						}
-					}
-				});
-			},
-			// 支付
-			async toPay(e) {
-				const that = this;
-				let system = that.system;
-				if (system.uniPlatform == "mp-weixin") {
-					uni.showLoading({
-						title: '加载中'
-					})
-					// 支付信息
-					let p2 = await that.$api('/orderDeal/pay', 'POST', {
-						order_id: e._id,
-					}, 'group')
-					if (p2.errcode == '0' && p2.data.paySign) {
-						uni.requestPayment({
-							"provider": "wxpay",
-							...p2.data,
-							success: function(res) {
-								uni.showToast({
-									title: '支付成功',
-									icon: 'none'
-								})
-							},
-							fail: function(err) {
-								uni.showToast({
-									title: `支付失败`,
-									icon: 'none'
-								})
-							},
-							complete: function() {
-								uni.hideLoading();
-								that.clearPage();
-								that.search()
-							}
-						})
-					} else {
-						uni.showToast({
-							title: p2.errmsg || '错误信息',
-							icon: 'none'
-						})
-					}
-				} else if (res.data.uniPlatform == "app") {
-					// app支付
-					uni.requestPayment({
-						provider: 'alipay',
-						orderInfo: 'orderInfo',
-						success: function(res) {
-							console.log('success:' + JSON.stringify(res));
-						},
-						fail: function(err) {
-							console.log('fail:' + JSON.stringify(err));
-						}
-					});
-				} else {
-					uni.showToast({
-						title: `平台不支持支付`,
-						icon: 'none'
-					})
-				}
-			},
 			// 查看物流
 			toLogi(e) {
 				const that = this;
@@ -410,71 +384,6 @@
 					url: `/pagesMy/logistics/index?id=${e._id}&type=${'groupOrder'}`
 				})
 			},
-			// 确认收货
-			async toConfirm(e) {
-				const that = this;
-				uni.showModal({
-					title: '提示',
-					content: '确定确认收货吗?',
-					success: async function(res) {
-						if (res.confirm) {
-							const arr = await that.$api(`/groupOrder/${e._id}`, 'POST', {
-								status: '3'
-							}, 'group');
-							if (arr.errcode == '0') {
-								uni.showToast({
-									title: '确认收货成功',
-									icon: 'none'
-								})
-								that.clearPage();
-								that.search();
-							} else {
-								uni.showToast({
-									title: arr.errmsg,
-									icon: 'none'
-								})
-							}
-						}
-					}
-				});
-			},
-			// 拒收
-			async toReject(e) {
-				const that = this;
-				uni.showModal({
-					title: '提示',
-					content: '确定拒收快递吗?',
-					success: async function(res) {
-						if (res.confirm) {
-							let arr = await that.$api(`/groupAfterSale`, 'POST', {
-								order: e._id,
-								type: '5'
-							}, 'group')
-							if (arr.errcode == '0') {
-								uni.showToast({
-									title: '拒收申请完成',
-									icon: 'none'
-								})
-								that.clearPage();
-								that.search();
-							} else {
-								uni.showToast({
-									title: arr.errmsg,
-									icon: 'none'
-								})
-							}
-						}
-					}
-				});
-			},
-			// 申请售后
-			toAfter(e) {
-				const that = this;
-				that.clearPage();
-				uni.navigateTo({
-					url: `/pagesMy/order/service?id=${e._id}&status=${'-3'}`
-				})
-			},
 			// 查询其他信息
 			async searchOther() {
 				const that = this;
@@ -484,6 +393,18 @@
 					code: 'order_process'
 				})
 				if (res.errcode == '0') that.$set(that, `statusList`, res.data);
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "afterSale_type"
+				});
+				if (res.errcode == '0') that.$set(that, `typeList`, res.data)
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "afterSale_status"
+				});
+				if (res.errcode == '0') that.$set(that, `astatusList`, res.data)
+				res = await that.$api(`/dictData`, 'GET', {
+					code: "afterSale_reason"
+				});
+				if (res.errcode == '0') that.$set(that, `reasonList`, res.data)
 			},
 			// 清空列表
 			clearPage() {

+ 4 - 0
pagesMy/order/afterInfo.vue

@@ -70,6 +70,10 @@
 					<view class="left">售后处理人</view>
 					<view class="right">{{info.deal_person.name||'暂无'}}</view>
 				</view>
+				<view class="one" v-if="status!= '0'">
+					<view class="left">团长建议</view>
+					<view class="right">{{info.leader_suggest==true?'同意':info.leader_suggest==false?'不同意':'暂无'}}</view>
+				</view>
 			</view>
 		</view>
 	</mobile-frame>