zs пре 2 година
родитељ
комит
60f3b10c15
5 измењених фајлова са 378 додато и 8 уклоњено
  1. 6 0
      pages.json
  2. 1 1
      pagesHome/order/order.vue
  3. 253 4
      pagesMy/order/after.vue
  4. 118 0
      pagesMy/order/detail.vue
  5. 0 3
      pagesMy/order/service.vue

+ 6 - 0
pages.json

@@ -77,6 +77,12 @@
 						"navigationBarTitleText": "售后列表"
 					}
 				},
+				{
+					"path": "order/detail",
+					"style": {
+						"navigationBarTitleText": "售后信息维护"
+					}
+				},
 				{
 					"path": "order/service",
 					"style": {

+ 1 - 1
pagesHome/order/order.vue

@@ -241,7 +241,7 @@
 										...res.data,
 										success(res) {
 											uni.reLaunch({
-												url: `/pagesMy/order/index`
+												url: `/pagesMy/order/index?status=${'1'}`
 											})
 										},
 										fail(e) {

+ 253 - 4
pagesMy/order/after.vue

@@ -1,6 +1,52 @@
 <template>
 	<mobile-frame>
-		售后列表
+		<view class="main">
+			<view class="one">
+				<input type="text" v-model="searchInfo.name" @input="toInput" placeholder="搜索商品">
+			</view>
+			<view class="two">
+				<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage">
+					<view class="list-scroll-view">
+						<view class="list" v-for="(item,index) in list" :key="index">
+							<view class="list_1">
+								<view class="shopname">
+									<text class="iconfont icon-shangdian"></text>
+									<text>{{item.shop.name}}</text>
+								</view>
+								<view class="type">
+									{{item.type=='0'?'退款':item.type=='1'?'换货':'维修'}}
+								</view>
+							</view>
+							<view class="list_2">
+								<image class="image" :src="item.file&&item.file.length>0?item.file[0].url:''" mode="">
+								</image>
+								<view class="other">
+									<view class="name">
+										{{item.goods.goods.name||'暂无'}}
+									</view>
+									<view class="other_1">
+										商品规格:<text>{{item.goods.name||'暂无'}}</text>
+									</view>
+									<view class="other_1">
+										退款:<text>¥{{item.result.money||'暂无'}}</text>
+									</view>
+									<view class="other_1">
+										申请时间:<text>{{item.apply_time||'暂无'}}</text>
+									</view>
+									<view class="other_1">
+										售后描述:<text>{{item.desc||'暂无'}}</text>
+									</view>
+								</view>
+							</view>
+							<view class="btn">
+								<button type="default" size="mini" @click="toCancel(item)">取消售后</button>
+								<button v-if="item.type!='0'" type="default" size="mini" @click="toRevise(item)">维护信息</button>
+							</view>
+						</view>
+					</view>
+				</scroll-view>
+			</view>
+		</view>
 	</mobile-frame>
 </template>
 
@@ -8,16 +54,219 @@
 	export default {
 		data() {
 			return {
-
+				user: {},
+				list: [],
+				total: 0,
+				skip: 0,
+				limit: 5,
+				page: 0
 			};
 		},
-		onShow: function() {},
+		onShow: function() {
+			const that = this;
+			that.clearPage();
+			that.watchLogin();
+		},
 		methods: {
-
+			// 维护信息
+			toRevise(e) {
+				uni.navigateTo({
+					url: `/pagesMy/order/detail?id=${e.id||e._id}`
+				})
+			},
+			// 取消售后
+			toCancel(e) {
+				const that = this;
+				uni.showModal({
+					title: '提示',
+					content: '确定删除售后申请吗?',
+					success: async function(res) {
+						if (res.confirm) {
+							const arr = await that.$api(`/afterSale/${e._id}`, 'DELETE');
+							if (arr.errcode == '0') {
+								uni.showToast({
+									title: '删除售后成功',
+									icon: 'none'
+								})
+								that.clearPage();
+								that.search();
+							} else {
+								uni.showToast({
+									title: arr.errmsg,
+									icon: 'none'
+								})
+							}
+						}
+					}
+				});
+			},
+			// 监听用户是否登录
+			watchLogin() {
+				const that = this;
+				uni.getStorage({
+					key: 'token',
+					success: function(res) {
+						let user = that.$jwt(res.data);
+						if (user) that.$set(that, `user`, user);
+						that.search();
+					},
+					fail: function(err) {
+						uni.navigateTo({
+							url: `/pages/login/index`
+						})
+					}
+				});
+			},
+			// 查询列表
+			async search() {
+				const that = this;
+				let user = that.user;
+				const arr = await that.$api(`/afterSale`, 'GET', {
+					customer: user._id
+				});
+				if (arr.errcode == '0') {
+					let list = [...that.list, ...arr.data];
+					that.$set(that, `list`, list)
+					that.$set(that, `total`, arr.total)
+				} else {
+					uni.showToast({
+						title: arr.errmsg,
+					});
+				}
+			},
+			// 分页
+			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 uni.showToast({
+					title: '没有更多数据了'
+				});
+			},
+			// 清空列表
+			clearPage() {
+				const that = this;
+				that.$set(that, `list`, [])
+				that.$set(that, `skip`, 0)
+				that.$set(that, `limit`, 5)
+				that.$set(that, `page`, 0)
+			}
 		}
 	}
 </script>
 
 <style lang="scss">
+	.main {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			border-bottom: 1px solid var(--f85Color);
+			padding: 2vw;
+
+			input {
+				padding: 2vw;
+				background-color: var(--f1Color);
+				font-size: var(--font14Size);
+				border-radius: 5px;
+			}
+		}
+
+		.two {
+			position: relative;
+			flex-grow: 1;
+			background-color: var(--f9Color);
+
+			.list {
+				margin: 2vw;
+				background-color: var(--fffColor);
+				padding: 2vw;
+				width: 92vw;
+				border-radius: 5px;
+
+				.list_1 {
+					display: flex;
+					justify-content: space-between;
+					font-size: var(--font16Size);
+					margin: 0 0 2vw 0;
+
+					.shopname {
+						text {
+							margin: 0 0 0 1vw;
+						}
+					}
+
+					.type {
+						color: var(--f85Color);
+					}
+				}
+
+				.list_2 {
+					display: flex;
+					justify-content: space-between;
+					align-items: center;
+
+					.image {
+						width: 25vw;
+						height: 25vw;
+						margin: 0 2vw 1vw 0;
+					}
 
+					.other {
+						flex-grow: 1;
+
+						.name {
+							font-size: var(--font16Size);
+						}
+
+						.other_1 {
+							font-size: var(--font14Size);
+
+							text {
+								color: var(--f85Color);
+							}
+						}
+					}
+				}
+
+				.btn {
+					text-align: right;
+
+					button {
+						margin: 2vw 0 0 2vw;
+					}
+				}
+			}
+
+			.list:nth-child(2n) {
+				margin: 0 0 2vw 0;
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
 </style>

+ 118 - 0
pagesMy/order/detail.vue

@@ -0,0 +1,118 @@
+<template>
+	<mobile-frame>
+		<view class="info">
+			<view class="one">
+				<uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
+					<uni-forms-item label="维护快递单号" name="customer_transport_no">
+						<uni-easyinput type="text" v-model="form.customer_transport_no" placeholder="请输入快递单号" />
+					</uni-forms-item>
+				</uni-forms>
+				<view class="btn">
+					<button type="primary" @click="onSubmit('form')" size="small">提交</button>
+				</view>
+			</view>
+		</view>
+	</mobile-frame>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				id: '',
+				form: {},
+				rules: {
+					customer_transport_no: {
+						rules: [{
+							required: true,
+							errorMessage: '请输入快递单号',
+						}]
+					}
+				},
+			};
+		},
+		onLoad: function(e) {
+			const that = this;
+			that.$set(that, `id`, e.id || '');
+			that.watchLogin();
+		},
+		onShow: function() {},
+		methods: {
+			// 提交保存
+			async onSubmit(ref) {
+				const that = this;
+				that.$refs[ref].validate().then(async params => {
+					let form = that.form;
+					form.customer_transport_no = params.customer_transport_no;
+					const arr = await that.$api(`/afterSale/${that.id}`, 'POST', form);
+					if (arr.errcode == '0') {
+						uni.showToast({
+							title: `维护信息成功`,
+							icon: 'success',
+						});
+						uni.navigateBack({
+							detail: 1
+						})
+					} else {
+						uni.showToast({
+							title: arr.errmsg,
+							icon: 'none',
+						})
+					}
+				})
+			},
+			watchLogin() {
+				const that = this;
+				uni.getStorage({
+					key: 'token',
+					success: async (res) => {},
+					fail: (err) => {
+						uni.navigateTo({
+							url: `/pages/login/index`
+						})
+					}
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.info {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			padding: 2vw;
+
+			.uni-input {
+				border: #f1f1ff 1px solid;
+				padding: 2vw 2vw;
+				border-radius: 1vw;
+			}
+
+			.btn {
+				text-align: center;
+
+				button {
+					margin: 0 2vw 2vw 2vw;
+					background-color: var(--ff0Color);
+					color: var(--fffColor);
+				}
+
+				.name {
+					color: var(--f85Color);
+					font-size: var(--font14Size);
+				}
+			}
+		}
+	}
+
+	.uni-forms-item {
+		margin-bottom: 6vw !important;
+		display: flex;
+		flex-direction: row;
+	}
+</style>

+ 0 - 3
pagesMy/order/service.vue

@@ -47,9 +47,6 @@
 							<view>{{form.reason_name||'请选择申请理由'}}</view>
 						</picker>
 					</uni-forms-item>
-					<uni-forms-item v-if="form.type=='1'" label="维护快递单号" name="phone">
-						<uni-easyinput type="text" v-model="form.phone" placeholder="请输入维护快递单号" />
-					</uni-forms-item>
 					<uni-forms-item label="申请售后描述" name="desc">
 						<uni-easyinput type="textarea" v-model="form.desc" placeholder="请输入申请售后描述" />
 					</uni-forms-item>