jiangfeng 5 лет назад
Родитель
Сommit
225c8ba5a7

+ 26 - 19
ghsApp/src/admin/billing/priceChange.vue

@@ -5,25 +5,26 @@
                          @search="searchFn" />
     </view>
     <view class="scroll-middle_bx">
-      <scroll-view scroll-y class="right-box" :scroll-into-view="scrollClassId">
+      <!--<scroll-view scroll-y class="right-box" :scroll-into-view="scrollClassId"></scroll-view>-->
         <!--内容部分 start -->
         <block v-if="!$util.isEmpty(filterProductInfo)">
-									<view style="padding: 30rpx">
+									<view style="width:100%;padding: 30rpx">
 										<template v-for="(productItem, productIndex) in filterProductInfo">
 										<Commondity :type="COMMODITY_TYPE.CHANGE"
 																						:key="productIndex"
 																						:info="productItem"
-																						:autoPrice="productItem.priceLabel=='2'?getSelectItemById(productItem.id).autoPrice:null"
 																						@changePrice="changePriceEvent"
 																						@remove="removeChangePriceEvent"></Commondity>
 									</template>
+										<!--:autoPrice="productItem.priceLabel=='2'?getSelectItemById(productItem.id).autoPrice:null"-->
+
 									</view>
         </block>
         <block v-else>
           <app-wrapper-empty title="暂无数据" :is-empty="$util.isEmpty(filterProductInfo)" />
         </block>
         <!--内容部分 end -->
-      </scroll-view>
+
     </view>
   </view>
   </view>
@@ -47,7 +48,13 @@ export default {
     Commondity
   },
   mixins: [productMins],
-
+	onPullDownRefresh() {
+		this.initData()
+  	console.error('111')
+	},
+	onShow(){
+		uni.startPullDownRefresh();
+	},
   data () {
     return {
       pageType: "price_change",
@@ -58,15 +65,15 @@ export default {
     async changePriceEvent (item, value) {
       try {
         console.log(5555, item)
-        await changePriceByIdApi({
-          productId: item.id,
-          price: value
-        })
-        uni.showToast({
-          title: '改价成功',
-          icon: 'none',
-
-        });
+        // await changePriceByIdApi({
+        //   productId: item.id,
+        //   price: value
+        // })
+        // uni.showToast({
+        //   title: '改价成功',
+        //   icon: 'none',
+								//
+        // });
 
         await this.initData()
       } catch (error) {
@@ -76,11 +83,11 @@ export default {
     },
     async removeChangePriceEvent (item) {
       try {
-        if (item.priceLabel != '2') {
-          throw new Error('改价的商品才能清楚')
-        }
-        await autoPriceByIdApi({productId: item.id})
-        uni.showToast({title: '自动调价成功',icon: 'none',});
+        // if (item.priceLabel != '2') {
+        //   throw new Error('改价的商品才能清除')
+        // }
+        // await autoPriceByIdApi({productId: item.id})
+        // uni.showToast({title: '自动调价成功',icon: 'none',});
         await this.initData()
       } catch (error) {
       }

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

@@ -24,13 +24,16 @@
 				<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
 					<input
 						class="change-input"
-						:value="autoPrice"
+						v-model="changeAutoPrice"
 						type="digit"
 						placeholder="自动调价"
-						@change="changePriceEvent"
 					/>
-					<i class="iconfont iconcachu edit" v-if="info.priceLabel==2" @click="removeEvent"></i>
-					<i class="iconfont iconcachu" v-else></i>
+					<!--@change="changePriceEvent"-->
+					<i class="iconfont iconjihuo" v-if="isShowSucceed"></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>
 			</view>
 		</view>
@@ -40,6 +43,7 @@
 <script>
 import { COMMODITY_TYPE } from "@/utils/declare";
 import AppImg from "@/components/app-img";
+import { autoPriceByIdApi, changePriceByIdApi } from '@/api/product/index'
 export default {
 	name: "Commodity",
 	components: {
@@ -65,11 +69,13 @@ export default {
 			type: Number,
 			default: 0
 		},
-		autoPrice: {}
+		// autoPrice: {}
 	},
 	data() {
 		return {
-			COMMODITY_TYPE
+			COMMODITY_TYPE,
+			isShowSucceed:false,
+			changeAutoPrice:'',
 		};
 	},
 	created() {},
@@ -81,14 +87,45 @@ export default {
 			this.$emit("del", this.info);
 		},
 
-		removeEvent() {
+		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);
 		},
-		changePriceEvent(event) {
-			const {
-				detail: { value }
-			} = event;
-			this.$emit("changePrice", this.info, value);
+		changePrice(event){
+			// const {
+			// 	detail: { value }
+			// } = 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
+			// }
+			await changePriceByIdApi({
+				productId: this.info.id,
+				price: this.changeAutoPrice
+			})
+			this.isShowSucceed = true;
+			setTimeout(()=>{
+				this.isShowSucceed = false
+				this.changeAutoPrice = '';
+				// this.autoPrice = '';
+			},2000)
+			this.$emit("changePrice", this.info, this.changeAutoPrice);
 		},
 		customNum() {
 			this.$emit("customNum", {
@@ -137,8 +174,9 @@ export default {
 				display: flex;
 				align-items: center;
 				& .iconfont {
+					margin-left: 15rpx;
 					color: #3385ff;
-					font-size: 50px;
+					font-size: 30px;
 				}
 				.iconcachu {
 					margin: 0 6px 0 20px;
@@ -168,6 +206,16 @@ export default {
 					border-radius: 4px;
 					font-size: 28px;
 				}
+				.btn-box{
+					width: 100rpx;
+					height: 60rpx;
+					margin-left: 15rpx;
+					line-height: 60rpx;
+					color: #ffffff;
+					background: #3385ff;
+					text-align: center;
+					border-radius: 10rpx;
+				}
 			}
 		}
 	}

+ 1 - 0
ghsApp/src/mixins/productContrapose.js

@@ -128,6 +128,7 @@ export default {
 				// });
 				this.productInfo = data.list;
 				this.classIndex = 0;
+				uni.stopPullDownRefresh();
 			} catch (error) {
 			} finally {
 				uni.hideLoading();

+ 2 - 1
ghsApp/src/pages.json

@@ -410,7 +410,8 @@
 				{
 					"path": "priceChange",
 					"style": {
-						"navigationBarTitleText": "改价"
+						"navigationBarTitleText": "改价",
+						"enablePullDownRefresh": true
 					}
 				},
 				{