|
@@ -22,7 +22,7 @@
|
|
|
<view class="btns">
|
|
|
<u-button type="warning" text="分享好友" class="share" open-type="share"></u-button>
|
|
|
<u-button type="error" text="立即联系" class="contact" @click="toContact" v-if="!isMine"></u-button>
|
|
|
- <u-button type="primary" text="立即购买" class="buy" @click="toBuy" v-if="!isMine && detail.amount" :disabled="detail.status === 4"></u-button>
|
|
|
+ <u-button type="primary" text="立即购买" class="buy" @click="toBuy" v-if="!isMine || detail.amount || detail.status === 4"></u-button>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
@@ -96,7 +96,7 @@
|
|
|
<template slot="footer">
|
|
|
<view class="bottom-container">
|
|
|
<u-button text="留言" type="primary" shape="circle" @click="openRemark()"></u-button>
|
|
|
- <u-button text="操作" type="primary" shape="circle" @click="isShowActionDialog = true" v-if="isMine"></u-button>
|
|
|
+ <u-button text="操作" type="primary" shape="circle" @click="isShowActionDialog = true" v-if="isMine && detail.status !== 4"></u-button>
|
|
|
</view>
|
|
|
</template>
|
|
|
</zj-page-layout>
|
|
@@ -160,12 +160,7 @@
|
|
|
errorText: '',
|
|
|
refresherTriggered: false,
|
|
|
isShowRemarkDialog: false,
|
|
|
- actionList: [
|
|
|
- {name: '已卖出', value: 1},
|
|
|
- {name: '下架', value: 2},
|
|
|
- {name: '重新上架', value: 3},
|
|
|
- {name: '编辑', value: 4},
|
|
|
- ],
|
|
|
+ actionList: [],
|
|
|
isShowActionDialog: false,
|
|
|
replyId: '',
|
|
|
|
|
@@ -222,6 +217,20 @@
|
|
|
}).then(res => {
|
|
|
this.detail = res.data;
|
|
|
this.loadStatus = 0;
|
|
|
+
|
|
|
+ let actionList = [
|
|
|
+ {name: '已卖出', value: 1},
|
|
|
+ {name: '上架', value: 2},
|
|
|
+ {name: '下架', value: 3},
|
|
|
+ {name: '重新上架', value: 4},
|
|
|
+ {name: '编辑', value: 5},
|
|
|
+ ]
|
|
|
+ if(this.detail.status === 1) {
|
|
|
+ actionList.splice(1, 1);
|
|
|
+ }else if(this.detail.status === 0) {
|
|
|
+ actionList.splice(2, 1);
|
|
|
+ }
|
|
|
+ this.actionList = actionList;
|
|
|
}).catch(res => {
|
|
|
this.errorText = res.message;
|
|
|
this.loadStatus = 2;
|
|
@@ -333,13 +342,18 @@
|
|
|
|
|
|
selectAction(e) {
|
|
|
// 已卖出/下架
|
|
|
- if(e.value === 1 || e.value === 2) {
|
|
|
+ if(~[1,2,3].indexOf(e.value)) {
|
|
|
+ const statusMap = {
|
|
|
+ 1: 4, // 已卖出
|
|
|
+ 2: 1, // 上架
|
|
|
+ 3: 0, // 下架
|
|
|
+ }
|
|
|
this.$modal({
|
|
|
content: `确定要${e.name}吗?`
|
|
|
}).then(() => {
|
|
|
this.$api.post('/goods/upOrDel', {
|
|
|
id: this.id,
|
|
|
- status: e.value === 1 ? 4 : 0,
|
|
|
+ status: statusMap[e.value],
|
|
|
}).then(res => {
|
|
|
this.$successToast();
|
|
|
this.getDetail();
|
|
@@ -347,7 +361,7 @@
|
|
|
}).catch(() => {})
|
|
|
}
|
|
|
// 重新上架
|
|
|
- else if(e.value === 3) {
|
|
|
+ else if(e.value === 4) {
|
|
|
uni.setStorageSync('issuePageParam', {
|
|
|
goodsId: this.id,
|
|
|
type: 1
|
|
@@ -357,7 +371,7 @@
|
|
|
}, 'switchTab')
|
|
|
}
|
|
|
// 编辑
|
|
|
- else if(e.value === 4) {
|
|
|
+ else if(e.value === 5) {
|
|
|
uni.setStorageSync('issuePageParam', {
|
|
|
goodsId: this.id,
|
|
|
type: 2
|