shish 5 лет назад
Родитель
Сommit
d448eb0f63

+ 1 - 33
ghsApp/src/admin/billing/priceChange.vue

@@ -14,11 +14,9 @@
 																						:key="productIndex"
 																						:info="productItem"
 																						:autoPrice="productItem.priceLabel=='2'?productItem.price:null"
-																						@changePrice="changePriceEvent"
-																						@remove="removeChangePriceEvent"></Commondity>
+                    ></Commondity>
 									</template>
 										<!--:autoPrice="productItem.priceLabel=='2'?getSelectItemById(productItem.id).autoPrice:null"-->
-
 									</view>
         </block>
         <block v-else>
@@ -60,36 +58,6 @@ export default {
     };
   },
   methods: {
-    async changePriceEvent (item, value) {
-      try {
-        console.log(5555, item)
-        // await changePriceByIdApi({
-        //   productId: item.id,
-        //   price: value
-        // })
-        // uni.showToast({
-        //   title: '改价成功',
-        //   icon: 'none',
-								//
-        // });
-
-        await this.initDataContrapose()
-      } catch (error) {
-        console.log(5555, error)
-
-      }
-    },
-    async removeChangePriceEvent (item) {
-      try {
-        // if (item.priceLabel != '2') {
-        //   throw new Error('改价的商品才能清除')
-        // }
-        // await autoPriceByIdApi({productId: item.id})
-        // uni.showToast({title: '自动调价成功',icon: 'none',});
-        await this.initDataContrapose()
-      } catch (error) {
-      }
-    },
   }
 };
 </script>

+ 21 - 61
ghsApp/src/components/module/app-commodity.vue

@@ -7,8 +7,7 @@
 			<view class="tit">{{ info.itemName || "" }}</view>
 			<view class="kc">库存{{ info.stock }}</view>
 			<view class="num-open_bx">
-				<view class="price">¥{{ info.price }}</view>
-<!--				<view class="price" style="text-decoration:line-through;">{{ info.price }}</view>-->
+				<view class="price">¥{{ showPrice }}</view>
 				<view class="open-bx" v-if="type == COMMODITY_TYPE.COMMON">
 					<i
 						class="iconfont iconjian"
@@ -23,22 +22,9 @@
 					<i class="iconfont iconzeng" @click="addEvent"></i>
 				</view>
 				<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
-					<view class="change-input" v-if="info.priceLabel==2&&isShowAutoPrice" @click="isShowAutoPrice=false">{{info.price}}</view>
-<!--					<input v-if="info.priceLabel==2"-->
-<!--						class="change-input"-->
-<!--						:value="info.price"-->
-<!--						type="digit"-->
-<!--						placeholder="自动调价"-->
-<!--						@focus="changeAutoPrice=''"-->
-<!--						@change="changeAutoPriceEvent"-->
-<!--					/>-->
-					<input v-show="!isShowAutoPrice||info.priceLabel!=2" :focus="!isShowAutoPrice" class="change-input" v-model="changeAutoPrice" type="digit" placeholder="自动调价" @focus="changeAutoPrice=''"/>
-					<!--@change="changePriceEvent"-->
+					<input class="change-input" v-model="changeAutoPrice" type="digit" placeholder="自动调价"  selection-start="0" selection-end="1" />
 					<i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
-					<view class="btn-box" v-if="changeAutoPrice==''" @click="removeEvent">确定</view>
-					<view class="btn-box" v-else @click="changePriceEvent">确定</view>
-					<!--<i class="iconfont iconcachu edit" v-if="info.priceLabel==2" @click="removeEvent"></i>-->
-					<!--<i class="iconfont iconcachu" v-else></i>-->
+					<view class="btn-box" @click="changePriceEvent">确定</view>
 				</view>
 			</view>
 		</view>
@@ -81,15 +67,18 @@ export default {
 	data() {
 		return {
 			COMMODITY_TYPE,
-			isShowAutoPrice:true,
 			isShowSucceed:false,
 			changeAutoPrice:'',
+			showPrice:0.00,
+			ifFocus:false
 		};
 	},
 	created() {},
 	mounted() {
-		// console.log(getSelectItemById(this.info.id).autoPrice)
-		// this.autoPrice = getSelectItemById(this.info.id).autoPrice
+		if(this.info.priceLabel == 2){
+			this.changeAutoPrice = this.info.price
+		}
+		this.showPrice = this.info.price
 	},
 	methods: {
 		addEvent() {
@@ -98,50 +87,22 @@ export default {
 		delEvent() {
 			this.$emit("del", this.info);
 		},
-
-		async removeEvent() {
-			// if (this.info.priceLabel != '2') {
-			// 	throw new Error('改价的商品才能清除')
-			// }
-			await autoPriceByIdApi({productId: this.info.id})
-			this.isShowSucceed = true;
-			setTimeout(()=>{
-				this.isShowSucceed = false
-				this.changeAutoPrice = '';
-				// this.autoPrice = '';
-			},2000)
-			this.$emit("remove", this.info);
-		},
-		changePrice(event){
-			// const {
-			// 	detail: { value }
-			// } = event;
-			this.changeAutoPrice = event.detail.value
-		},
-		changeAutoPriceEvent(event){
-			this.changeAutoPrice = event.detail.value
-		},
 		async changePriceEvent(event) {
-			// const {
-			// 	detail: { value }
-			// } = event;
-			// console.log('this.changeAutoPrice',this.changeAutoPrice)
-			// if(this.changeAutoPrice==null||this.changeAutoPrice==0){
-			// 	uni.showToast({title: '请输入正确的价格',icon: 'none'});
-			// 	return
-			// }
+			let self = this
 			await changePriceByIdApi({
 				productId: this.info.id,
 				price: this.changeAutoPrice
+			}).then(res => {
+				if(res.code == 1){
+					this.showPrice = res.data.price
+					this.isShowSucceed = true
+					setTimeout(()=>{
+						this.isShowSucceed = false
+					},1000)
+				}else{
+					self.$msg(res.msg)
+				}
 			})
-			this.isShowAutoPrice = true;
-			this.isShowSucceed = true;
-			setTimeout(()=>{
-				this.isShowSucceed = false
-				// this.changeAutoPrice = '';
-				// this.autoPrice = '';
-			},2000)
-			this.$emit("changePrice", this.info, this.changeAutoPrice);
 		},
 		customNum() {
 			this.$emit("customNum", {
@@ -225,12 +186,11 @@ export default {
 					background: #ffffff;
 					border: 1px solid #dddddd;
 					border-radius: 4px;
-					font-size: 28px;
+					font-size: 25px;
 				}
 				.btn-box{
 					width: 100rpx;
 					height: 60rpx;
-					margin-left: 15rpx;
 					line-height: 60rpx;
 					color: #ffffff;
 					background: #3385ff;