38 changed files with 2774 additions and 885 deletions
@ -0,0 +1,64 @@
|
||||
import request from '@/utils/request' |
||||
|
||||
// 提交售后
|
||||
/** |
||||
*
|
||||
订单号 orderCode; |
||||
服务类型 0仅退款1退货退款 serviceType; |
||||
申请原因 reasonForApplication; |
||||
申请说明 applicationInstructions; |
||||
申请说明图片 applicationDescriptionPicture; |
||||
商品数据 productParamList; |
||||
*/ |
||||
export function submitAfterSealsOrder(data) { |
||||
return request.post(`/applyForAfterSales`, data, { |
||||
login: true |
||||
}); |
||||
} |
||||
|
||||
// 售后订单列表
|
||||
export function getAfterSealsList (params) { |
||||
return request.get('/storeAfterSales/list', params, { |
||||
login: true, |
||||
}); |
||||
} |
||||
|
||||
// 售后详情
|
||||
export function getAfterSalesDeatail(key) { |
||||
return request.get(`/applyForAfterSales/${key}`); |
||||
} |
||||
|
||||
// 查询订单
|
||||
export function getAfterSealsDetail (key, id) { |
||||
return request.get(`/store/detail/${key}/${id}`) |
||||
} |
||||
|
||||
// 搜索
|
||||
export function searchAfterSealsDetail (key) { |
||||
return request.get(`/store/detail/${key}`) |
||||
} |
||||
|
||||
// 撤销售后订单
|
||||
export function rebackAfterSeals (key, id) { |
||||
return request.get(`/revoke/${key}/${id}`) |
||||
} |
||||
|
||||
// 获取物流信息
|
||||
export function getExpressData () { |
||||
return request.get('/yxExpress') |
||||
|
||||
} |
||||
|
||||
// 添加快递单号
|
||||
export function addExpressData (params) { |
||||
return request.post('/addLogisticsInformation?' + `code=${params.code}&name=${params.name}&postalCode=${params.postalCode}&orderCode=${params.orderCode}&`, '', { |
||||
login: true |
||||
}) |
||||
} |
||||
|
||||
// 删除售后订单
|
||||
export function deleteAfterSeals (params) { |
||||
return request.delete('/deleteAfterSalesOrder', params, { |
||||
login: true |
||||
}) |
||||
} |
@ -1,153 +1,394 @@
|
||||
<!-- 售后提交 --> |
||||
<template> |
||||
<view class="apply-return"> |
||||
<view class="goodsStyle acea-row row-between" v-for="cart in orderInfo.cartInfo" :key="cart.id"> |
||||
<view class="pictrue"> |
||||
<image :src="cart.productInfo.image" class="image" /> |
||||
<!-- 申请售后 --> |
||||
<view class="container" v-if="selected"> |
||||
<view class="goodsStyle acea-row row-between" |
||||
v-for="cart in selectProduct" |
||||
:key="cart.id" |
||||
> |
||||
<view class="pictrue"> |
||||
<image :src="cart.productInfo.image" class="image" /> |
||||
</view> |
||||
<view class="text acea-row row-between"> |
||||
<view class="name line2">{{ cart.productInfo.storeName }}</view> |
||||
<view class="money"> |
||||
<view> |
||||
¥{{ |
||||
cart.productInfo.attrInfo |
||||
? cart.productInfo.attrInfo.price |
||||
: cart.productInfo.price |
||||
}} |
||||
</view> |
||||
<view class="num">x{{ cart.cartNum }}</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="text acea-row row-between"> |
||||
<view class="name line2">{{ cart.productInfo.storeName }}</view> |
||||
<view class="money"> |
||||
<view> |
||||
¥{{ |
||||
cart.productInfo.attrInfo |
||||
? cart.productInfo.attrInfo.price |
||||
: cart.productInfo.price |
||||
}} |
||||
<view class="list"> |
||||
<view v-if="serviceType === 1" class="item acea-row row-between-wrapper"> |
||||
<view>退货件数</view> |
||||
<view class="num">{{ totalNum || 0 }}</view> |
||||
</view> |
||||
<view class="item acea-row row-between-wrapper"> |
||||
<view>退款金额</view> |
||||
<view class="num">¥{{ totalMoney || 0 }}</view> |
||||
</view> |
||||
<picker :value="reason" :range="reasonList" @change="changeReason"> |
||||
<view class="item acea-row row-between-wrapper"> |
||||
<view>退款原因</view> |
||||
<view class="num">{{reason}}</view> |
||||
<text class="iconfont icon-jiantou"></text> |
||||
</view> |
||||
<view class="num">x{{ cart.cartNum }}</view> |
||||
</picker> |
||||
<view class="item textarea acea-row row-between"> |
||||
<view>备注说明</view> |
||||
<textarea class="num" |
||||
placeholder="填写备注信息,100字以内" |
||||
v-model="refund_reason_wap_explain" |
||||
></textarea> |
||||
</view> |
||||
</view> |
||||
<view v-if="serviceType === 0" |
||||
class="returnBnt bg-color-red" |
||||
@click="submit" |
||||
>申请退款</view> |
||||
<view v-if="serviceType === 1" |
||||
class="returnBnt bg-color-red" |
||||
@click="submit" |
||||
>申请退货</view> |
||||
</view> |
||||
<view class="list"> |
||||
<view class="item acea-row row-between-wrapper"> |
||||
<view>退货件数</view> |
||||
<view class="num">{{ orderInfo.totalNum }}</view> |
||||
</view> |
||||
<view class="item acea-row row-between-wrapper"> |
||||
<view>退款金额</view> |
||||
<view class="num">¥{{ orderInfo.payPrice }}</view> |
||||
<!-- 选择商品 --> |
||||
<view class="selectProduct" v-else> |
||||
<view class="selectContainer" |
||||
v-for="(cart, index) in selectProduct" |
||||
:key="cart.id" |
||||
> |
||||
<view class="checkbox-wrapper"> |
||||
<checkbox-group @change="switchSelect(index)"> |
||||
<label class="well-check"> |
||||
<checkbox color="#eb3729" value :checked="cart.checked"></checkbox> |
||||
</label> |
||||
</checkbox-group> |
||||
</view> |
||||
<view class="pictrue"> |
||||
<image :src="cart.productInfo.image" class="image" /> |
||||
</view> |
||||
<view class="content"> |
||||
<view class="title">{{ cart.productInfo.storeName || '' }}</view> |
||||
<view class="skus"> |
||||
<view class="sku"> |
||||
{{ cart.productInfo.attrInfo.sku || '' }} |
||||
</view> |
||||
<view class="num">x{{ cart.cartNum || 0 }}</view> |
||||
</view> |
||||
<view class="money"> |
||||
¥<view> |
||||
{{ |
||||
cart.productInfo.attrInfo |
||||
? cart.productInfo.attrInfo.price |
||||
: cart.productInfo.price |
||||
}} |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<picker :value="reason" :range="reasonList" @change="changeReason"> |
||||
<view class="item acea-row row-between-wrapper"> |
||||
<view>退款原因</view> |
||||
<view class="num">{{reason}}</view> |
||||
<text class="iconfont icon-jiantou"></text> |
||||
<view class="choose"> |
||||
<view class="checkTotal"> |
||||
<checkbox-group @change="allChecked"> |
||||
<label class="well-check"> |
||||
<checkbox |
||||
color="#eb3729" |
||||
value="allSelect" |
||||
:checked="isAllSelect" |
||||
></checkbox> |
||||
<text class="checkAll">全选 ({{ cartCount || 0 }})</text> |
||||
</label> |
||||
</checkbox-group> |
||||
<view class="total"> |
||||
<view class="proTotal"> |
||||
{{ orderInfo.totalNum || 0 }}件商品 |
||||
</view> |
||||
<view class="moneyTotal"> |
||||
合计 ¥ {{ orderInfo.totalPrice || 0 }} |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="typeBtn"> |
||||
<view class="button def" @click="chooseType(0)">仅退款</view> |
||||
<view class="button redBtn" @click="chooseType(1)">退货退款</view> |
||||
</view> |
||||
</picker> |
||||
<view class="item textarea acea-row row-between"> |
||||
<view>备注说明</view> |
||||
<textarea placeholder="填写备注信息,100字以内" class="num" v-model="refund_reason_wap_explain"></textarea> |
||||
</view> |
||||
</view> |
||||
<view class="returnBnt bg-color-red" @click="submit">申请退款</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
orderDetail, |
||||
getRefundReason, |
||||
postOrderRefund |
||||
} from "@/api/order"; |
||||
import { |
||||
trim |
||||
} from "@/utils"; |
||||
import { |
||||
VUE_APP_API_URL |
||||
} from "@/config"; |
||||
import { |
||||
orderDetail, |
||||
getRefundReason, |
||||
postOrderRefund |
||||
} from "@/api/order"; |
||||
import { |
||||
submitAfterSealsOrder |
||||
} from '@/api/aftersales.js'; |
||||
import { |
||||
trim |
||||
} from "@/utils"; |
||||
import { |
||||
VUE_APP_API_URL |
||||
} from "@/config"; |
||||
|
||||
export default { |
||||
name: "goodsReturn", |
||||
components: { |
||||
// VueCoreImageUpload |
||||
export default { |
||||
name: "goodsReturn", |
||||
components: { |
||||
// VueCoreImageUpload |
||||
}, |
||||
data() { |
||||
return { |
||||
url: `${VUE_APP_API_URL}/upload/image`, |
||||
headers: { |
||||
Authorization: "Bearer " + this.$store.state.token |
||||
}, |
||||
id: 0, |
||||
selected: false, |
||||
orderInfo: {}, |
||||
rebackList: [], |
||||
reasonList: [], |
||||
reason: "", |
||||
refund_reason_wap_explain: '', |
||||
refund_reason_wap_img: [], |
||||
serviceType: null, |
||||
// 选中售后商品 |
||||
selectProduct: [], |
||||
productParamList: [], |
||||
totalNum: 0, |
||||
totalMoney: 0, |
||||
isAllSelect: false |
||||
}; |
||||
}, |
||||
mounted() { |
||||
this.id = this.$yroute.query.id || 0; |
||||
this.getOrderDetail(); |
||||
this.getRefundReason(); |
||||
}, |
||||
methods: { |
||||
changeReason(e) { |
||||
this.reason = this.reasonList[e.mp.detail.value]; |
||||
}, |
||||
data() { |
||||
return { |
||||
url: `${VUE_APP_API_URL}/upload/image`, |
||||
headers: { |
||||
Authorization: "Bearer " + this.$store.state.token |
||||
}, |
||||
id: 0, |
||||
orderInfo: {}, |
||||
reasonList: [], |
||||
reason: "", |
||||
refund_reason_wap_explain: "", |
||||
refund_reason_wap_img: [] |
||||
}; |
||||
imageuploaded(res) { |
||||
if (res.status !== 200) { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg|| err.response.data.message, |
||||
icon: 'none', |
||||
duration: 2000 |
||||
}); |
||||
return |
||||
} |
||||
this.refund_reason_wap_img.push(res.data.url); |
||||
}, |
||||
methods: { |
||||
changeReason(e) { |
||||
this.reason = this.reasonList[e.mp.detail.value]; |
||||
}, |
||||
imageuploaded(res) { |
||||
if (res.status !== 200) { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg|| err.response.data.message, |
||||
icon: 'none', |
||||
duration: 2000 |
||||
}); |
||||
return |
||||
} |
||||
this.refund_reason_wap_img.push(res.data.url); |
||||
}, |
||||
getOrderDetail() { |
||||
orderDetail(this.id) |
||||
.then(res => { |
||||
this.orderInfo = res.data; |
||||
getOrderDetail() { |
||||
uni.showLoading({ |
||||
title: '正在查询商品', |
||||
duration: 2000, |
||||
}) |
||||
orderDetail(this.id) |
||||
.then(res => { |
||||
this.orderInfo = res.data; |
||||
this.selectProduct = res.data.cartInfo.map(item => { |
||||
item.checked = false |
||||
return item |
||||
}) |
||||
.catch(err => { |
||||
if (res.data.cartInfo.length === 0) { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg|| err.response.data.message, |
||||
title: "订单无可售后商品", |
||||
icon: 'none', |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
}, |
||||
getRefundReason() { |
||||
getRefundReason().then(res => { |
||||
this.reasonList = res.data; |
||||
}); |
||||
}, |
||||
submit() { |
||||
const refund_reason_wap_explain = trim(this.refund_reason_wap_explain), |
||||
text = this.reason; |
||||
if (!text) { |
||||
return |
||||
} |
||||
uni.hideLoading() |
||||
}) |
||||
.catch(err => { |
||||
uni.hideLoading() |
||||
uni.showToast({ |
||||
title: "请选择退款原因", |
||||
title: err.msg || err.response.data.msg|| err.response.data.message, |
||||
icon: 'none', |
||||
duration: 2000 |
||||
}); |
||||
return |
||||
}); |
||||
}, |
||||
getRefundReason() { |
||||
getRefundReason().then(res => { |
||||
this.reasonList = res.data; |
||||
}); |
||||
}, |
||||
// 选择退款商品 |
||||
switchSelect (index) { |
||||
let isAll = true |
||||
this.selectProduct[index].checked = !this.selectProduct[index].checked |
||||
this.selectProduct.forEach(item => { |
||||
if (!item.checked) { |
||||
isAll = false |
||||
} |
||||
postOrderRefund({ |
||||
text, |
||||
uni: this.orderInfo.orderId, |
||||
refund_reason_wap_img: this.refund_reason_wap_img.join(","), |
||||
refund_reason_wap_explain |
||||
}) |
||||
.then(res => { |
||||
uni.showToast({ |
||||
title: res.msg, |
||||
icon: "success", |
||||
duration: 2000 |
||||
}); |
||||
setTimeout(() => { |
||||
this.$yrouter.back(); |
||||
}, 1500); |
||||
}) |
||||
this.isAllSelect = isAll |
||||
}, |
||||
// 全选 |
||||
allChecked () { |
||||
this.isAllSelect = !this.isAllSelect |
||||
this.selectProduct.forEach(item => { |
||||
item.checked = this.isAllSelect |
||||
}) |
||||
}, |
||||
// 选择退款类型 |
||||
chooseType (val) { |
||||
this.selectProduct = this.selectProduct.map(item => { |
||||
if (item.checked) { |
||||
this.productParamList.push({ |
||||
productId: item.productId |
||||
}) |
||||
.catch(err => { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg|| err.response.data.message, |
||||
icon: 'none', |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
} |
||||
console.log(item.costPrice) |
||||
this.totalMoney += parseFloat(item.truePrice) |
||||
this.totalNum += 1 |
||||
return item |
||||
} |
||||
}).filter(r => r) |
||||
this.selected = true; |
||||
this.serviceType = val; |
||||
}, |
||||
mounted() { |
||||
this.id = this.$yroute.query.id || 0; |
||||
this.getOrderDetail(); |
||||
this.getRefundReason(); |
||||
submit() { |
||||
const refund_reason_wap_explain = trim(this.refund_reason_wap_explain); |
||||
if (!this.reason) { |
||||
uni.showToast({ |
||||
title: "请选择退款原因", |
||||
icon: 'none', |
||||
duration: 2000 |
||||
}); |
||||
return |
||||
} |
||||
submitAfterSealsOrder({ |
||||
orderCode: this.orderInfo.orderId, |
||||
serviceType: this.serviceType, |
||||
reasonForApplication: this.reason, |
||||
applicationInstructions: refund_reason_wap_explain, |
||||
applicationDescriptionPicture: this.refund_reason_wap_img.join(","), |
||||
productParamList: this.productParamList |
||||
}).then(res => { |
||||
if (res.status === 200) { |
||||
uni.showToast({ |
||||
title: res.msg, |
||||
icon: "success", |
||||
duration: 2000 |
||||
}); |
||||
setTimeout(() => { |
||||
this.$yrouter.push({ path: '/pages/order/ReturnList/index' }); |
||||
}, 1500) |
||||
} |
||||
}) |
||||
.catch(err => { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg|| err.response.data.message, |
||||
icon: 'none', |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
} |
||||
}; |
||||
} |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.apply-return{ |
||||
.selectProduct{ |
||||
margin-bottom: 180rpx; |
||||
.selectContainer{ |
||||
padding: 20rpx 32rpx; |
||||
background-color: #FFF; |
||||
display: flex; |
||||
align-items: center; |
||||
.pictrue{ |
||||
.image{ |
||||
width: 180rpx; |
||||
height: 180rpx; |
||||
} |
||||
} |
||||
.content{ |
||||
width: 100%; |
||||
height: 100%; |
||||
margin-left: 16rpx; |
||||
font-size: 24rpx; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-between; |
||||
.title{ |
||||
width: 100%; |
||||
height: 80rpx; |
||||
text-overflow: ellipsis; |
||||
font-size: 28rpx; |
||||
} |
||||
.skus{ |
||||
display: flex; |
||||
justify-content: space-between; |
||||
color: #999999; |
||||
} |
||||
.money{ |
||||
margin-top: 10rpx; |
||||
display: flex; |
||||
view{ |
||||
color: #EB3729; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
.choose{ |
||||
width: 100%; |
||||
padding: 20rpx 30rpx; |
||||
background-color: #FFF; |
||||
position: fixed; |
||||
bottom: 0; |
||||
height: 180rpx; |
||||
.checkTotal{ |
||||
height: 80rpx; |
||||
font-size: 28rpx; |
||||
border-bottom: 2rpx solid #F3F4F5; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
.total{ |
||||
display: flex; |
||||
.proTotal{ |
||||
color: #666; |
||||
} |
||||
.moneyTotal{ |
||||
color: #333; |
||||
margin-left: 30rpx; |
||||
} |
||||
} |
||||
} |
||||
.typeBtn{ |
||||
margin-top: 10rpx; |
||||
display: flex; |
||||
justify-content: flex-end; |
||||
align-items: center; |
||||
.button{ |
||||
width: 160rpx; |
||||
height: 60rpx; |
||||
margin: 0 10rpx; |
||||
line-height: 60rpx; |
||||
text-align: center; |
||||
font-size: 24rpx; |
||||
border-radius: 180rpx; |
||||
} |
||||
.def{ |
||||
color: #AAAAAA; |
||||
border: 2rpx solid #DDDDDD; |
||||
} |
||||
.redBtn{ |
||||
color: #FFF; |
||||
background-color: #EB3729; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
||||
|
@ -0,0 +1,39 @@
|
||||
<template> |
||||
<view class="productList"> |
||||
<view class="goodsStyle acea-row row-between" |
||||
v-for="cart in list" |
||||
:key="cart.id" |
||||
> |
||||
<view class="pictrue"> |
||||
<image :src="cart.productInfo.image" class="image" /> |
||||
</view> |
||||
<view class="text acea-row row-between"> |
||||
<view class="name line2">{{ cart.productInfo.storeName }}</view> |
||||
<view class="money"> |
||||
<view> |
||||
¥{{ |
||||
cart.productInfo.attrInfo |
||||
? cart.productInfo.attrInfo.price |
||||
: cart.productInfo.price |
||||
}} |
||||
</view> |
||||
<view class="num">x{{ cart.cartNum }}</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
props: { |
||||
list: { |
||||
type: Array, |
||||
default: () => [] |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang="less"> |
||||
</style> |
@ -0,0 +1,334 @@
|
||||
<template> |
||||
<view class="returnList"> |
||||
<view class="data bgRed"> |
||||
<view v-if="orderDetail.salesState === 0"> |
||||
<view class="state" v-if="orderDetail.state === 0"> |
||||
已提交申请,请耐心等待卖家处理 |
||||
</view> |
||||
<view class="state" v-if="orderDetail.state === 1"> |
||||
<view class="state" v-if="orderDetail.serviceType === 0"> |
||||
已通过平台审核,正在退款 |
||||
</view> |
||||
<view class="state" v-if="orderDetail.serviceType === 1"> |
||||
已通过平台审核 ,请填写退货物流 |
||||
</view> |
||||
</view> |
||||
<view class="state" v-if="orderDetail.state === 2"> |
||||
已发货,等待商家审核 |
||||
</view> |
||||
<view class="state" v-if="orderDetail.state === 3"> |
||||
售后订单已完成 |
||||
</view> |
||||
</view> |
||||
<view v-if="orderDetail.salesState === 1"> |
||||
已撤销售后订单 |
||||
</view> |
||||
<view v-if="orderDetail.salesState === 2"> |
||||
商家已拒绝售后申请 |
||||
</view> |
||||
</view> |
||||
<!-- 退款总金额 --> |
||||
<view class="money"> |
||||
<view class="top"> |
||||
<text>退款总金额</text> |
||||
<text class="colorRed">¥{{ orderDetail.refundAmount || 0}}</text> |
||||
</view> |
||||
<view class="express" v-if="orderDetail.serviceType === 1"> |
||||
<view class="title">商家已同意退货申请,请尽快发货。</view> |
||||
<view class="info people"> |
||||
收货人: {{ orderDetail.consignee || '' }} |
||||
</view> |
||||
<view class="info address"> |
||||
收货地址: {{ orderDetail.address || '' }} |
||||
</view> |
||||
<view class="info phone"> |
||||
收货电话: {{ orderDetail.phoneNumber || '' }} |
||||
</view> |
||||
</view> |
||||
<!-- 退款信息 --> |
||||
<view class="tips" v-if="orderDetail.state === 0"> |
||||
<text class="title">您已成功发起退款申请,请耐心等待商家处理</text> |
||||
<view class="content"> |
||||
<view>· 卖家同意或超时未处理,系统将退款给您</view> |
||||
<view>· 如果卖家拒绝,您可以修改退款申请后再次发起,卖家会重新处理</view> |
||||
</view> |
||||
</view> |
||||
<!-- 撤销 --> |
||||
<!-- <view class="tips" v-if="orderDetail.serviceType === 1 && orderDetail.state >= 2"> |
||||
<text class="title">您已撤销售后申请</text> |
||||
<view class="content"> |
||||
<view>· </view> |
||||
<view>· </view> |
||||
</view> |
||||
</view> --> |
||||
<!-- 商家拒接 --> |
||||
<!-- <view class="tips" v-if="orderDetail.serviceType === 2 && orderDetail.state >= 2"> |
||||
<text class="title">卖家已拒绝</text> |
||||
<view class="content"> |
||||
<view>· </view> |
||||
<view>· </view> |
||||
</view> |
||||
</view> --> |
||||
<view class="bottom"> |
||||
<view class="btns redBtn" |
||||
v-if="orderDetail.salesState === 0 |
||||
&& orderDetail.serviceType === 1 |
||||
&& orderDetail.state === 1" |
||||
@click="toExpress" |
||||
>填写物流</view> |
||||
<view class="btns def" |
||||
v-if="orderDetail.salesState === 0" |
||||
@click="cancelReq" |
||||
>撤销申请</view> |
||||
<!-- <view class="btns redBtn" @click="editReq">修改申请</view>--> |
||||
</view> |
||||
</view> |
||||
<!-- 退款信息 --> |
||||
<view class="rebackInfo"> |
||||
<view class="top"> |
||||
退款信息 |
||||
</view> |
||||
<view class="rebackItem" |
||||
v-for="item in orderDetail.cartInfo" |
||||
:key="item.id" |
||||
> |
||||
<image class="img" :src="item.productInfo.image" mode=""></image> |
||||
<view class="info"> |
||||
<view class="productName"> |
||||
{{ item.productInfo.storeName }} |
||||
</view> |
||||
<view class="sku"> |
||||
{{ item.productInfo.attrInfo.sku }} |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="bottom"> |
||||
<view class="reason"> |
||||
<view class="left"> |
||||
退款原因: |
||||
</view> |
||||
<view class="right"> |
||||
{{ orderDetail.reasons || '' }} |
||||
</view> |
||||
</view> |
||||
<view class="reason"> |
||||
<view class="left"> |
||||
退款金额: |
||||
</view> |
||||
<view class="right"> |
||||
¥{{ orderDetail.refundAmount || 0 }} |
||||
</view> |
||||
</view> |
||||
<view class="reason"> |
||||
<view class="left"> |
||||
退款编号: |
||||
</view> |
||||
<view class="right"> |
||||
{{ orderDetail.id || '' }} |
||||
</view> |
||||
</view> |
||||
<view class="reason"> |
||||
<view class="left"> |
||||
申请时间: |
||||
</view> |
||||
<view class="right"> |
||||
{{ orderDetail.createTime || '' }} |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import{ |
||||
getAfterSealsDetail, |
||||
rebackAfterSeals |
||||
} from '@/api/aftersales.js'; |
||||
export default { |
||||
data() { |
||||
return { |
||||
orderId: '', |
||||
id: '', |
||||
orderInfo: {}, |
||||
orderDetail: {} |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.orderId = this.$yroute.query.key |
||||
this.id = this.$yroute.query.id |
||||
this.getReturnDetail() |
||||
}, |
||||
methods: { |
||||
/** state售后状态 0已提交等待平台审核 1平台已审核 等待用户发货/退款 2 用户已发货 3已完成 */ |
||||
async getReturnDetail() { |
||||
const res = await getAfterSealsDetail(this.orderId, this.id) |
||||
if (res.status === 200) { |
||||
this.orderDetail = res.data |
||||
} else { |
||||
uni.showToast({ |
||||
title: "订单异常", |
||||
icon: "none", |
||||
duration: 2000, |
||||
}); |
||||
} |
||||
}, |
||||
toExpress () { |
||||
this.$yrouter.push({ |
||||
path: '/pages/order/submitExpress/index', |
||||
query: { |
||||
orderCode: this.orderId |
||||
} |
||||
}) |
||||
}, |
||||
// 撤销申请 |
||||
async cancelReq() { |
||||
const res = await rebackAfterSeals(this.orderId, this.id) |
||||
if (res.status === 200) { |
||||
uni.showToast({ |
||||
title: "已撤销", |
||||
icon: "none", |
||||
duration: 2000, |
||||
}); |
||||
setTimeout(() => { |
||||
this.$yrouter.back(); |
||||
}, 1500) |
||||
} else { |
||||
uni.showToast({ |
||||
title: "撤销失败", |
||||
icon: "none", |
||||
duration: 2000, |
||||
}); |
||||
} |
||||
}, |
||||
// 修改申请 |
||||
editReq() {} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped lang='scss'> |
||||
$red: #EB3729; |
||||
.returnList{ |
||||
.colorRed{ |
||||
color: $red; |
||||
} |
||||
.bgRed{ |
||||
background-color: $red; |
||||
} |
||||
.data{ |
||||
width: 100%; |
||||
height: 150rpx; |
||||
line-height: 150rpx; |
||||
padding-left: 30rpx; |
||||
color: #FFF; |
||||
} |
||||
.money{ |
||||
background-color: #FFF; |
||||
.top{ |
||||
padding: 20rpx 30rpx; |
||||
font-size: 30rpx; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
border-bottom: 2rpx solid #F3F4F5; |
||||
} |
||||
.express{ |
||||
padding: 20rpx 30rpx; |
||||
font-size: 26rpx; |
||||
.title{ |
||||
color: #333333; |
||||
} |
||||
.info{ |
||||
color: #999999; |
||||
} |
||||
} |
||||
.tips{ |
||||
height: 160rpx; |
||||
padding: 20rpx 30rpx; |
||||
color: #999999; |
||||
border-bottom: 2rpx solid #F3F4F5; |
||||
font-size: 26rpx; |
||||
.title{ |
||||
overflow: hidden; |
||||
white-space: nowrap; |
||||
text-overflow: ellipsis; |
||||
} |
||||
.content{ |
||||
font-size: 20rpx; |
||||
} |
||||
} |
||||
.bottom{ |
||||
padding: 20rpx 30rpx; |
||||
display: flex; |
||||
justify-content: flex-end; |
||||
.btns{ |
||||
width: 160rpx; |
||||
height: 58rpx; |
||||
margin: 0 10rpx; |
||||
font-size: 24rpx; |
||||
text-align: center; |
||||
line-height: 58rpx; |
||||
border-radius: 180rpx; |
||||
} |
||||
.def{ |
||||
color: #DDDDDD; |
||||
border: 2rpx solid #DDDDDD; |
||||
} |
||||
.redBtn{ |
||||
color: #FFF; |
||||
background-color: $red; |
||||
} |
||||
} |
||||
} |
||||
.rebackInfo{ |
||||
padding: 0 30rpx; |
||||
background-color: #FFF; |
||||
.top{ |
||||
height: 80rpx; |
||||
margin: 20rpx 0; |
||||
line-height: 80rpx; |
||||
font-size: 30rpx; |
||||
font-weight: bold; |
||||
color: #333333; |
||||
border-bottom: 2rpx solid #F3F4F5; |
||||
} |
||||
.rebackItem{ |
||||
padding: 20rpx 0; |
||||
font-size: 28rpx; |
||||
display: flex; |
||||
border-bottom: 2rpx solid #F3F4F5; |
||||
.img{ |
||||
width: 120rpx; |
||||
height: 120rpx; |
||||
} |
||||
.info{ |
||||
margin-left: 16rpx; |
||||
flex: 1; |
||||
.productName{ |
||||
width: 100%; |
||||
height: 80rpx; |
||||
overflow: hidden; |
||||
text-overflow: ellipsis; |
||||
color: #333333; |
||||
} |
||||
.sku{ |
||||
font-size: 24rpx; |
||||
color: #CCCCCC; |
||||
} |
||||
} |
||||
} |
||||
.bottom{ |
||||
padding: 20rpx 0; |
||||
.reason{ |
||||
font-size: 28rpx; |
||||
color: #333333; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
.right{ |
||||
color: #AAAAAA; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,184 @@
|
||||
<!-- 售后列表内容 --> |
||||
<template> |
||||
<view class="productItem"> |
||||
<view class="title"> |
||||
<view class="shopName"> |
||||
订单号:{{ item.orderCode }} |
||||
</view> |
||||
</view> |
||||
<view class="content" v-for="(i, index) in item.cartInfo"> |
||||
<image class="img" |
||||
:src="i.productInfo.image" |
||||
mode="" |
||||
@click.stop="goGoodsCon(i)" |
||||
></image> |
||||
<view class="info"> |
||||
<view class="infoTitle"> |
||||
{{ i.productInfo.storeName }} |
||||
</view> |
||||
<view class="infoSku"> |
||||
<view class="sku"> |
||||
{{ i.productInfo.attrInfo.sku || '' }} |
||||
</view> |
||||
<view class="num"> |
||||
x {{ 1 }} |
||||
</view> |
||||
</view> |
||||
<view class="infoMoney"> |
||||
退款:<view class="red"> |
||||
¥{{ i.productInfo.price }} |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="money"> |
||||
<view class="status"> |
||||
<view v-if="item.salesState === 0"> |
||||
<view v-if="item.state === 0">商家处理中</view> |
||||
<view v-if="item.state === 1">售后中</view> |
||||
<view v-if="item.state === 2">等待商家收货</view> |
||||
<view v-if="item.state === 3">已完成</view> |
||||
</view> |
||||
<view v-if="item.salesState === 1"> |
||||
已撤销 |
||||
</view> |
||||
<view v-if="item.salesState === 2"> |
||||
商家拒绝 |
||||
</view> |
||||
</view> |
||||
<view class="refundMoney"> |
||||
退款:<view class="red"> |
||||
¥{{ item.refundAmount }} |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="btns"> |
||||
<view class="button def" |
||||
@click="toDetail" |
||||
v-if="item.state === 2" |
||||
>删除记录</view> |
||||
<view class="button redBtn" @click="toDetail(item)">查看详情</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
deleteAfterSeals |
||||
} from '@/api/aftersales.js' |
||||
export default { |
||||
props: { |
||||
item: { |
||||
type: Object, |
||||
default: () => ({}) |
||||
} |
||||
}, |
||||
methods:{ |
||||
// 跳转商品 |
||||
goGoodsCon(item) { |
||||
this.$yrouter.push({ |
||||
path: "/pages/shop/GoodsCon/index", |
||||
query: { id: item.productInfo.id } |
||||
}); |
||||
}, |
||||
// 跳转售后详情 |
||||
toDetail (item) { |
||||
console.log(item) |
||||
this.$yrouter.push({ |
||||
path: "/pages/order/OrderReturnDetail/index", |
||||
query: { |
||||
key: item.orderCode, |
||||
id: item.id |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.productItem{ |
||||
margin: 10rpx 0; |
||||
background-color: #FFF; |
||||
.title{ |
||||
height: 80rpx; |
||||
padding: 0 30rpx; |
||||
color: #333; |
||||
font-size: 28rpx; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
.content{ |
||||
padding: 20rpx 30rpx; |
||||
border: 2rpx solid #F3F4F5; |
||||
display: flex; |
||||
.img{ |
||||
width: 180rpx; |
||||
height: 180rpx; |
||||
} |
||||
.info{ |
||||
flex: 1; |
||||
margin-left: 16rpx; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: space-around; |
||||
.infoTitle{ |
||||
width: 100%; |
||||
height: 80rpx; |
||||
font-size: 28rpx; |
||||
color: #333333; |
||||
overflow: hidden; |
||||
text-overflow: ellipsis; |
||||
} |
||||
.infoSku{ |
||||
font-size: 24rpx; |
||||
color: #999999; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
} |
||||
.infoMoney{ |
||||
font-size: 24rpx; |
||||
} |
||||
} |
||||
} |
||||
.money{ |
||||
height: 80rpx; |
||||
padding: 0 30rpx; |
||||
font-size: 28rpx; |
||||
font-family: PingFang SC; |
||||
color: #333333; |
||||
border: 2rpx solid #F3F4F5; |
||||
display: flex; |
||||
justify-content: space-between; |
||||
align-items: center; |
||||
} |
||||
.btns{ |
||||
padding: 20rpx 30rpx; |
||||
display: flex; |
||||
justify-content: flex-end; |
||||
.button{ |
||||
width: 160rpx; |
||||
height: 58rpx; |
||||
margin: 0 10rpx; |
||||
border-radius: 180rpx; |
||||
font-size: 24rpx; |
||||
line-height: 54rpx; |
||||
text-align: center; |
||||
} |
||||
.def{ |
||||
color: #DDD; |
||||
border: 2rpx solid #DDDDDD; |
||||
} |
||||
.redBtn{ |
||||
color: #FFF; |
||||
background-color: #EB3729; |
||||
border: 2rpx solid #EB3729; |
||||
} |
||||
} |
||||
.red{ |
||||
display: inline-block; |
||||
color: #EB3729; |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,174 @@
|
||||
<!-- 提交物流 --> |
||||
<template> |
||||
<view class="submitExpress"> |
||||
<!-- 填写物流 --> |
||||
<view class="form"> |
||||
<picker class="picker" |
||||
:value="express" |
||||
:range="expressPicker" |
||||
@change="changeExpress" |
||||
> |
||||
<view class="item acea-row row-between-wrapper"> |
||||
<view class="title"> |
||||
<view class="point"> |
||||
* |
||||
</view> |
||||
物流公司 |
||||
</view> |
||||
<view class="num">{{ express }}</view> |
||||
<text class="iconfont icon-jiantou"></text> |
||||
</view> |
||||
</picker> |
||||
<view class="item"> |
||||
<view class="title"> |
||||
<view class="point"> |
||||
* |
||||
</view> |
||||
物流单号: |
||||
</view> |
||||
<input class="input" v-model="expressQuery.postalCode" placeholder="请输入物流单号" /> |
||||
</view> |
||||
</view> |
||||
<!-- 提交按钮 --> |
||||
<view class="btnContainer"> |
||||
<view class="addBtn" @click="addExpress"> |
||||
提交 |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import { |
||||
getExpressData, |
||||
addExpressData |
||||
} from '@/api/aftersales.js' |
||||
export default { |
||||
data () { |
||||
return { |
||||
expressQuery: { |
||||
code: '', // 快递公司编码 |
||||
name: '', // 快递公司名称 |
||||
postalCode: 'SF1213132132', // 快递编号 |
||||
orderCode: '' // 订单编号 |
||||
}, |
||||
expressList: [], |
||||
expressPicker: [], |
||||
express: '' |
||||
} |
||||
}, |
||||
mounted () { |
||||
this.expressQuery.orderCode = this.$yroute.query.orderCode |
||||
this.getExpress() |
||||
}, |
||||
methods: { |
||||
async getExpress () { |
||||
const res = await getExpressData() |
||||
console.log(res) |
||||
this.expressList = res.data.map(item => { |
||||
return { |
||||
id: item.id, |
||||
name: item.name, |
||||
code: item.code |
||||
} |
||||
}) |
||||
this.expressPicker = res.data.map(item => { |
||||
return item.name |
||||
}) |
||||
}, |
||||
changeExpress(e) { |
||||
this.express = this.expressPicker[e.mp.detail.value]; |
||||
this.expressQuery.code = this.expressList[e.mp.detail.value].code |
||||
this.expressQuery.name = this.expressList[e.mp.detail.value].name |
||||
}, |
||||
async addExpress () { |
||||
let errMsg = '请选择' |
||||
if (!this.expressQuery.code || !this.expressQuery.code) { |
||||
errMsg += ' 快递公司 ' |
||||
} |
||||
if (!this.expressQuery.postalCode) { |
||||
errMsg += ' 快递单号 ' |
||||
} |
||||
if (errMsg.length > 3) { |
||||
uni.showToast({ |
||||
title: errMsg, |
||||
icon: 'none', |
||||
duration: 2000, |
||||
}) |
||||
} |
||||
console.log(this.expressQuery) |
||||
const res = await addExpressData(this.expressQuery) |
||||
if (res.status === 200) { |
||||
uni.showToast({ |
||||
title: '物流填写成功!', |
||||
icon: 'none', |
||||
duration: 2000, |
||||
}) |
||||
this.$yrouter.push({ |
||||
path: '/pages/order/ReturnList/index' |
||||
}) |
||||
} else { |
||||
uni.showToast({ |
||||
title: '提交物流信息失败!', |
||||
icon: 'none', |
||||
duration: 2000, |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.submitExpress{ |
||||
.form{ |
||||
margin-bottom: 170rpx; |
||||
.picker{ |
||||
margin: 0; |
||||
padding: 0; |
||||
font-size: 28rpx; |
||||
color: #999999; |
||||
} |
||||
.item{ |
||||
width: 100%; |
||||
height: 80rpx; |
||||
padding: 0 32rpx; |
||||
line-height: 80rpx; |
||||
background-color: #FFF; |
||||
display: flex; |
||||
.title{ |
||||
font-size: 28rpx; |
||||
color: #333333; |
||||
display: flex; |
||||
.point{ |
||||
color: #EA3729; |
||||
} |
||||
} |
||||
.input{ |
||||
height: 80rpx; |
||||
line-height: 80rpx; |
||||
font-size: 28rpx; |
||||
color: #999999; |
||||
} |
||||
} |
||||
} |
||||
.btnContainer{ |
||||
width: 100%; |
||||
height: 170rpx; |
||||
background-color: #FFF; |
||||
box-shadow: 0px 0px 0px rgba(197, 202, 207, 0.5); |
||||
position: fixed; |
||||
bottom: 0; |
||||
.addBtn{ |
||||
height: 90rpx; |
||||
margin: 40rpx 30rpx; |
||||
line-height: 90rpx; |
||||
text-align: center; |
||||
border-radius: 50rpx; |
||||
font-size: 28rpx; |
||||
color: #FFF; |
||||
background: linear-gradient(90deg, #E93526 0%, #FF8E3C 100%); |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -0,0 +1,340 @@
|
||||
<template> |
||||
<view class="register absolute"> |
||||
<view class="whiteBg" v-if="formItem === 1"> |
||||
<view class="title acea-row"> |
||||
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" |
||||
@click="navTap(index)" :key="index">{{ item }}</view> |
||||
</view> |
||||
<view class="list" :hidden="current !== 0"> |
||||
<form @submit.prevent="submit"> |
||||
<view class="item"> |
||||
<view class="acea-row row-between-wrapper"> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-phone_" /> |
||||
</svg>--> |
||||
<input type="text" placeholder="输入手机号码" v-model="account" required /> |
||||
</view> |
||||
</view> |
||||
<view class="item"> |
||||
<view class="acea-row row-between-wrapper"> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-code_" /> |
||||
</svg>--> |
||||
<input type="password" placeholder="填写登录密码" v-model="password" required /> |
||||
</view> |
||||
</view> |
||||
</form> |
||||
</view> |
||||
<view class="list" :hidden="current !== 1"> |
||||
<view class="item"> |
||||
<view class="acea-row row-between-wrapper"> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-phone_" /> |
||||
</svg>--> |
||||
<input type="text" placeholder="输入手机号码" v-model="account" /> |
||||
</view> |
||||
</view> |
||||
<view class="item"> |
||||
<view class="align-left"> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-code_1" /> |
||||
</svg>--> |
||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> |
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" |
||||
@click="code">{{ text }}</button> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
<view class="logon" @click="loginMobile" :hidden="current !== 1">登录</view> |
||||
<view class="logon" @click="submit" :hidden="current === 1">登录</view> |
||||
<view class="tip"> |
||||
没有账号? |
||||
<text @click="formItem = 2" class="font-color-red">立即注册</text> |
||||
</view> |
||||
</view> |
||||
<!-- 注册 --> |
||||
<view class="whiteBg" v-else> |
||||
<view class="title acea-row row-between-wrapper"> |
||||
<view class="item on">注册账号</view> |
||||
</view> |
||||
<view class="list"> |
||||
<view class="item"> |
||||
<view> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-phone_" /> |
||||
</svg>--> |
||||
<input name="account" type="text" placeholder="输入手机号码" v-model="account" /> |
||||
</view> |
||||
</view> |
||||
<view class="item"> |
||||
<view class="align-left"> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-code_1" /> |
||||
</svg>--> |
||||
<input name="verifyCode" type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> |
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" |
||||
@click="code">{{ text }}</button> |
||||
</view> |
||||
</view> |
||||
<view class="item"> |
||||
<view> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-code_" /> |
||||
</svg>--> |
||||
<input name="password" type="password" placeholder="填写您的登录密码" v-model="password" /> |
||||
</view> |
||||
</view> |
||||
<!-- #ifndef H5 --> |
||||
<view class="item"> |
||||
<view> |
||||
<!-- <svg class="icon" aria-hidden="true"> |
||||
<use xlink:href="#icon-phone_" /> |
||||
</svg>--> |
||||
<input name="inviteCode" type="text" placeholder="输入邀请码" v-model="inviteCode" /> |
||||
</view> |
||||
</view> |
||||
<!-- #endif --> |
||||
|
||||
</view> |
||||
<view class="logon" @click="register">注册</view> |
||||
<view class="tip"> |
||||
已有账号? |
||||
<text @click="formItem = 1" class="font-color-red">立即登录</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
<script> |
||||
import sendVerifyCode from "@/mixins/SendVerifyCode"; |
||||
import { |
||||
login, |
||||
loginMobile, |
||||
registerVerify, |
||||
register |
||||
} from "@/api/user"; |
||||
import attrs, { |
||||
required, |
||||
alpha_num, |
||||
chs_phone |
||||
} from "@/utils/validate"; |
||||
import { |
||||
validatorDefaultCatch |
||||
} from "@/utils/dialog"; |
||||
import dayjs from "dayjs"; |
||||
import cookie from "@/utils/store/cookie"; |
||||
|
||||
import { |
||||
handleGetUserInfo |
||||
} from "@/utils"; |
||||
|
||||
const BACK_URL = "login_back_url"; |
||||
|
||||
export default { |
||||
name: "Login", |
||||
mixins: [sendVerifyCode], |
||||
data: function () { |
||||
return { |
||||
navList: ["账号登录", "修改密码"], |
||||
current: 0, |
||||
account: "", |
||||
password: "", |
||||
captcha: "", |
||||
inviteCode: "", |
||||
formItem: 1, |
||||
type: "login" |
||||
}; |
||||
}, |
||||
methods: { |
||||
async loginMobile() { |
||||
var that = this; |
||||
const { |
||||
account, |
||||
captcha |
||||
} = that; |
||||
try { |
||||
await that |
||||
.$validator({ |
||||
account: [ |
||||
required(required.message("手机号码")), |
||||
chs_phone(chs_phone.message()) |
||||
], |
||||
captcha: [ |
||||
required(required.message("验证码")), |
||||
alpha_num(alpha_num.message("验证码")) |
||||
] |
||||
}) |
||||
.validate({ |
||||
account, |
||||
captcha |
||||
}); |
||||
} catch (e) { |
||||
return validatorDefaultCatch(e); |
||||
} |
||||
loginMobile({ |
||||
phone: that.account, |
||||
captcha: that.captcha, |
||||
spread: cookie.get("spread") |
||||
}) |
||||
.then(res => { |
||||
var data = res.data; |
||||
that.$store.commit("login", data.token, dayjs(data.expires_time)); |
||||
handleGetUserInfo(); |
||||
}) |
||||
.catch(err => { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg || err.response.data.message, |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
}, |
||||
async register() { |
||||
var that = this; |
||||
const { |
||||
account, |
||||
captcha, |
||||
password |
||||
} = that; |
||||
try { |
||||
await that |
||||
.$validator({ |
||||
account: [ |
||||
required(required.message("手机号码")), |
||||
chs_phone(chs_phone.message()) |
||||
], |
||||
captcha: [ |
||||
required(required.message("验证码")), |
||||
alpha_num(alpha_num.message("验证码")) |
||||
], |
||||
password: [ |
||||
required(required.message("密码")), |
||||
attrs.range([6, 16], attrs.range.message("密码")), |
||||
alpha_num(alpha_num.message("密码")) |
||||
] |
||||
}) |
||||
.validate({ |
||||
account, |
||||
captcha, |
||||
password |
||||
}); |
||||
} catch (e) { |
||||
return validatorDefaultCatch(e); |
||||
} |
||||
register({ |
||||
account: that.account, |
||||
captcha: that.captcha, |
||||
password: that.password, |
||||
inviteCode: that.inviteCode, |
||||
spread: cookie.get("spread") |
||||
}) |
||||
.then(res => { |
||||
uni.showToast({ |
||||
title: res.msg, |
||||
icon: "success", |
||||
duration: 2000 |
||||
}); |
||||
that.formItem = 1; |
||||
}) |
||||
.catch(err => { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg || err.response.data.message, |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
}, |
||||
async code() { |
||||
var that = this; |
||||
const { |
||||
account |
||||
} = that; |
||||
try { |
||||
await that |
||||
.$validator({ |
||||
account: [ |
||||
required(required.message("手机号码")), |
||||
chs_phone(chs_phone.message()) |
||||
] |
||||
}) |
||||
.validate({ |
||||
account |
||||
}); |
||||
} catch (e) { |
||||
return validatorDefaultCatch(e); |
||||
} |
||||
if (that.formItem == 2) that.type = "register"; |
||||
await registerVerify({ |
||||
phone: that.account, |
||||
type: that.type |
||||
}) |
||||
.then(res => { |
||||
uni.showToast({ |
||||
title: res.msg, |
||||
icon: "success", |
||||
duration: 2000 |
||||
}); |
||||
that.sendCode(); |
||||
}) |
||||
.catch(err => { |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg || err.response.data.message, |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
}, |
||||
navTap: function (index) { |
||||
this.current = index; |
||||
}, |
||||
async submit() { |
||||
const { |
||||
account, |
||||
password |
||||
} = this; |
||||
try { |
||||
await this.$validator({ |
||||
account: [ |
||||
required(required.message("账号")), |
||||
attrs.range([5, 16], attrs.range.message("账号")), |
||||
alpha_num(alpha_num.message("账号")) |
||||
], |
||||
password: [ |
||||
required(required.message("密码")), |
||||
attrs.range([6, 16], attrs.range.message("密码")), |
||||
alpha_num(alpha_num.message("密码")) |
||||
] |
||||
}).validate({ |
||||
account, |
||||
password |
||||
}); |
||||
} catch (e) { |
||||
return validatorDefaultCatch(e); |
||||
} |
||||
login({ |
||||
username: account, |
||||
password, |
||||
spread: cookie.get("spread") |
||||
}) |
||||
.then(({ data }) => { |
||||
this.$store.commit("login", data.token, dayjs(data.expires_time)); |
||||
handleGetUserInfo(); |
||||
// let replace=this.$yroute.query.replace |
||||
// if(replace){ |
||||
|
||||
// } |
||||
// this.$yrouter.replace({ |
||||
// path: this.$yroute.query.replace || '/pages/home/index' |
||||
// }); |
||||
}) |
||||
.catch(err => { |
||||
console.log(err); |
||||
uni.showToast({ |
||||
title: err.msg || err.response.data.msg || err.response.data.message, |
||||
icon: "none", |
||||
duration: 2000 |
||||
}); |
||||
}); |
||||
} |
||||
} |
||||
}; |
||||
</script> |
Loading…
Reference in new issue