Explorar o código

取消限购问题

shish hai 2 meses
pai
achega
a2673e657e

+ 4 - 0
ghsApp/src/api/item/index.js

@@ -13,6 +13,10 @@ export const clearLimitBuy = data => {
 	return https.get('/item/clear-limit-buy', data)
 }
 
+export const cancelLimitBuy = data => {
+	return https.get('/item/cancel-limit-buy', data)
+}
+
 export const modifyWeight = data => {
 	return https.get('/item/modify-weight', data)
 }

+ 88 - 4
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -40,10 +40,18 @@
 											<text style="color:green;margin-left:9upx;font-weight:normal;">...</text>
 										</text>
 									</view>
-									<view>
-										<input type="digit" v-model="res.suggestHjPrice" @focus="clearHjPrice(i)" placeholder="大客价" />
-										<input type="digit" v-model="res.suggestPrice" @focus="clearPrice(i)" @input="linkChange(i)" placeholder="批发价" style="border:1upx solid #3385FF;color:#3385FF;" />
-										<input type="digit" v-model="res.suggestSkPrice" @focus="clearSkPrice(i)" placeholder="零售价" />
+									<view
+										class="price-input-row"
+										:class="{'has-cancel-limit': Number(res.limitBuy) > 0}"
+									>
+										<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
+											v-if="Number(res.limitBuy) > 0"
+											class="cancel-limit-btn"
+											@click.stop="cancelLimitBuyFn(i)"
+										>{{res.limitBuy}} 取消限购</view>
 									</view>
 								</view>
 							</view>
@@ -75,6 +83,7 @@
 <script>
 import { getAllProductDataApi,batchChangePrice } from "@/api/product";
 import { getCgItemList,getPurchaseDetailApi,confirmPutIn,saveCgPrice } from "@/api/purchase";
+import { cancelLimitBuy } from "@/api/item";
 import { IMGHOST } from '@/config'
 import { mapGetters } from "vuex"
 export default {
@@ -211,6 +220,34 @@ export default {
 				}
 			})
 		},
+		cancelLimitBuyFn(index){
+			const item = this.flowersList[index]
+			if (!item || Number(item.limitBuy) <= 0) {
+				return
+			}
+			const productId = item.productId
+			if (!productId) {
+				this.$msg('花材信息缺失')
+				return
+			}
+			this.$util.confirmModal({ content: '确认取消限购?' }, () => {
+				let pendingMsg = ''
+				uni.showLoading({ mask: true })
+				cancelLimitBuy({ id: productId }).then(res => {
+					if (res.code == 1) {
+						this.$set(this.flowersList[index], 'limitBuy', 0)
+						pendingMsg = res.msg || '取消成功'
+					}
+				}).finally(() => {
+					uni.hideLoading()
+					if (pendingMsg) {
+						setTimeout(() => {
+							this.$msg(pendingMsg)
+						}, 100)
+					}
+				})
+			})
+		},
 		savePrice(){
 			let that = this
 			let hasError = false
@@ -365,6 +402,7 @@ export default {
 			margin-right:30upx;
 			text-align:center;
 			font-size:32upx;
+			box-sizing:border-box;
 			/* #ifdef MP-WEIXIN */
 			/* #ifdef APP-PLUS */
 			/* #else */
@@ -375,6 +413,52 @@ export default {
 			/* #endif */
 			/* #endif */
 		}
+		.price-input-row{
+			display:flex;
+			flex-direction:row;
+			flex-wrap:nowrap;
+			align-items:center;
+			width:100%;
+			overflow:hidden;
+			.price-input{
+				flex-shrink:0;
+				width:135upx;
+				height:50upx;
+				margin-left:10upx;
+				margin-right:30upx;
+				border:1upx solid #cccccc;
+				text-align:center;
+				font-size:32upx;
+				box-sizing:border-box;
+				/* #ifdef MP-WEIXIN */
+				/* #ifdef APP-PLUS */
+				/* #else */
+				-webkit-appearance: none;
+				-webkit-tap-highlight-color: transparent;
+				-webkit-user-select: none;
+				/* #endif */
+				/* #endif */
+			}
+			.price-input-main{
+				border:1upx solid #3385FF;
+				color:#3385FF;
+			}
+			&.has-cancel-limit .price-input:last-of-type{
+				margin-right:10upx;
+			}
+			.cancel-limit-btn{
+				flex-shrink:0;
+				padding:0 10upx;
+				height:50upx;
+				line-height:50upx;
+				font-size:20upx;
+				font-weight:bold;
+				color:#ffffff;
+				background:#ff4d4f;
+				border-radius:6upx;
+				white-space:nowrap;
+			}
+		}
 	}
 	.second-area{
 		float:left;