shish 1 месяц назад
Родитель
Сommit
d2103a9928
1 измененных файлов с 122 добавлено и 10 удалено
  1. 122 10
      ghsApp/src/pagesPurchase/components/pageSuccess.vue

+ 122 - 10
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -40,18 +40,35 @@
 											<text style="color:green;margin-left:9upx;font-weight:normal;">...</text>
 										</text>
 									</view>
-									<view
-										class="price-input-row"
-										:class="{'has-cancel-limit': Number(res.limitBuy) > 0}"
-									>
+									<view class="price-input-row">
 										<input type="digit" v-model="res.suggestHjPrice" @focus="clearHjPrice(i)" placeholder="大客价" class="price-input" />
 										<input type="digit" v-model="res.suggestPrice" @focus="clearPrice(i)" @input="linkChange(i)" placeholder="批发价" class="price-input price-input-main" />
 										<input type="digit" v-model="res.suggestSkPrice" @focus="clearSkPrice(i)" placeholder="零售价" class="price-input" />
+									</view>
+									<view class="cancel-action-row" v-if="hasCancelAction(res)">
 										<view
 											v-if="Number(res.limitBuy) > 0"
 											class="cancel-limit-btn"
 											@click.stop="cancelLimitBuyFn(i)"
 										>取消限购</view>
+										<view
+											v-if="hasFullOff(res)"
+											class="cancel-action-btn"
+											@click.stop="cancelFullOff(i)"
+										>取消满减</view>
+										<text
+											v-if="hasFullOff(res)"
+											class="action-tip full-off-tip"
+										>满{{ res.reachNum }}↓{{ res.reachNumDiscount ? parseFloat(res.reachNumDiscount) : 0 }}</text>
+										<view
+											v-if="Number(res.discountPrice) > 0"
+											class="cancel-action-btn"
+											@click.stop="cancelDiscountFn(i)"
+										>取消特价</view>
+										<text
+											v-if="Number(res.discountPrice) > 0"
+											class="action-tip discount-tip"
+										>特价{{ res.discountPrice ? parseFloat(res.discountPrice) : 0 }}</text>
 										<text
 											v-if="Number(res.limitBuy) > 0"
 											class="limit-buy-tip"
@@ -91,7 +108,7 @@
 	</view>
 </template>
 <script>
-import { getAllProductDataApi,batchChangePrice } from "@/api/product";
+import { getAllProductDataApi,batchChangePrice,cancelDiscountPrice,cancelFullOffFn } from "@/api/product";
 import { getCgItemList,getPurchaseDetailApi,confirmPutIn,saveCgPrice } from "@/api/purchase";
 import { cancelLimitBuy, clearItemRemark } from "@/api/item";
 import { IMGHOST } from '@/config'
@@ -118,6 +135,12 @@ export default {
 		}
 	},
 	methods: {
+		hasFullOff(item) {
+			return item && Number(item.reachNum) > 0 && Number(item.reachNumDiscount) > 0
+		},
+		hasCancelAction(item) {
+			return Number(item.limitBuy) > 0 || Number(item.discountPrice) > 0 || this.hasFullOff(item)
+		},
 		linkChange(i){
 			if(this.flowersList[i].suggestPrice && Number(this.flowersList[i].suggestPrice)>0){
 				let skMore = this.flowersList[i].skMore ? Number(this.flowersList[i].skMore) : 0
@@ -286,6 +309,63 @@ export default {
 				})
 			})
 		},
+		cancelFullOff(index){
+			const item = this.flowersList[index]
+			if (!this.hasFullOff(item)) {
+				return
+			}
+			const productId = item.productId
+			if (!productId) {
+				this.$msg('花材信息缺失')
+				return
+			}
+			this.$util.confirmModal({ content: '确认取消满减?' }, () => {
+				let pendingMsg = ''
+				uni.showLoading({ mask: true })
+				cancelFullOffFn({ id: productId }).then(res => {
+					if (res.code == 1) {
+						this.$set(this.flowersList[index], 'reachNum', 0)
+						this.$set(this.flowersList[index], 'reachNumDiscount', 0)
+						pendingMsg = res.msg || '取消成功'
+					}
+				}).finally(() => {
+					uni.hideLoading()
+					if (pendingMsg) {
+						setTimeout(() => {
+							this.$msg(pendingMsg)
+						}, 100)
+					}
+				})
+			})
+		},
+		cancelDiscountFn(index){
+			const item = this.flowersList[index]
+			if (!item || Number(item.discountPrice) <= 0) {
+				return
+			}
+			const productId = item.productId
+			if (!productId) {
+				this.$msg('花材信息缺失')
+				return
+			}
+			this.$util.confirmModal({ content: '确认取消特价?' }, () => {
+				let pendingMsg = ''
+				uni.showLoading({ mask: true })
+				cancelDiscountPrice({ id: productId }).then(res => {
+					if (res.code == 1) {
+						this.$set(this.flowersList[index], 'discountPrice', 0)
+						pendingMsg = res.msg || '取消成功'
+					}
+				}).finally(() => {
+					uni.hideLoading()
+					if (pendingMsg) {
+						setTimeout(() => {
+							this.$msg(pendingMsg)
+						}, 100)
+					}
+				})
+			})
+		},
 		savePrice(){
 			let that = this
 			let hasError = false
@@ -446,8 +526,10 @@ export default {
 			/* #else */
 			// 苹果微信小程序 iOS WebKit 特殊修复
 			-webkit-appearance: none;
+			appearance: none;
 			-webkit-tap-highlight-color: transparent;
 			-webkit-user-select: none;
+			user-select: none;
 			/* #endif */
 			/* #endif */
 		}
@@ -473,8 +555,10 @@ export default {
 				/* #ifdef APP-PLUS */
 				/* #else */
 				-webkit-appearance: none;
+				appearance: none;
 				-webkit-tap-highlight-color: transparent;
 				-webkit-user-select: none;
+				user-select: none;
 				/* #endif */
 				/* #endif */
 			}
@@ -485,13 +569,21 @@ export default {
 				border:1upx solid #3385FF;
 				color:#3385FF;
 			}
+
+		}
+		.cancel-action-row{
+			display:flex;
+			flex-direction:row;
+			flex-wrap:nowrap;
+			align-items:center;
+			margin:10upx 0;
+			width:100%;
 			&.has-cancel-limit{
 				padding-right:72upx;
 			}
 			.cancel-limit-btn{
 				flex-shrink:0;
 				padding:0 10upx;
-				margin-left:15upx;
 				height:60upx;
 				line-height:60upx;
 				font-size:24upx;
@@ -501,17 +593,37 @@ export default {
 				border-radius:6upx;
 				white-space:nowrap;
 			}
+			.cancel-action-btn{
+				flex-shrink:0;
+				padding:0 10upx;
+				margin-left:8upx;
+				height:60upx;
+				line-height:60upx;
+				font-size:24upx;
+				font-weight:bold;
+				color:#ffffff;
+				background:#d70021;
+				border-radius:6upx;
+				white-space:nowrap;
+			}
 			.limit-buy-tip{
-				position:absolute;
-				right:0;
-				top:0;
+				flex-shrink:0;
+				margin-left:8upx;
 				height:60upx;
 				line-height:60upx;
 				color:#ff4d4f;
 				font-size:24upx;
 				font-weight:bold;
 				white-space:nowrap;
-				z-index:1;
+			}
+			.action-tip{
+				flex-shrink:0;
+				margin-left:8upx;
+				height:60upx;
+				line-height:60upx;
+				color:#ff0025;
+				font-size:24upx;
+				white-space:nowrap;
 			}
 		}
 	}