zhengxin пре 5 година
родитељ
комит
021ed6d8d0
2 измењених фајлова са 204 додато и 212 уклоњено
  1. 202 208
      ghs/src/admin/billing/priceChange.vue
  2. 2 4
      ghs/src/components/module/app-commodity.vue

+ 202 - 208
ghs/src/admin/billing/priceChange.vue

@@ -1,66 +1,55 @@
 <template>
 <template>
-	<view class="billing_box_bg">
-		<view class="input-wrap">
-			<app-search-module placeholder="请输入关键词搜索" @search="searchFn" />
-		</view>
-		<view class="scroll-middle_bx">
-			<scroll-view
-				scroll-y
-				scroll-with-animation
-				class="tab-view"
-			>
-				<div
-					v-for="(item, index) in productInfo"
-					:key="index"
-					class="tab-bar-item"
-					:class="[classIndex == index ? 'active' : '']"
-					:data-current="index"
-					@tap.stop="swichClass"
-				>
-					<text>{{ item.className || "" }}</text>
-				</div>
-			</scroll-view>
-			<scroll-view
-				scroll-y
-				class="right-box"
-				:scroll-into-view="scrollClassId"
-			>
-				<!--内容部分 start -->
-				<block v-if="!$util.isEmpty(productInfo)">
-					<view
-						class="item_list_bx"
-						v-for="(classItem, classIndex) in productInfo"
-						:key="classIndex"
-						:id="`class_${classItem.classId}`"
-					>
-						<view class="item_list_title">
-							{{ classItem.className }}
-						</view>
-						<template v-for="(productItem, productIndex) in classItem.child">
-							<Commondity
-                                :type="COMMODITY_TYPE.CHANGE"
-								:key="productIndex"
-								:info="productItem"
-								:autoPrice="
-									getSelectItemById(productItem.id, classItem.classId).autoPrice
+  <view class="billing_box_bg">
+    <view class="input-wrap">
+      <app-search-module placeholder="请输入关键词搜索"
+                         @search="searchFn" />
+    </view>
+    <view class="scroll-middle_bx">
+      <scroll-view scroll-y
+                   scroll-with-animation
+                   class="tab-view">
+        <div v-for="(item, index) in productInfo"
+             :key="index"
+             class="tab-bar-item"
+             :class="[classIndex == index ? 'active' : '']"
+             :data-current="index"
+             @tap.stop="swichClass">
+          <text>{{ item.className || "" }}</text>
+        </div>
+      </scroll-view>
+      <scroll-view scroll-y
+                   class="right-box"
+                   :scroll-into-view="scrollClassId">
+        <!--内容部分 start -->
+        <block v-if="!$util.isEmpty(productInfo)">
+          <view class="item_list_bx"
+                v-for="(classItem, classIndex) in productInfo"
+                :key="classIndex"
+                :id="`class_${classItem.classId}`">
+            <view class="item_list_title">
+              {{ classItem.className }}
+            </view>
+            <template v-for="(productItem, productIndex) in classItem.child">
+              <Commondity :type="COMMODITY_TYPE.CHANGE"
+                          :key="productIndex"
+                          :info="productItem"
+                          :autoPrice="
+									productItem.priceLabel=='2'?getSelectItemById(productItem.id, classItem.classId).autoPrice:null
 								"
 								"
-								@changePrice="changePriceEvent"
-								@remove="removeChangePriceEvent"
-							></Commondity>
-						</template>
-					</view>
-				</block>
-				<block v-else>
-					<app-wrapper-empty
-						title="暂无数据"
-						:is-empty="$util.isEmpty(productInfo)"
-					/>
-				</block>
-				<!--内容部分 end -->
-			</scroll-view>
-		</view>
-		</view>
-	</view>
+                          @changePrice="changePriceEvent"
+                          @remove="removeChangePriceEvent"></Commondity>
+            </template>
+          </view>
+        </block>
+        <block v-else>
+          <app-wrapper-empty title="暂无数据"
+                             :is-empty="$util.isEmpty(productInfo)" />
+        </block>
+        <!--内容部分 end -->
+      </scroll-view>
+    </view>
+  </view>
+  </view>
 </template>
 </template>
 
 
 <script>
 <script>
