|
@@ -8,7 +8,8 @@
|
|
<view class="one_2">
|
|
<view class="one_2">
|
|
<view class="list" v-for="(item,index) in info.goods" :key="index">
|
|
<view class="list" v-for="(item,index) in info.goods" :key="index">
|
|
<view class="list_1">
|
|
<view class="list_1">
|
|
- <image class="image" :src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''" mode="">
|
|
|
|
|
|
+ <image class="image"
|
|
|
|
+ :src="item.goods.file&&item.goods.file.length>0?item.goods.file[0].url:''" mode="">
|
|
</image>
|
|
</image>
|
|
</view>
|
|
</view>
|
|
<view class="list_2">
|
|
<view class="list_2">
|
|
@@ -36,10 +37,39 @@
|
|
<view class="two_1" v-if="status=='3'">
|
|
<view class="two_1" v-if="status=='3'">
|
|
<uni-forms ref="thrform" :rules="thrrules" :model="thrform" label-width="auto">
|
|
<uni-forms ref="thrform" :rules="thrrules" :model="thrform" label-width="auto">
|
|
<uni-forms-item label="售后商品" name="goods_id">
|
|
<uni-forms-item label="售后商品" name="goods_id">
|
|
- <picker class="picker" mode="selector" :range="info.goods" @change="goodsChange" range-key="goods_name">
|
|
|
|
|
|
+ <picker class="picker" mode="selector" :range="info.goods" @change="goodsChange"
|
|
|
|
+ range-key="goods_name">
|
|
<view>{{thrform.goods_name||'请选择退款商品'}}</view>
|
|
<view>{{thrform.goods_name||'请选择退款商品'}}</view>
|
|
</picker>
|
|
</picker>
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
|
|
+ <uni-forms-item label="售后类型" name="type">
|
|
|
|
+ <picker class="picker" mode="selector" :range="typeList" @change="typeChange"
|
|
|
|
+ range-key="label">
|
|
|
|
+ <view>{{thrform.type_name||'请选择售后类型'}}</view>
|
|
|
|
+ </picker>
|
|
|
|
+ </uni-forms-item>
|
|
|
|
+ <uni-forms-item label="退款金额" name="money" v-if="thrform.type=='0'||thrform.type=='1'">
|
|
|
|
+ <uni-easyinput type="digit" v-model="thrform.money" @input="toMoney"
|
|
|
|
+ placeholder="请输入退款金额" />
|
|
|
|
+ <view>
|
|
|
|
+ 最大退款金额不能超过{{moneyInfo.payTotal||0}}
|
|
|
|
+ </view>
|
|
|
|
+ </uni-forms-item>
|
|
|
|
+ <uni-forms-item label="申请理由" name="reason">
|
|
|
|
+ <picker class="picker" mode="selector" :range="reasonList" @change="reasonChange"
|
|
|
|
+ range-key="label">
|
|
|
|
+ <view>{{thrform.reason_name||'请选择申请理由'}}</view>
|
|
|
|
+ </picker>
|
|
|
|
+ </uni-forms-item>
|
|
|
|
+ <uni-forms-item label="申请售后描述" name="desc">
|
|
|
|
+ <uni-easyinput type="textarea" v-model="thrform.desc" placeholder="请输入申请售后描述" />
|
|
|
|
+ </uni-forms-item>
|
|
|
|
+ <uni-forms-item label="附件" name="icon">
|
|
|
|
+ <upload :list="icon" name="icon" :count="1" @uplSuc="uplSuc" @uplDel="uplDel"></upload>
|
|
|
|
+ </uni-forms-item>
|
|
|
|
+ <view class="btn">
|
|
|
|
+ <button type="primary" size="mini" @click="onSubmit('form')">提交保存</button>
|
|
|
|
+ </view>
|
|
</uni-forms>
|
|
</uni-forms>
|
|
</view>
|
|
</view>
|
|
<view class="two_2" v-else>
|
|
<view class="two_2" v-else>
|
|
@@ -58,8 +88,11 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+ import upload from '@/components/upload/index.vue';
|
|
export default {
|
|
export default {
|
|
- components: {},
|
|
|
|
|
|
+ components: {
|
|
|
|
+ upload
|
|
|
|
+ },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
id: '',
|
|
id: '',
|
|
@@ -80,16 +113,42 @@
|
|
},
|
|
},
|
|
// 已收到货
|
|
// 已收到货
|
|
thrform: {},
|
|
thrform: {},
|
|
- thrrules: {}
|
|
|
|
|
|
+ thrrules: {},
|
|
|
|
+ // 售后类型
|
|
|
|
+ typeList: [],
|
|
|
|
+ // 申请理由
|
|
|
|
+ reasonList: [],
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onLoad: async function(e) {
|
|
onLoad: async function(e) {
|
|
const that = this;
|
|
const that = this;
|
|
that.$set(that, `id`, e && e.id || '636221e5e25ed78601dd4fbb');
|
|
that.$set(that, `id`, e && e.id || '636221e5e25ed78601dd4fbb');
|
|
that.$set(that, `status`, e && e.status || '3');
|
|
that.$set(that, `status`, e && e.status || '3');
|
|
- that.watchLogin();
|
|
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ await that.searchOther();
|
|
|
|
+ // 监听用户登录
|
|
|
|
+ await that.watchLogin();
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
|
|
+ // 查询其他信息
|
|
|
|
+ async searchOther() {
|
|
|
|
+ const that = this;
|
|
|
|
+ let res;
|
|
|
|
+ res = await that.$api(`/dictData`, 'GET', {
|
|
|
|
+ code: "afterSale_type"
|
|
|
|
+ });
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ let type = res.data.filter((i) => i.value !== '4' || i.value !== '5');
|
|
|
|
+ console.log(type);
|
|
|
|
+ that.$set(that, `typeList`, type)
|
|
|
|
+ }
|
|
|
|
+ res = await that.$api(`/dictData`, 'GET', {
|
|
|
|
+ code: "afterSale_reason"
|
|
|
|
+ });
|
|
|
|
+ if (res.errcode == '0') {
|
|
|
|
+ that.$set(that, `reasonList`, res.data)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
watchLogin() {
|
|
watchLogin() {
|
|
const that = this;
|
|
const that = this;
|
|
uni.getStorage({
|
|
uni.getStorage({
|
|
@@ -100,6 +159,12 @@
|
|
that.$set(that, `user`, user);
|
|
that.$set(that, `user`, user);
|
|
that.search();
|
|
that.search();
|
|
}
|
|
}
|
|
|
|
+ },
|
|
|
|
+ fail: function() {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: `/pages/login/index`
|
|
|
|
+ })
|
|
|
|
+
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
@@ -109,7 +174,6 @@
|
|
console.log(id);
|
|
console.log(id);
|
|
let res = await that.$api(`/orderDetail/${id}`, 'GET')
|
|
let res = await that.$api(`/orderDetail/${id}`, 'GET')
|
|
if (res.errcode == '0') {
|
|
if (res.errcode == '0') {
|
|
- console.log(res.data);
|
|
|
|
for (let val of res.data.goods) val.goods_name = val.goods.name;
|
|
for (let val of res.data.goods) val.goods_name = val.goods.name;
|
|
that.$set(that, `info`, res.data)
|
|
that.$set(that, `info`, res.data)
|
|
} else {
|
|
} else {
|
|
@@ -124,15 +188,80 @@
|
|
goodsChange(e) {
|
|
goodsChange(e) {
|
|
const that = this;
|
|
const that = this;
|
|
let data = that.info.goods[e.detail.value];
|
|
let data = that.info.goods[e.detail.value];
|
|
- console.log(data);
|
|
|
|
|
|
+ if (data) that.$set(that.info, `goods`, [data])
|
|
|
|
+ that.$set(that.thrform, `goods_name`, data.goods_name);
|
|
|
|
+ },
|
|
|
|
+ // 选择售后类型
|
|
|
|
+ async typeChange(e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let data = that.typeList[e.detail.value];
|
|
|
|
+ if (data) {
|
|
|
|
+ that.$set(that.form, `type`, data.value);
|
|
|
|
+ that.$set(that.form, `type_name`, data.label);
|
|
|
|
+ }
|
|
|
|
+ if (data.value != '2') {
|
|
|
|
+ const arr = await that.$api(`/afterSale/cgfr`, 'POST', {
|
|
|
|
+ order_detail: that.id,
|
|
|
|
+ goods_id: that.info._id
|
|
|
|
+ });
|
|
|
|
+ if (arr.errcode == '0') {
|
|
|
|
+ that.$set(that, `moneyInfo`, arr.data);
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: arr.errmsg,
|
|
|
|
+ icon: 'none',
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ // 选择申请理由
|
|
|
|
+ reasonChange(e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let data = that.reasonList[e.detail.value];
|
|
|
|
+ if (data) {
|
|
|
|
+ that.$set(that.thrform, `reason`, data.value);
|
|
|
|
+ that.$set(that.thrform, `reason_name`, data.label);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 退款金额
|
|
|
|
+ toMoney(value) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let money = that.moneyInfo.payTotal;
|
|
|
|
+ if (parseFloat(value) > parseFloat(money)) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '输入金额不能超过实际支付金额',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 图片上传
|
|
|
|
+ uplSuc(e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ that.$set(that, `${e.name}`, [...that[e.name], e.data]);
|
|
|
|
+ },
|
|
|
|
+ // 图片删除
|
|
|
|
+ uplDel(e) {
|
|
|
|
+ const that = this;
|
|
|
|
+ let data = that[e.name];
|
|
|
|
+ let arr = data.filter((i, index) => index != e.data.index);
|
|
|
|
+ that.$set(that, `${e.name}`, arr)
|
|
},
|
|
},
|
|
// 提交保存
|
|
// 提交保存
|
|
async onSubmit(ref) {
|
|
async onSubmit(ref) {
|
|
const that = this;
|
|
const that = this;
|
|
let status = that.status;
|
|
let status = that.status;
|
|
|
|
+ let money = that.moneyInfo.payTotal;
|
|
that.$refs[ref].validate().then(params => {
|
|
that.$refs[ref].validate().then(params => {
|
|
if (status == '3') {
|
|
if (status == '3') {
|
|
- console.log('1');
|
|
|
|
|
|
+ if (parseFloat(params.money) > parseFloat(money)) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '输入金额不能超过实际支付金额',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ console.log(params);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
that.orderCancel(params)
|
|
that.orderCancel(params)
|
|
}
|
|
}
|
|
@@ -241,7 +370,17 @@
|
|
border-radius: 5px;
|
|
border-radius: 5px;
|
|
padding: 2vw;
|
|
padding: 2vw;
|
|
|
|
|
|
- .two_1 {}
|
|
|
|
|
|
+ .two_1 {
|
|
|
|
+ .picker {
|
|
|
|
+ border: 1px solid #3333;
|
|
|
|
+ border-radius: 5px;
|
|
|
|
+ padding: 2vw;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ .btn {
|
|
|
|
+ text-align: center;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
.two_2 {
|
|
.two_2 {
|
|
.btn {
|
|
.btn {
|