Browse Source

价格显示调整

lilei 2 năm trước cách đây
mục cha
commit
d87f6532ea

+ 8 - 0
api/shelf.js

@@ -331,4 +331,12 @@ export const updateShelfUserParam = (params) => {
     data: params,
     method: 'post'
   })
+}
+// 选中配件价格显示
+export const findShelfUserParam = (params) => {
+  return request({
+    url: `shelf/storeParam/findShelfUserParam`,
+    data: params,
+    method: 'post'
+  })
 }

+ 82 - 40
pagesA/digitalShelf/choosePart.vue

@@ -53,20 +53,11 @@
 											<text class="item-detail-text" v-if="item.affiliation=='SHELF'">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
 										</view>
 										<view class="flex justify_between">
-											<view class="item-detail-text flex_1" v-if="item.affiliation=='SHELF'">
-												 <view v-if="showPrice[0]">
-												 	<view v-if="showPrice[1]=='PURCHASES_PRICE'&&item.cost">
-												 		<text class="item-price" v-if="isAdmin || showPrice[2]">¥{{item.cost||0}}</text>
-												 	</view>
-												 	<text v-else class="item-price">¥{{item.price||0}}</text>
-												 </view>
-											</view>
-											<view class="item-detail-text flex_1" v-if="item.affiliation=='SUPER_CATALOGUE'">
-												<view v-if="showPrice[0]">
-													<text class="item-price" v-if="showPrice[1]!='PURCHASES_PRICE'">¥{{item.price||0}}</text>
-													<text class="item-price" v-else>
-														{{showPrice[2]?(item.cost||''):(isAdmin?(item.cost||''):'')}}
-													</text>
+											<view class="item-detail-text flex_1">
+												<view @click="openPriceModal(item)">
+													<text class="item-price" v-if="showCarPrice">¥{{item.price||0}}</text>
+													<text class="item-price" v-else>¥{{item.cost||0}}</text>
+													<u-icon name="arrow-right" v-if="priceShowVal"></u-icon>
 												</view>
 											</view>
 											<view class="item-detail-text" v-if="item.currentInven">
@@ -115,13 +106,11 @@
 										<text class="item-detail-text">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
 									</view>
 									<view class="flex justify_between">
-										<view class="item-detail-text flex_1" v-if="showPrice[0]">
-											<view v-if="showPrice[1]=='PURCHASES_PRICE'&&item.cost">
-												<text class="item-price" v-if="isAdmin || showPrice[2]">¥{{item.cost||0}}</text>
-											</view>
-											<text v-else class="item-price">¥{{item.price||0}}</text>
+										<view class="item-detail-text flex_1" @click="openPriceModal(item)">
+											<text class="item-price" v-if="showCarPrice">¥{{item.price||0}}</text>
+											<text class="item-price" v-else>¥{{item.cost||0}}</text>
+											<u-icon name="arrow-right" v-if="priceShowVal"></u-icon>
 										</view>
-										<view class="item-detail-text flex_1" v-else></view>
 										<view class="item-detail-text" v-if="item.currentInven">
 											<u-button shape="circle" @click="addPart(item)" v-if="!item.checked" :custom-style="{width:'48upx',height:'48upx',background:'#066cff'}" type="primary" size="mini">
 												<u-icon name="plus" color="#fff" size="28"></u-icon>
@@ -158,7 +147,7 @@
 					<u-image width="44" height="44" :src="`/static/icon_shopping@3x.png`"></u-image>
 				</div>
 			</div>
-			<view v-if="showPrice[0]&&showPrice[1]=='CAR_OWNER_PRICE'&&totalAmount">
+			<view v-if="(showCarPrice||showCostPrice)&&totalAmount">
 				合计:<text>¥{{totalAmount}}</text>
 			</view>
 			<div>
@@ -189,21 +178,9 @@
 										<text class="item-detail-text" v-if="item.affiliation!='SUPER_CATALOGUE'">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
 									</view>
 									<view class="flex justify_between">
