|
@@ -80,21 +80,66 @@
|
|
|
<view class="limit-buy-wrap">
|
|
<view class="limit-buy-wrap">
|
|
|
<tui-list-cell class="line-cell limit-buy-line" :hover="false">
|
|
<tui-list-cell class="line-cell limit-buy-line" :hover="false">
|
|
|
<view class="tui-title">每人限购</view>
|
|
<view class="tui-title">每人限购</view>
|
|
|
- <input v-model="form.limitBuy" style="width:160upx;" @focus="form.limitBuy=''" placeholder-class="phcolor" class="tui-input" name="limitBuy" placeholder="0不限购" maxlength="50" type="number" />
|
|
|
|
|
|
|
+ <input v-model="form.limitBuy" style="width:105upx;" @focus="form.limitBuy=''" placeholder-class="phcolor" class="tui-input" name="limitBuy" placeholder="0不限购" maxlength="50" type="number" />
|
|
|
|
|
|
|
|
- <button v-if="productData.id > 0 && form.limitBuy>0" class="admin-button-com blue middle" @click.stop="clearBuyCache()" style="width:150upx;">清已购</button>
|
|
|
|
|
- <button v-else class="admin-button-com default middle" style="width:150upx;" @click.stop="">清已购</button>
|
|
|
|
|
|
|
+ <button v-if="productData.id > 0" class="admin-button-com blue middle" @click.stop="clearBuyCache()" style="width:150upx;">清已购</button>
|
|
|
<button v-if="productData.id > 0" class="admin-button-com blue middle" style="width:180upx;margin-left:10upx;" @click.stop="hasBuyList">已购列表</button>
|
|
<button v-if="productData.id > 0" class="admin-button-com blue middle" style="width:180upx;margin-left:10upx;" @click.stop="hasBuyList">已购列表</button>
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
<tui-list-cell v-if="showClearTime" class="line-cell limit-buy-line" :hover="false">
|
|
<tui-list-cell v-if="showClearTime" class="line-cell limit-buy-line" :hover="false">
|
|
|
- <view class="tui-title">清空时间</view>
|
|
|
|
|
- <datetime-picker
|
|
|
|
|
- v-model="form.limitBuyClearTime"
|
|
|
|
|
- type="datetime"
|
|
|
|
|
- return-type="string"
|
|
|
|
|
- class="limit-time-picker"
|
|
|
|
|
- placeholder="留空则不自动清空"
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <view class="tui-title" style="width:150upx;">清除方式</view>
|
|
|
|
|
+ <radio-group class="tui-input limit-clear-radio" @change="limitBuyClearTypeChange">
|
|
|
|
|
+ <label class="list" for="limitClearNone">
|
|
|
|
|
+ <radio id="limitClearNone" value="0" :checked="form.limitBuyClearType == 0" style="transform:scale(0.87,0.87)" />
|
|
|
|
|
+ <text class="checkbox-text">不清除</text>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <label class="list" for="limitClearCycle">
|
|
|
|
|
+ <radio id="limitClearCycle" value="1" :checked="form.limitBuyClearType == 1" style="transform:scale(0.87,0.87)" />
|
|
|
|
|
+ <text class="checkbox-text">循环</text>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <label class="list" for="limitClearTiming">
|
|
|
|
|
+ <radio id="limitClearTiming" value="2" :checked="form.limitBuyClearType == 2" style="transform:scale(0.87,0.87)" />
|
|
|
|
|
+ <text class="checkbox-text">定时</text>
|
|
|
|
|
+ </label>
|
|
|
|
|
+ <input v-model="form.limitBuyClearType" name="limitBuyClearType" hidden />
|
|
|
|
|
+ </radio-group>
|
|
|
|
|
+ </tui-list-cell>
|
|
|
|
|
+ <tui-list-cell v-if="showClearTime && form.limitBuyClearType != 0" class="line-cell limit-buy-line" :hover="false">
|
|
|
|
|
+ <template v-if="form.limitBuyClearType == 1">
|
|
|
|
|
+ <view class="tui-title">清空时间</view>
|
|
|
|
|
+ <view class="limit-clear-cycle-row">
|
|
|
|
|
+ <text class="limit-clear-cycle-text">每隔</text>
|
|
|
|
|
+ <picker
|
|
|
|
|
+ mode="selector"
|
|
|
|
|
+ :range="limitBuyClearCycleList"
|
|
|
|
|
+ :value="limitBuyClearCycleIndex"
|
|
|
|
|
+ @change="limitBuyClearCycleChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="limit-picker-value">{{ limitBuyClearCycleText }}</view>
|
|
|
|
|
+ </picker>
|
|
|
|
|
+ <text class="limit-clear-cycle-text">在</text>
|
|
|
|
|
+ <picker
|
|
|
|
|
+ mode="selector"
|
|
|
|
|
+ :range="limitBuyClearHourList"
|
|
|
|
|
+ :value="limitBuyClearHourIndex"
|
|
|
|
|
+ @change="limitBuyClearHourChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <view class="limit-picker-value">{{ limitBuyClearHourText }}</view>
|
|
|
|
|
+ </picker>
|
|
|
|
|
+ <text class="limit-clear-cycle-text">清空</text>
|
|
|
|
|
+ </view>
|
|
|
|
|
+ <input v-model="form.limitBuyClearIntervalDays" name="limitBuyClearIntervalDays" hidden />
|
|
|
|
|
+ <input v-model="form.cleartAt" name="cleartAt" hidden />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template v-else>
|
|
|
|
|
+ <view class="tui-title">清空时间</view>
|
|
|
|
|
+ <datetime-picker
|
|
|
|
|
+ v-model="form.limitBuyClearTime"
|
|
|
|
|
+ type="datetime"
|
|
|
|
|
+ return-type="string"
|
|
|
|
|
+ class="limit-time-picker"
|
|
|
|
|
+ placeholder="留空则不自动清空"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
</tui-list-cell>
|
|
</tui-list-cell>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
@@ -537,6 +582,9 @@ export default {
|
|
|
cover: "",
|
|
cover: "",
|
|
|
images: [],
|
|
images: [],
|
|
|
limitBuy:0,
|
|
limitBuy:0,
|
|
|
|
|
+ limitBuyClearType:1,
|
|
|
|
|
+ limitBuyClearIntervalDays:1,
|
|
|
|
|
+ cleartAt:0,
|
|
|
limitBuyClearTime:'',
|
|
limitBuyClearTime:'',
|
|
|
limitBuyExceedType:1,
|
|
limitBuyExceedType:1,
|
|
|
stockWarning:5,
|
|
stockWarning:5,
|
|
@@ -583,7 +631,9 @@ export default {
|
|
|
printFocus:false,
|
|
printFocus:false,
|
|
|
partAcceptItem:0,
|
|
partAcceptItem:0,
|
|
|
partAcceptItemName:'',
|
|
partAcceptItemName:'',
|
|
|
- partAcceptItemModify:0
|
|
|
|
|
|
|
+ partAcceptItemModify:0,
|
|
|
|
|
+ limitBuyClearCycleList: Array.from({ length: 30 }, (item, index) => `${index + 1}天`),
|
|
|
|
|
+ limitBuyClearHourList: Array.from({ length: 24 }, (item, index) => `${index}点`)
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
computed:{
|
|
computed:{
|
|
@@ -593,6 +643,20 @@ export default {
|
|
|
},
|
|
},
|
|
|
showClearTime() {
|
|
showClearTime() {
|
|
|
return Number(this.form.limitBuy) > 0;
|
|
return Number(this.form.limitBuy) > 0;
|
|
|
|
|
+ },
|
|
|
|
|
+ limitBuyClearCycleIndex() {
|
|
|
|
|
+ const cycle = Number(this.form.limitBuyClearIntervalDays) || 1;
|
|
|
|
|
+ return Math.max(0, Math.min(cycle - 1, this.limitBuyClearCycleList.length - 1));
|
|
|
|
|
+ },
|
|
|
|
|
+ limitBuyClearHourIndex() {
|
|
|
|
|
+ const hour = Number(this.form.cleartAt) || 0;
|
|
|
|
|
+ return Math.max(0, Math.min(hour, this.limitBuyClearHourList.length - 1));
|
|
|
|
|
+ },
|
|
|
|
|
+ limitBuyClearCycleText() {
|
|
|
|
|
+ return this.limitBuyClearCycleList[this.limitBuyClearCycleIndex];
|
|
|
|
|
+ },
|
|
|
|
|
+ limitBuyClearHourText() {
|
|
|
|
|
+ return this.limitBuyClearHourList[this.limitBuyClearHourIndex];
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onLoad(option) {
|
|
onLoad(option) {
|
|
@@ -694,6 +758,33 @@ export default {
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ normalizeLimitBuyClearConfig(){
|
|
|
|
|
+ if (![0, 1, 2].includes(Number(this.form.limitBuyClearType))) {
|
|
|
|
|
+ this.form.limitBuyClearType = 0
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.form.limitBuyClearType = Number(this.form.limitBuyClearType)
|
|
|
|
|
+ }
|
|
|
|
|
+ this.form.limitBuyClearIntervalDays = Number(this.form.limitBuyClearIntervalDays) > 0 ? Number(this.form.limitBuyClearIntervalDays) : 1
|
|
|
|
|
+ this.form.cleartAt = Number(this.form.cleartAt) >= 0 ? Number(this.form.cleartAt) : 0
|
|
|
|
|
+ if (this.form.limitBuyClearIntervalDays > this.limitBuyClearCycleList.length) {
|
|
|
|
|
+ this.form.limitBuyClearIntervalDays = this.limitBuyClearCycleList.length
|
|
|
|
|
+ }
|
|
|
|
|
+ if (this.form.cleartAt > this.limitBuyClearHourList.length - 1) {
|
|
|
|
|
+ this.form.cleartAt = this.limitBuyClearHourList.length - 1
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ limitBuyClearTypeChange(e){
|
|
|
|
|
+ this.form.limitBuyClearType = Number(e.detail.value)
|
|
|
|
|
+ if (this.form.limitBuyClearType == 0 || this.form.limitBuyClearType == 1) {
|
|
|
|
|
+ this.form.limitBuyClearTime = ''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ limitBuyClearCycleChange(e){
|
|
|
|
|
+ this.form.limitBuyClearIntervalDays = Number(e.detail.value) + 1
|
|
|
|
|
+ },
|
|
|
|
|
+ limitBuyClearHourChange(e){
|
|
|
|
|
+ this.form.cleartAt = Number(e.detail.value)
|
|
|
|
|
+ },
|
|
|
notAllowChange(){
|
|
notAllowChange(){
|
|
|
if(this.productData.hasRightChangeReason!=''){
|
|
if(this.productData.hasRightChangeReason!=''){
|
|
|
this.$msg(this.productData.hasRightChangeReason)
|
|
this.$msg(this.productData.hasRightChangeReason)
|
|
@@ -1200,6 +1291,9 @@ export default {
|
|
|
this.form.frontUse = 0
|
|
this.form.frontUse = 0
|
|
|
this.form.virtualStock = 0
|
|
this.form.virtualStock = 0
|
|
|
this.form.limitBuy = 0
|
|
this.form.limitBuy = 0
|
|
|
|
|
+ this.form.limitBuyClearType = 1
|
|
|
|
|
+ this.form.limitBuyClearIntervalDays = 1
|
|
|
|
|
+ this.form.cleartAt = 0
|
|
|
this.form.limitBuyClearTime = ''
|
|
this.form.limitBuyClearTime = ''
|
|
|
this.form.limitBuyExceedType = 1
|
|
this.form.limitBuyExceedType = 1
|
|
|
this.cost = res.data && res.data.cost ? parseFloat(res.data.cost) : 0
|
|
this.cost = res.data && res.data.cost ? parseFloat(res.data.cost) : 0
|
|
@@ -1218,6 +1312,7 @@ export default {
|
|
|
if (![1, 2].includes(Number(this.form.limitBuyExceedType))) {
|
|
if (![1, 2].includes(Number(this.form.limitBuyExceedType))) {
|
|
|
this.form.limitBuyExceedType = 1;
|
|
this.form.limitBuyExceedType = 1;
|
|
|
}
|
|
}
|
|
|
|
|
+ this.normalizeLimitBuyClearConfig()
|
|
|
|
|
|
|
|
const imageUrls = (res.data.images || '').split(',').filter(i => i);
|
|
const imageUrls = (res.data.images || '').split(',').filter(i => i);
|
|
|
this.form.images = imageUrls;
|
|
this.form.images = imageUrls;
|
|
@@ -1248,6 +1343,13 @@ export default {
|
|
|
this.productData = res.data
|
|
this.productData = res.data
|
|
|
this.cost = res.data.cost ? res.data.cost : 0
|
|
this.cost = res.data.cost ? res.data.cost : 0
|
|
|
this.belongCost = res.data.belongCost ? res.data.belongCost : 0
|
|
this.belongCost = res.data.belongCost ? res.data.belongCost : 0
|
|
|
|
|
+
|
|
|
|
|
+ const limitBuyClearInfo = res.data.limitBuyClearInfo || {}
|
|
|
|
|
+ this.form.limitBuyClearType = limitBuyClearInfo.limitBuyClearType || limitBuyClearInfo.limitBuyClearType === 0 ? limitBuyClearInfo.limitBuyClearType : 1
|
|
|
|
|
+ this.form.limitBuyClearIntervalDays = limitBuyClearInfo.limitBuyClearIntervalDays ? limitBuyClearInfo.limitBuyClearIntervalDays : 1
|
|
|
|
|
+ this.form.cleartAt = limitBuyClearInfo.cleartAt ? limitBuyClearInfo.cleartAt : 0
|
|
|
|
|
+ this.form.limitBuyClearTime = limitBuyClearInfo.limitBuyClearTime ? limitBuyClearInfo.limitBuyClearTime : ''
|
|
|
|
|
+ this.normalizeLimitBuyClearConfig()
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
imgUploadSuccess(res) {
|
|
imgUploadSuccess(res) {
|
|
@@ -1525,6 +1627,44 @@ export default {
|
|
|
.limit-time-picker {
|
|
.limit-time-picker {
|
|
|
width: 470upx;
|
|
width: 470upx;
|
|
|
}
|
|
}
|
|
|
|
|
+.limit-clear-radio {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ flex-wrap: nowrap;
|
|
|
|
|
+ .list {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ margin-right: 20upx;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+ .checkbox-text {
|
|
|
|
|
+ margin-left: 4upx;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+.limit-clear-time-title {
|
|
|
|
|
+ margin-left: 35upx;
|
|
|
|
|
+}
|
|
|
|
|
+.limit-clear-cycle-row {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ flex-wrap: nowrap;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+}
|
|
|
|
|
+.limit-clear-cycle-text {
|
|
|
|
|
+ margin: 0 8upx;
|
|
|
|
|
+ white-space: nowrap;
|
|
|
|
|
+}
|
|
|
|
|
+.limit-picker-value {
|
|
|
|
|
+ width: 120upx;
|
|
|
|
|
+ height: 54upx;
|
|
|
|
|
+ line-height: 54upx;
|
|
|
|
|
+ border: 1upx solid #999;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ font-size: 28upx;
|
|
|
|
|
+ background-color: #fff;
|
|
|
|
|
+}
|
|
|
.app-footer {
|
|
.app-footer {
|
|
|
justify-content: space-evenly;
|
|
justify-content: space-evenly;
|
|
|
z-index: 9999;
|
|
z-index: 9999;
|