Przeglądaj źródła

获取商品分组接口修改增加传参

lishanshan 8 miesięcy temu
rodzic
commit
656f75520c
2 zmienionych plików z 29 dodań i 5 usunięć
  1. 25 4
      pages/product/creatProduct.vue
  2. 4 1
      pages/product/details.vue

+ 25 - 4
pages/product/creatProduct.vue

@@ -193,7 +193,8 @@
 						商品售价<span>*</span>
 					</view>
 					<view class="picker">
-						<u-input type="number" v-model.number="form.price" placeholder="请输入" />
+						<u-input type="number" v-model.number="form.price" placeholder="请输入"
+							@blur="checkPriceAndSoldPrice('price')" />
 					</view>
 					<view class="unit">
@@ -204,7 +205,8 @@
 						商品市场价<span v-if="tabIndex == '1'">*</span>
 					</view>
 					<view class="picker">
-						<u-input type="number" v-model.number="form.soldPrice" placeholder="请输入" />
+						<u-input type="number" v-model.number="form.soldPrice" placeholder="请输入"
+							@blur="checkPriceAndSoldPrice('soldPrice')" />
 					</view>
 					<view class="unit">
@@ -737,6 +739,21 @@ export default {
 				}
 			})
 		},
+		// 校验商品市场价必须大于商品售价
+		checkPriceAndSoldPrice(field) {
+			if ((field == 'price' && this.form.soldPrice) || (field == 'soldPrice' && this.form.price)) {
+				if (this.form.soldPrice <= this.form.price) {
+					uni.showToast({
+						title: '商品市场价必须大于商品售价',
+						icon: 'none',
+						duration: 2000
+					});
+					this.$nextTick(() => {
+						this.form[field] = '';
+					});
+				}
+			}
+		},
 		// 保存退款规则
 		saveFound(rules) {
 			this.form.refundConfirm = rules.refundConfirm.refundConfirm
@@ -845,7 +862,7 @@ export default {
 		},
 		//获取商品分组列表
 		getProductGroup() {
-			this.$http.get("/localProductGrouping/localProductGrouping/getList").then(res => {
+			this.$http.get("/localProductGrouping/localProductGrouping/getAppList").then(res => {
 				if (res.data.success) {
 					this.groupOptions = res.data.result || []
 				}
@@ -885,6 +902,7 @@ export default {
 		submit() {
 			console.log(this.form)
 			this.form.specItems = this.selectProductSunItem
+			this.form.isApp = '1'
 			this.makeChecked ? this.form.preBook = 1 : this.form.preBook = 0
 			// if (!this.form.saleStartDate) {
 			// 	uni.showToast({
@@ -1000,7 +1018,10 @@ export default {
 		},
 		//回显数据
 		getForm() {
-			this.$http.get("/app/product/queryById?id=" + this.productId, {}).then(res => {
+			this.$http.post("/app/product/queryByIdNew", {
+				id: this.productId,
+				isApp: '1'
+			}).then(res => {
 				if (res.data.code == 200) {
 					this.form = res.data.result
 

+ 4 - 1
pages/product/details.vue

@@ -234,7 +234,10 @@ export default {
 	},
 	onLoad(options) {
 		this.productId = options.productId
-		this.$http.get("/app/product/queryById?id=" + this.productId, {}).then(res => {
+		this.$http.post("/app/product/queryByIdNew", {
+			id: this.productId,
+			isApp: '1'
+		}).then(res => {
 
 			if (res.data.code == 200) {
 				this.form = res.data.result