@@ -70,162 +59,167 @@ import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import Commondity from "@/components/module/app-commodity";
 import Commondity from "@/components/module/app-commodity";
 import { COMMODITY_TYPE } from "@/utils/declare";
 import { COMMODITY_TYPE } from "@/utils/declare";
 import productMins from "@/mixins/product";
 import productMins from "@/mixins/product";
-import {autoPriceByIdApi,changePriceByIdApi} from '@/api/product/index'
+import { autoPriceByIdApi, changePriceByIdApi } from '@/api/product/index'
 
 
 export default {
 export default {
-	name: "Billing", // 开单
-	components: {
-		AppTabs,
-		AppSearchModule,
-		AppWrapperEmpty,
-		Commondity
-	},
-	mixins: [productMins],
+  name: "Billing", // 开单
+  components: {
+    AppTabs,
+    AppSearchModule,
+    AppWrapperEmpty,
+    Commondity
+  },
+  mixins: [productMins],
 
 
-	data() {
-		return {
-			pageType: "price_change",
-			COMMODITY_TYPE,
-		};
-	},
-	methods: {
-		searchFn() {
-            this.initData();
-        },
-        async changePriceEvent(item,value){
-            try {
-                 console.log(5555,item)
-                await changePriceByIdApi({
-                    productId:item.id,
-                    price:value
-                })
-                uni.showToast({
-                    title: '改价成功',
-                    icon: 'none',
-                    
-                });
-                  
-                await this.initData()
-            } catch (error) {
-                 console.log(5555,error)
-                
-            }
-        },
-        async removeChangePriceEvent(item){
-            try {
-                await autoPriceByIdApi({
-                    productId:item.id
-                })
-                uni.showToast({
-                    title: '自动调价成功',
-                    icon: 'none',
-                    
-                });
-                await this.initData()
-            } catch (error) {
-            }
-        },
-	}
+  data () {
+    return {
+      pageType: "price_change",
+      COMMODITY_TYPE,
+    };
+  },
+  methods: {
+    searchFn () {
+      this.initData();
+    },
+    async changePriceEvent (item, value) {
+      try {
+        console.log(5555, item)
+        await changePriceByIdApi({
+          productId: item.id,
+          price: value
+        })
+        uni.showToast({
+          title: '改价成功',
+          icon: 'none',
+
+        });
+
+        await this.initData()
+      } 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.initData()
+      } catch (error) {
+      }
+    },
+  }
 };
 };
 </script>
 </script>
 
 
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 .billing_box_bg {
 .billing_box_bg {
-	height: 100%;
-	display: flex;
-	flex-direction: column;
-	.input-wrap {
-		padding: 22px 20px 22px 30px;
-	}
-	.scroll-middle_bx {
-		flex: 1;
-		width: 100%;
-		height: 100%;
-		display: flex;
-		overflow: hidden;
-	}
-	.tab-view {
-		height: 100%;
-		width: 170upx;
-		flex-shrink: 0;
-		background-color: #f0f2f6;
-		.tab-bar-item {
-			position: relative;
-			width: 170upx;
-			height: 90upx;
-			box-sizing: border-box;
-			display: flex;
-			align-items: center;
-			justify-content: center;
-			font-size: 26upx;
-			color: #444;
-			font-weight: 400;
-			.tag {
-				display: flex;
-				padding: 0 20px;
-				align-items: center;
-				position: absolute;
-				right: 0;
-				top: 0;
-				height: 32px;
-				background: #ff2842;
-				border-radius: 16px;
-				color: #fff;
-				font-size: 20px;
-			}
-		}
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  .input-wrap {
+    padding: 22px 20px 22px 30px;
+  }
+  .scroll-middle_bx {
+    flex: 1;
+    width: 100%;
+    height: 100%;
+    display: flex;
+    overflow: hidden;
+  }
+  .tab-view {
+    height: 100%;
+    width: 170upx;
+    flex-shrink: 0;
+    background-color: #f0f2f6;
+    .tab-bar-item {
+      position: relative;
+      width: 170upx;
+      height: 90upx;
+      box-sizing: border-box;
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      font-size: 26upx;
+      color: #444;
+      font-weight: 400;
+      .tag {
+        display: flex;
+        padding: 0 20px;
+        align-items: center;
+        position: absolute;
+        right: 0;
+        top: 0;
+        height: 32px;
+        background: #ff2842;
+        border-radius: 16px;
+        color: #fff;
+        font-size: 20px;
+      }
+    }
 
 
-		.active {
-			position: relative;
-			color: $mainColor;
-			font-size: 26px;
-			background: #fff;
-		}
+    .active {
+      position: relative;
+      color: $mainColor;
+      font-size: 26px;
+      background: #fff;
+    }
 
 
-		.active::before {
-			content: "";
-			position: absolute;
-			border-left: 8upx solid $mainColor;
-			height: 100%;
-			left: 0;
-		}
-	}
-	.right-box {
-		height: 100%;
-		flex: 1;
-		box-sizing: border-box;
-	}
-	.item_list_bx {
-		padding: 40px 16px;
-	}
-	.item_list_title {
-		margin-bottom: 20px;
-		font-size: 24px;
-		font-weight: 600;
-		color: #666666;
-	}
-	.select-cmd_bx {
-		& .kc {
-			color: #999999;
-			font-size: 28px;
-			font-weight: 400;
-			margin-bottom: 60px;
-			text-align: center;
-			margin-top: 10px;
-		}
-		& .num_bx {
-			display: flex;
-			align-items: center;
-			margin-bottom: 80px;
-			& > input {
-				width: 212px;
-				height: 80px;
-				border: 1px solid #dddddd;
-				border-radius: 4px;
-				text-align: center;
-				margin-right: 24px;
-			}
-		}
-	}
+    .active::before {
+      content: "";
+      position: absolute;
+      border-left: 8upx solid $mainColor;
+      height: 100%;
+      left: 0;
+    }
+  }
+  .right-box {
+    height: 100%;
+    flex: 1;
+    box-sizing: border-box;
+  }
+  .item_list_bx {
+    padding: 40px 16px;
+  }
+  .item_list_title {
+    margin-bottom: 20px;
+    font-size: 24px;
+    font-weight: 600;
+    color: #666666;
+  }
+  .select-cmd_bx {
+    & .kc {
+      color: #999999;
+      font-size: 28px;
+      font-weight: 400;
+      margin-bottom: 60px;
+      text-align: center;
+      margin-top: 10px;
+    }
+    & .num_bx {
+      display: flex;
+      align-items: center;
+      margin-bottom: 80px;
+      & > input {
+        width: 212px;
+        height: 80px;
+        border: 1px solid #dddddd;
+        border-radius: 4px;
+        text-align: center;
+        margin-right: 24px;
+      }
+    }
+  }
 }
 }
 </style>
 </style>

+ 2 - 4
ghs/src/components/module/app-commodity.vue

@@ -23,6 +23,7 @@
 				<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
 				<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
 					<input
 					<input
 						class="change-input"
 						class="change-input"
+						:value="autoPrice"
 						type="text"
 						type="text"
 						placeholder="自动调价"
 						placeholder="自动调价"
 						@change="changePriceEvent"
 						@change="changePriceEvent"
@@ -62,10 +63,7 @@ export default {
 			type: Number,
 			type: Number,
 			default: 0
 			default: 0
 		},
 		},
-		autoPrice: {
-			type: Number,
-			default: 0
-		}
+		autoPrice: {}
 	},
 	},
 	data() {
 	data() {
 		return {
 		return {