-										<view class="item-detail-text flex_1" v-if="item.affiliation=='SUPER_CATALOGUE'">
-											<view v-if="showPrice[0]">
-												<text class="item-price" v-if="showPrice[1]=='CAR_OWNER_PRICE'">¥{{item.price||0}}</text>
-												<text class="item-price" v-else>
-													{{showPrice[2]?(item.cost||''):(isAdmin?(item.cost||''):'')}}
-												</text>
-											</view>
-										</view>
-										<view class="item-detail-text flex_1" v-else>
-											 <view v-if="showPrice[0]">
-												  <view v-if="showPrice[1]=='PURCHASES_PRICE'&&item.cost">
-												  	<text class="item-price" v-if="isAdmin || showPrice[2]">¥{{item.cost||0}}</text>
-												  </view>
-												  <text v-else class="item-price">¥{{item.price||0}}</text>
-											 </view>
+										<view class="item-detail-text flex_1">
+											<text class="item-price" v-if="showCarPrice">¥{{item.price||0}}</text>
+											<text class="item-price" v-else>¥{{item.cost||0}}</text>
 										</view>
 										<view class="item-detail-text">
 											<u-number-box @change="updateCartNums" @blur="updateCartNums" v-model="item.qty" :index="'cart_'+item.productSn" :min="0" :max="item.currentInven||999999"></u-number-box>
@@ -225,16 +202,38 @@
 				</view>
 			</view>
 		</u-popup>
+		<!-- 价格查看 -->
+		<u-popup v-model="showPriceModal" mode="center" length="80%" closeable>
+			<view class="show-price-modal" v-if="tempData">
+				<view>
+					<text>产品编码</text>
+					<text>{{tempData.code||'--'}}</text>
+				</view>
+				<view>
+					<text>产品名称</text>
+					<text>{{tempData.name||'--'}}</text>
+				</view>
+				<view>
+					<text>进货价</text>
+					<text>{{tempData.cost||0}}</text>
+				</view>
+				<view>
+					<text>车主价</text>
+					<text>{{tempData.price||0}}</text>
+				</view>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
 <script>
