order comment 7.31

This commit is contained in:
ghusermoon 2020-07-31 21:47:41 +08:00
parent cdd0105acb
commit ff7c6b358d
10 changed files with 310 additions and 164 deletions

View File

@ -230,16 +230,15 @@ export default {
});
},
// 订单列表
getOrderList({ page, type, refund_state }) {
getOrderList({ page, type }) {
let params = { page: page };
if(type >= 0 || typeof type == 'string') Object.assign(params, {state_type: type});
if(refund_state) Object.assign(params, {refund_state: refund_state});
if(type > 0) Object.assign(params, {type: type});
return vm.$u.post('Order/orderList', params);
},
// 售后列表
getAfterSaleList({ page }) {
return vm.$u.post('order/afterSaleList', { page: page });
},
// getAfterSaleList({ page }) {
// return vm.$u.post('order/afterSaleList', { page: page });
// },
// 试穿列表
goodsTryOrderList() {
return vm.$u.post('order/goodsTryOrderList');

View File

@ -15,7 +15,7 @@
<view class="goods-sku u-line-1" v-if="order.order_state !== 20 && order.order_state !== 40 && goods.goods_spec">
<text v-for="(spec, index) in goods.goods_spec" :key="index">{{ spec + ';' }}</text>
</view>
<view class="goods-time u-line-1" v-if="order.order_state == 10 || order.order_state == 10">结束时间{{ order.add_time * 1000 | date('yyyy-mm-dd hh:MM') }}</view>
<!-- <view class="goods-time u-line-1" v-if="order.order_state == 10 || order.order_state == 10">结束时间{{ order.add_time * 1000 | date('yyyy-mm-dd hh:MM') }}</view> -->
<view class="goods-price u-line-1" v-if="order.order_state == 20 || order.order_state == 40">总价{{ goods.goods_price }}实付款{{ goods.goods_pay_price }}</view>
<view class="goods-date" v-if="order.order_state == 20 || order.order_state == 40">
<image src="@/pageE/static/mine/26.png"></image>
@ -24,14 +24,14 @@
</view>
</view>
</view>
<view class="order-btn" v-if="[10, 30, 20, 40].indexOf(order.order_state) >= 0">
<view class="logistics" v-if="order.order_state == 30">确认收货</view>
<view class="logistics" v-if="order.order_state == 30" @click="toOtherPage('Logistics')">查看物流</view>
<view class="comment" v-if="order.order_state == 40 && order.evaluation_state == 0" @click="toOtherPage('Comment')">立即评价</view>
<view class="calcel" v-if="order.order_state == 10" @click="cancelOrder">取消支付</view>
<view class="payment" v-if="order.order_state == 10" @click="payNow(order.pay_sn, order.order_amount)">立即支付</view>
<view class="service" v-if="order.order_state == 20">联系官方客服</view>
<view class="submit" v-if="order.order_state == 20">提交官方审核</view>
<view class="order-btn" v-if="[1, 3, 4, 8].indexOf(order.view_type) >= 0">
<view class="calcel" v-if="order.view_type == 3" @click="toOtherPage('Logistics')">查看物流</view>
<view class="logistics" v-if="order.view_type == 3" @click="confirmReceive">确认收货</view>
<view class="comment" v-if="order.view_type == 4" @click="toOtherPage('Comment')">立即评价</view>
<view class="calcel" v-if="order.view_type == 1" @click="cancelOrder">取消支付</view>
<view class="payment" v-if="order.view_type == 1" @click="payNow(order.pay_sn, order.order_amount)">立即支付</view>
<view class="service" v-if="order.view_type == 8">联系官方客服</view>
<view class="submit" v-if="order.view_type == 8">提交官方审核</view>
</view>
</view>
</template>
@ -40,7 +40,7 @@ import common from '@/static/js/common.js';
export default {
data() {
return {
state: '', // 1: 2: 3: 4: 5: 退 6: , 7:
state: '',
}
},
props: {
@ -49,44 +49,25 @@ export default {
created() {
this.viewState();
},
filters: {
// timeLine(timestamp) {
// const timestamp = 0.5*60*60*1000;
// const now = new Date().getTime();
// let line = now - timestamp * 1000;
// return common.getLineTime({ timestamp: line });
// }
},
methods: {
viewState() {
let state;
switch (this.order.order_state) {
case 0: //
state = '已取消';
break;
case 10: //
switch (this.order.view_type) {
case 1:
state = '待支付';
break;
case 20: //
state = '交易成功';
case 2:
state = '待发货';
break;
case 30: //
case 3:
state = '待收货';
break;
case 40: //
if(this.order.evaluation_state == 0) state = '待评价';
else state = '交易成功'
case 4:
state = '待评价';
break;
default:
break;
}
if(this.order.refund_state) state = '已退款';
// 退
if(this.order.refund_data) {
if([1, 2].indexOf(this.order.refund_data.refund_state) >= 0) state = '待退款';
if(this.order.refund_data.refund_state == 3) state = '已退款';
}
this.state = state;
},
cancelOrder() {
@ -94,7 +75,17 @@ export default {
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList", { reload: 'again' });
this.$emit("refreshOrderList");
}
this.$u.toast(res.message);
})
},
confirmReceive() {
this.$u.api.confirmReceive({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.$emit("refreshOrderList");
}
this.$u.toast(res.message);
})
@ -165,6 +156,7 @@ export default {
line-height: 38rpx;
}
.goods-sku {
display: inline-block;
max-width: 230rpx;
background: rgba(236,236,236,1);
border-radius: 6rpx;

View File

@ -1,34 +1,47 @@
<template>
<view class="comment">
<view class="main-container">
<textarea @blur="bindTextAreaBlur" auto-height placeholder="发表你的评价吧,收货时心情如何?" maxlength="200" />
<u-upload
ref="uUpload"
@on-uploaded="onUploaded"
:custom-btn="true"
:max-count="count"
:auto-upload="false"
>
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image src="../static/mine/27.png"></image>
<view class="goods-comment" v-for="(goods, index) in goodsList" :key="index">
<view class="goods-info">
<image :src="goods.goods_image"></image>
<view class="goods-text">
<view class="goods-name u-line-1">{{ goods.goods_name }}</view>
<!-- <view class="goods-spec u-line-1">{{ }}</view> -->
</view>
</view>
</u-upload>
<view class="rate">
<view class="title">描述相符</view>
<u-rate :count="5" v-model="describe[index]" active-color="#FF780F" inactive-color="#CCCCCC" gutter="20" size="32"></u-rate>
</view>
<u-input v-model="content[index]" type="textarea" height="100" :auto-height="true" placeholder="发表你的评价吧,收货时心情如何?" />
<u-upload
:ref="'upload' + index"
:custom-btn="true"
:max-count="count"
:auto-upload="false"
@on-uploaded="uploadImage"
:action="action"
:header="header"
:form-data="formData"
:name="fileName"
>
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image src="../static/mine/27.png"></image>
</view>
</u-upload>
</view>
</view>
<view class="rate">
<view>
<view class="order-rate">
<view class="rate">
<view class="title">物流评分</view>
<u-rate :count="5" active-color="#FF780F" inactive-color="#CCCCCC" v-model="logistics" gutter="20" size="32"></u-rate>
</view>
<view>
<view class="rate">
<view class="title">服务态度</view>
<u-rate :count="5" v-model="service" active-color="#FF780F" inactive-color="#CCCCCC" gutter="20" size="32"></u-rate>
</view>
<view>
<view class="title">描述相符</view>
<u-rate :count="5" v-model="describe" active-color="#FF780F" inactive-color="#CCCCCC" gutter="20" size="32"></u-rate>
</view>
</view>
<view class="write-btn" @click="addOrderEvaluate">发表意见</view>
<view class="write-btn" @click="submitComment">发表意见</view>
</view>
</template>
<script>
@ -37,42 +50,110 @@ export default {
return {
orderId: '',
count: 4, //
logistics: 5,
service: 5,
describe: 5,
content: '',
logistics: 0, //
service: 0, //
action: this.$u.http.config.baseUrl + '/Upload/uploadfile', //
header: {
"authorization": 'Bearer' + " " + uni.getStorageSync('token')
},
fileName: 'common', // formData name
formData: {
name: 'common', //
},
describe: [],
content: [],
imageList: [],
goodsList: [],
imageIndex: 0, //
}
},
beforeMount() {
// this.init();
// this.getOrderInfo();
},
onLoad(option) {
this.orderId = option.oid;
this.getOrderInfo(option.oid);
},
methods: {
uploadImage(lists) {
let imageList = [];
lists.forEach(res => {
if(res.response.errCode == 0) imageList.push(res.response.data.file_name);
})
this.imageList[this.imageIndex] = imageList;
if(this.imageIndex == this.goodsList.length - 1) this.addOrderEvaluate();
},
setModelKey(data) {
data.forEach(() => {
this.content.push('');
this.describe.push(0);
this.imageList.push([]);
})
},
getOrderInfo(id) {
this.$u.api.getOrderInfo({
order_id: id,
}).then(res => {
if(res.errCode == 0) {
// this.goodsList = res.data.extend_order_goods;
this.goodsList = [1,2];
this.setModelKey(this.goodsList);
}
})
},
verifyParams() {
if(this.$u.test.isEmpty(this.content)) {
this.$u.toast('内容不可为空');
return false;
}
this.goodsList.forEach((_, index) => {
if(this.$u.test.isEmpty(this.content[index])) {
this.$u.toast('内容不可为空');
return false;
}
})
return true;
},
submitComment() {
this.goodsList.forEach((_, index) => {
this.imageIndex = index;
const upload = 'upload' + index;
this.$refs[upload][0].upload();
})
// let i = 0;
// while(JSON.stringify(this.imageList[this.imageIndex]) != '[]' && i <= this.goodsList.length) {
// this.imageIndex = i;
// const upload = 'upload' + index;
// this.$refs[upload][0].upload();
// i++;
// }
},
addOrderEvaluate() {
if(!this.verifyParams()) return false;
// console.log(this.logistics);
// console.log(this.service);
// console.log(this.describe);
this.$u.api.updateOrderEvaluate({
let files = [];
console.log(this.imageList);
this.imageList.forEach((item, index) => {
files[index] = '';
// console.log(item);
item.forEach((img, idx) => {
if(idx < item.length-1) {
files[index] += img + ',';
} else {
files[index] += img;
}
})
})
let params = {
id: this.orderId,
content: this.content,
scores_one: this.logistics,
scores_two: this.service,
scores_three: this.describe,
file: '', //
}).then(res => {
})
file: files,
};
// console.log(params);
// this.$u.api.updateOrderEvaluate(params).then(res => {
// this.$u.toast(res.message);
// })
},
bindTextAreaBlur(event) {
this.content = event.detail.value;
}
},
};
</script>
@ -81,30 +162,62 @@ export default {
min-height: calc(100vh - var(--window-top));
background-color: #ECECEC;
.main-container {
background-color: #ffffff;
padding: 30rpx;
margin-bottom: 10rpx;
textarea {
width: 100% !important;
margin-bottom: 60rpx;
}
.slot-btn {
width: 140rpx;
height: 140rpx;
background: rgba(236,236,236,1);
border-radius: 10rpx;
text-align: center;
> image {
margin-top: 48rpx;
width: 54rpx;
height: 49rpx;
.goods-comment {
background-color: #ffffff;
padding: 30rpx;
margin-bottom: 30rpx;
.goods-info {
display: flex;
margin-bottom: 40rpx;
> image {
width: 113rpx;
height: 106rpx;
border-radius: 5rpx;
margin-right: 20rpx;
background-color: antiquewhite;
}
.goods-text {
.goods-name {
width: 530rpx;
font-size: 28rpx;
color: rgba(0,0,51,1);
margin-bottom: 20rpx;
}
.goods-spec {
max-width: 300rpx;
box-sizing: content-box;
padding: 10rpx 15rpx;
font-size: 24rpx;
color: rgba(153,153,153,1);
background:rgba(236,236,236,1);
border-radius: 6rpx;
display: inline-block;
}
}
}
textarea {
width: 100% !important;
margin-bottom: 60rpx;
}
.slot-btn {
width: 140rpx;
height: 140rpx;
background: rgba(236,236,236,1);
border-radius: 10rpx;
text-align: center;
> image {
margin-top: 48rpx;
width: 54rpx;
height: 49rpx;
}
}
}
}
.rate {
background-color: #ffffff;
padding: 33rpx 30rpx;
> view {
// background-color: #ffffff;
// padding: 33rpx 30rpx;
// > view {
display: flex;
&:not(:last-child) {
margin-bottom: 35rpx;
@ -114,7 +227,11 @@ export default {
font-size: 28rpx;
color: rgba(51,51,51,1);
}
}
// }
}
.order-rate {
background-color: #ffffff;
padding: 33rpx 30rpx;
}
.write-btn {
margin: 120rpx auto 0;

View File

@ -3,7 +3,7 @@
<view class="status" v-if="state">
<view class="text">
<view class="status-text">{{ s_object[state].text }}</view>
<view class="time" v-if="state == '2'">距离结束22:22:22</view>
<view class="time" v-if="orderInfo.view_type == 1">结束时间{{ orderInfo.end_time }}</view>
</view>
<image :src="s_object[state].image"></image>
</view>
@ -67,8 +67,10 @@
<view>创建时间{{ orderInfo.add_time | date}}</view>
</view>
</view>
<view class="btn" v-if="['1', '2', '6'].indexOf(state) >= 0">
<view class="logistics" v-if="state == '1'" @click="toOtherPage('Logistics')">查看物流</view>
<view class="btn" v-if="['1', '2', '4', '6'].indexOf(state) >= 0">
<view class="cancel" v-if="state == '4' || state == '1' " @click="applyRefund">申请退款</view>
<view class="cancel" v-if="state == '1'" @click="toOtherPage('Logistics')">查看物流</view>
<view class="logistics" v-if="state == '1'" @click="confirmReceive">确认收货</view>
<view class="comment" v-if="state == '2'" @click="toOtherPage('Comment')">立即评价</view>
<view class="cancel" v-if="state == '6'" @click="cancelOrder">取消支付</view>
<view class="payment" v-if="state == '6'" @click="payNow">立即支付</view>
@ -96,8 +98,8 @@ export default {
image: '../static/mine/31.png',
},
'4': {
text: '已取消',
image: '../static/mine/33.png',
text: '待发货',
image: '../static/mine/36.png',
},
'5': {
text: '已退款',
@ -112,45 +114,44 @@ export default {
image: '../static/mine/34.png',
},
},
current: 0,
orderInfo: {}
orderInfo: {},
oid: '',
}
},
onLoad(option) {
this.setTitle();
this.oid = option.oid;
this.getOrderInfo(option.oid);
},
//
onPullDownRefresh() {
this.getOrderInfo(this.oid);
},
methods: {
viewState(value) {
let state;
switch (value) {
case 0: //
state = '4';
break;
case 10: //
case 1:
state = '6';
break;
case 20: //
state = '3';
case 2:
state = '4';
break;
case 30: //
case 3:
state = '1';
break;
case 40: //
if(this.orderInfo.evaluation_state == 0) state = '2';
case 4:
state = '2';
break;
case 6:
state = '7';
break;
case 7:
state = '5';
break;
default:
break;
}
if(this.orderInfo.refund_state) state = '5';
// 退
if(this.orderInfo.refund_list) {
const refund = this.orderInfo.refund_list[this.orderInfo.extend_order_common.order_id];
if(this.orderInfo.refund_list) {
if([1, 2].indexOf(refund.refund_state) >= 0) state = '7';
if(refund.refund_state == 3) state = '8';
}
}
this.state = state;
},
getOrderInfo(id) {
@ -159,9 +160,14 @@ export default {
}).then(res => {
if(res.errCode == 0) {
this.orderInfo = res.data;
this.viewState(this.orderInfo.order_state);
this.viewState(this.orderInfo.view_type);
this.setTitle(this.orderInfo.view_type);
}
uni.stopPullDownRefresh(); //
})
},
applyRefund() {
},
cancelOrder() {
this.$u.api.cancelOrder({
@ -172,10 +178,20 @@ export default {
}
})
},
setTitle(){
confirmReceive() {
this.$u.api.confirmReceive({
order_id: this.order.order_id,
}).then(res => {
if(res.errCode == 0) {
this.getOrderInfo(this.oid);
}
this.$u.toast(res.message);
})
},
setTitle(value){
let title = '';
switch (this.current) {
case '1':
switch (value) {
case 1:
title = "支付成功"
break;
default:
@ -292,6 +308,7 @@ export default {
}
.store-goods {
display: flex;
margin-bottom: 20rpx;
> image {
width: 180rpx;
height: 160rpx;
@ -300,6 +317,7 @@ export default {
flex-shrink: 0;
}
.goods-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;

View File

@ -30,15 +30,15 @@ export default {
}, {
name: '待支付'
}, {
name: '已取消'
name: '待发货'
}, {
name: '待收货'
}, {
name: '试穿试送'
}, {
name: '待评价'
}, {
name: '售后'
}, {
name: '待评价'
}],
orderList: [],
loadStatus: ['loadmore','loadmore','loadmore','loadmore','loadmore','loadmore','loadmore'],
@ -59,13 +59,11 @@ export default {
this.orderList = [];
}
this.page = 0;
// again
if(value == 6) {
this.getAfterSaleList({ reload: 'again' });
} else if(value == 4) {
this.goodsTryOrderList({ reload: 'again' });
// reload loadmore
if(value == 4) {
this.goodsTryOrderList({ load: 'reload' });
} else {
this.getOrderList({ reload: 'again' });
this.getOrderList({ load: 'reload' });
}
},
},
@ -75,25 +73,31 @@ export default {
this.swiperCurrent = this.current;
this.setViewHeight();
},
//
onPullDownRefresh() {
this.refreshOrderList();
},
methods: {
setOrderType() {
let type;
// state_type 0: 10: 20: 30: 40:
switch (this.current) {
case 1:
type = 10; //
type = 1; //
break;
case 2:
type = 0; //
type = 2; //
break;
case 3:
type = 30; //
type = 3; //
break;
case 4:
type = -1; // 穿
break;
case 5:
type = 'state_noeval'; //
type = 8; //
break;
case 6:
type = 4; //
break;
default:
type = -1;
@ -103,46 +107,52 @@ export default {
},
refreshOrderList() {
this.page = 0;
if(this.current == 6) {
this.getAfterSaleList({ reload: 'again' });
} else if(this.current == 4) {
this.goodsTryOrderList({ reload: 'again' });
// if(this.current == 6) {
// this.getAfterSaleList({ load: 'reload' });
// } else
if(this.current == 4) {
this.goodsTryOrderList({ load: 'reload' });
} else {
this.getOrderList({ reload: 'again' });
this.getOrderList({ load: 'reload' });
}
},
async getOrderList({ reload = '' } = {}) {
//
async getOrderList({ load = 'loadmore' } = {}) {
const type = this.setOrderType();
const res = await this.$u.api.getOrderList({
page: this.page,
type: type,
})
this.timer = true;
uni.stopPullDownRefresh(); //
if(res.errCode == 0) {
if(reload) this.orderList = res.data;
else this.orderList.push(...res.data);
if(load == 'reload') this.orderList = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data);
}
return res;
},
async getAfterSaleList({ reload = '' } = {}) {
//
async getAfterSaleList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.getAfterSaleList({
page: this.page,
})
this.timer = true;
if(res.errCode == 0) {
if(reload) this.orderList = res.data;
else this.orderList.push(...res.data);
if(load == 'reload') this.orderList = res.data;
else if(load == 'loadmore') this.orderList.push(...res.data);
}
return res;
},
async goodsTryOrderList({ reload = '' } = {}) {
// 穿
async goodsTryOrderList({ load = 'loadmore' } = {}) {
const res = await this.$u.api.goodsTryOrderList({
page: this.page,
})
uni.stopPullDownRefresh(); //
this.timer = true;
if(res.errCode == 0) {
if(reload) this.orderList = res.data.list;
else this.orderList.push(...res.data.list);
if(load == 'reload') this.orderList = res.data.list;
else if(load == 'loadmore') this.orderList.push(...res.data.list);
}
return res;
},
@ -154,8 +164,9 @@ export default {
this.loadStatus.splice(this.current, 1, "loading");
this.page++;
let promise;
if(this.current == 6) promise = this.getAfterSaleList();
else if(this.current == 4) promise = this.goodsTryOrderList();
// if(this.current == 6) promise = this.getAfterSaleList();
// else
if(this.current == 4) promise = this.goodsTryOrderList();
else promise = this.getOrderList();
promise.then(res => {
this.loadStatus.splice(this.current, 1, "nomore");

View File

@ -42,7 +42,8 @@ export default {
},
methods: {
getOrderLogistics(id) {
this.$u.api.orderLogistics({ id: 16 }).then(res => {
this.$u.api.orderLogistics({ id: id }).then(res => {
this.$u.toast(res.message);
if(res.errCode == 0) {
this.expressInfo = res.data.express_info;
this.list = res.data.express_list;

BIN
pageE/static/mine/36.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

View File

@ -809,6 +809,7 @@
{
"path": "order/Index",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的订单",
"app-plus": {
"titleSize": "36px",
@ -822,6 +823,7 @@
{
"path": "order/Details",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "订单详情",
"app-plus": {
"titleSize": "36px",
@ -897,6 +899,7 @@
{
"path": "pages/mine/index",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "我的",
"app-plus": {
"titleSize": "36px",

View File

@ -56,8 +56,8 @@
<view>待支付</view>
</view>
<view @click="toOtherPage('/order/Index?current=2')">
<image src="/static/image/mine/14.png"></image>
<view>已取消</view>
<image src="/static/image/mine/35.png"></image>
<view>待发货</view>
</view>
<view @click="toOtherPage('/order/Index?current=3')">
<image src="/static/image/mine/2.png"></image>
@ -138,6 +138,10 @@ export default {
onShow() {
this.getUserInfo();
},
//
onPullDownRefresh() {
this.getUserInfo();
},
onNavigationBarButtonTap() {
this.toOtherPage("/setting/Index");
},
@ -147,6 +151,7 @@ export default {
if (res.errCode == 0) {
// this.userInfo = res.data.MemberArray;
this.$set(this, 'userInfo', res.data.MemberArray);
uni.stopPullDownRefresh();
}
})
},
@ -316,7 +321,7 @@ export default {
@include image-size($image-width: 33rpx, $image-height: 36rpx);
}
> view:nth-child(2){
@include image-size($image-width: 39rpx, $image-height: 33rpx);
@include image-size($image-width: 38rpx, $image-height: 32rpx);
}
> view:nth-child(3){
@include image-size($image-width: 41rpx, $image-height: 33rpx);

BIN
static/image/mine/35.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B