shish 4 месяцев назад
Родитель
Сommit
d43711bf72
1 измененных файлов с 42 добавлено и 9 удалено
  1. 42 9
      ghsApp/src/admin/item/list2.vue

+ 42 - 9
ghsApp/src/admin/item/list2.vue

@@ -205,6 +205,19 @@
 		</template>
 		</modal-module>
 
+		<modal-module :show="cancelPreSellShow" @click="cancelPreSellConfirm" :maskClosable="true" title="取消预售" padding="30rpx 30rpx" >
+			<template v-slot:content>
+				<view class="app-modal-input-wrap">
+					<view class="inp-list-line">
+						<view class="line-input" style="justify-content: center;margin-top: 30upx;margin-bottom: 30upx;">
+							<button class="admin-button-com big" :class="clearStockOption === 1 ? 'blue' : 'default'" @click="clearStockOption = 1" style="margin-right:20upx;">清除库存</button>
+							<button class="admin-button-com big" :class="clearStockOption === 0 ? 'blue' : 'default'" @click="clearStockOption = 0">不清库存</button>
+						</view>
+					</view>
+				</view>
+			</template>
+		</modal-module>
+
 	</view>
 </template>
 <script>
@@ -255,7 +268,10 @@ export default {
 			partShow:false,
 			partFocus:false,
 			showClassImg:false,
-			priceOption:0
+			priceOption:0,
+			cancelPreSellShow: false,
+			clearStockOption: -1,
+			cancelPreSellItem: null
 		};
 	},
 	computed:{
@@ -400,14 +416,31 @@ export default {
 			})
 		},
 		cancelPreSellFn(item){
-			let that = this
-			this.$util.confirmModal({content:'确认取消预售?'},() => {
-				cancelPreSell({id:item.id}).then(res=>{
-					if(res.code == 1){
-						that.$msg(res.msg)
-					}
-				})
-			})
+			this.cancelPreSellItem = item;
+			this.clearStockOption = -1;
+			this.cancelPreSellShow = true;
+		},
+		cancelPreSellConfirm(val){
+			let that = this;
+			if (val.index == 0) { // 取消
+				that.cancelPreSellShow = false;
+				that.clearStockOption = -1;
+				that.cancelPreSellItem = null;
+				return;
+			}
+			if (that.clearStockOption === -1) {
+				that.$msg('请选择是否清除库存');
+				return;
+			}
+			cancelPreSell({
+				id: that.cancelPreSellItem.id,
+				clearStock: that.clearStockOption
+			}).then(res => {
+				if (res.code == 1) {
+					that.$msg(res.msg);
+					that.cancelPreSellShow = false
+				}
+			});
 		},
 		cancelDiscountFn(item){
 			let that = this