-	import { getShelfProductList, getShelfProductType, queryPartCodeByVin, getShelfQueryList, shelfOrderFlowCreate } from '@/api/shelf'
+	import { getShelfProductList, getShelfProductType, queryPartCodeByVin, getShelfQueryList, shelfOrderFlowCreate, findShelfUserParam } from '@/api/shelf'
 	import { scanVinLogCopy } from '@/api/car'
 	export default {
 		data() {
 			return {
 				showOther: false,
+				showPriceModal: false,
 				theme: '',
 				vinNumber: '',
 				leve2Data: [],  //  二级菜单数据
@@ -255,6 +254,10 @@
 				isIphoneXup: false,
 				saveLoading: false,
 				showPopup: false,
+				priceShowVal: null, // 是否可以查看所有价格
+				showCarPrice: false, // 显示车主价
+				showCostPrice: false, // 显示成本价
+				tempData: null // 临时数据
 			}
 		},
 		computed:{
@@ -286,9 +289,6 @@
 			storeApply(){
 				return this.$store.state.vuex_storeAuthInfo || null
 			},
-			showPrice(){
-				return this.$store.state.vuex_showPrice
-			},
 			isAdmin(){
 				return this.userInfo.superAdmin == 1
 			},
@@ -317,8 +317,35 @@
 		},
 		onShow() {
 			this.$store.state.vuex_shelfChoosePart = []
+			this.getShowPriceType()
 		},
 		methods: {
+			getShowPriceType(){
+				const storeShelf = this.$store.state.vuex_storeShelf
+				findShelfUserParam({shelfSn: storeShelf?storeShelf.shelfSn:''}).then(res => {
+					this.priceShowVal = res.data.carOwnerPrice == '1' && res.data.purchasesPrice == '1'
+					// 选中了2中价格,则从列表显示价格中取值
+					if(this.priceShowVal){
+						// 进货价
+						this.showCostPrice = res.data.priceShowType == 'PURCHASES_PRICE'
+						// 车主价
+						this.showCarPrice = res.data.priceShowType == 'CAR_OWNER_PRICE'
+					}else{
+						// 进货价
+						this.showCostPrice = res.data.purchasesPrice == '1'
+						// 车主价
+						this.showCarPrice = res.data.carOwnerPrice == '1'
+					}
+				})
+			},
+			// 打开价格信息弹框
+			openPriceModal(row){
+				console.log(row)
+				if(this.priceShowVal){
+					this.tempData = row
+					this.showPriceModal = true
+				}
+			},
 			scanVinLogCopy(){
 				scanVinLogCopy({id:this.carInfo.id}).then(res => {
 					console.log(res)
@@ -684,6 +711,21 @@
 			margin-left: 10rpx;
 		}
 	}
+	.show-price-modal{
+		padding: 30px 20px;
+		>view{
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			> text{
+				&:last-child{
+					color: #999;
+				}
+			}
+			border-bottom: 1px solid #eee;
+			padding: 10px;
+		}
+	}
 	.cpb_middle{
 		flex-grow: 1;
 		padding-top: 10rpx;

+ 3 - 9
pagesA/queryByCode/confirmQh.vue

@@ -12,12 +12,9 @@
 		 		<u-number-box :min="1" :max="nowData.currentInven" v-model="qty" color="#000" bg-color="#fff" size="36" :input-height="80" :input-width="180"></u-number-box>
 		 	</view>
 		 	<view class="kucun flex justify_center">
-				<view class="pcode" v-if="showPrice[0]">
-					<view v-if="showPrice[1]=='PURCHASES_PRICE'">
-						价格:<text class="item-price" v-if="isAdmin || showPrice[2]">{{nowData.cost||0}}</text>
-					</view>
-					<view v-else>
-						价格:<text class="item-price">{{nowData.price||0}}</text>
+				<view class="pcode">
+					<view>
+						价格:<text class="item-price">{{nowData.showPrice||0}}</text>
 					</view>
 				</view>
 				<view>
@@ -50,9 +47,6 @@
 			userInfo(){
 				return this.$store.state.vuex_userInfo
 			},
-			showPrice(){
-				return this.$store.state.vuex_showPrice
-			},
 			isAdmin(){
 				return this.userInfo.superAdmin == 1
 			}

+ 28 - 10
pagesA/queryByCode/queryByCode.vue

@@ -35,11 +35,9 @@
 									</view>
 								</view>
 								<view class="pname flex align_center justify_between">
-									<view class="pcode" v-if="showPrice[0]">
-										<view v-if="showPrice[1]=='PURCHASES_PRICE'">
-											<text class="item-price" v-if="isAdmin || showPrice[2]">价格:{{item.cost||0}}</text>
-										</view>
-										<text v-else class="item-price">价格:{{item.price||0}}</text>
+									<view class="pcode">
+										<text class="item-price" v-if="showCarPrice">价格:¥{{item.price||0}}</text>
+										<text class="item-price" v-else>价格:¥{{item.cost||0}}</text>
 									</view>
 									<view class="kc">库存:<text>{{item.currentInven}}</text>{{item.unit}}</view>
 								</view>
@@ -57,7 +55,7 @@
 </template>
 
 <script>
-	import { getShelfProductList } from '@/api/shelf'
+	import { getShelfProductList,findShelfUserParam } from '@/api/shelf'
 	export default {
 		data() {
 			return {
@@ -70,6 +68,9 @@
 				noDataText: '暂无产品',
 				status: 'nomore',
 				partList: [],
+				priceShowVal: null, // 是否可以查看所有价格
+				showCarPrice: false, // 显示车主价
+				showCostPrice: false, // 显示成本价
 			}
 		},
 		onLoad(opts) {
@@ -77,14 +78,13 @@
 			uni.$on("updateQueryByCodeList",()=>{
 				this.getpartList()
 			})
+			// 价格显示权限
+			this.getShowPriceType()
 		},
 		computed: {
 			userInfo(){
 				return this.$store.state.vuex_userInfo
 			},
-			showPrice(){
-				return this.$store.state.vuex_showPrice
-			},
 			isAdmin(){
 				return this.userInfo.superAdmin == 1
 			}
@@ -93,12 +93,30 @@
 			uni.$off("updateQueryByCodeList")
 		},
 		methods: {
+			getShowPriceType(){
+				findShelfUserParam({shelfSn: this.shelfSn}).then(res => {
+					this.priceShowVal = res.data.carOwnerPrice == '1' && res.data.purchasesPrice == '1'
+					// 选中了2中价格,则从列表显示价格中取值
+					if(this.priceShowVal){
+						// 进货价
+						this.showCostPrice = res.data.priceShowType == 'PURCHASES_PRICE'
+						// 车主价
+						this.showCarPrice = res.data.priceShowType == 'CAR_OWNER_PRICE'
+					}else{
+						// 进货价
+						this.showCostPrice = res.data.purchasesPrice == '1'
+						// 车主价
+						this.showCarPrice = res.data.carOwnerPrice == '1'
+					}
+				})
+			},
 			//拿货
 			toEdit(item){
 				if(item.currentInven){
 					const params = {
 						shelfSn: this.shelfSn, 
-						billSource: 'product_code'
+						billSource: 'product_code',
+						showPrice: this.showCarPrice ? item.price : item.cost
 					}
 					this.$store.state.vuex_tempData = Object.assign(params, item)
 					uni.navigateTo({