lilei 7 月之前
父節點
當前提交
b1cb1113be
共有 2 個文件被更改,包括 33 次插入20 次删除
  1. 20 17
      pages/sales/edit.vue
  2. 13 3
      pages/sales/salesDetail.vue

+ 20 - 17
pages/sales/edit.vue

@@ -55,14 +55,14 @@
 						<view class="font_13 flex_1 flex justify_between">
 						<view class="font_13 flex_1 flex justify_between">
 							<view class="pimgs">
 							<view class="pimgs">
 								<u-image :src="item.productMainImage?item.productMainImage:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
 								<u-image :src="item.productMainImage?item.productMainImage:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
-								<view v-if="item.oosFlag == 1" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
-								<view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('errorColor')}">亏</view>
-								<view v-if="item.price == 0" class="sign" :style="{backgroundColor: $config('errorColor')}">赠</view>
+								<view v-if="(isOwerEdit && item.oosFlag == 1) || (isOwerEdit && item.oosFlag == 1)" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
+								<view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('warringColor')}">亏</view>
+								<view v-if="!isOwerEdit&&!isAudit&&(!item.currentStockQty || item.currentStockQty < item.qty)" class="sign" :style="{backgroundColor: $config('errorColor')}">缺</view>
 							</view>
 							</view>
 							<view class="sales-item-main flex_1">
 							<view class="sales-item-main flex_1">
 								<view class="sales-item-name">{{item.productName || '--'}}</view>
 								<view class="sales-item-name">{{item.productName || '--'}}</view>
 								<view class="sales-item-txt">{{item.productCode || '--'}}</view>
 								<view class="sales-item-txt">{{item.productCode || '--'}}</view>
-								<view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseName">{{item.warehouseName}} > {{item.warehouseLocationName}}</view>
+								<view class="sales-item-txt color_6" style="font-size: 24upx;" v-if="item.warehouseEntity&&item.warehouseEntity.name || item.warehouseLocationEntity&&item.warehouseLocationEntity.name">{{item.warehouseEntity&&item.warehouseEntity.name}} > {{item.warehouseLocationEntity&&item.warehouseLocationEntity.name}}</view>
 								<view class="sales-item-txt flex align_center justify_between">
 								<view class="sales-item-txt flex align_center justify_between">
 									<view class="sales-item-priceInfo">
 									<view class="sales-item-priceInfo">
 										<view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
 										<view :style="{color: $config('errorColor'), display: 'inline-block'}">¥<text style="font-size: 30upx;">{{toThousands(item.price||0, 2)}}</text></view>
@@ -151,7 +151,7 @@
 			}
 			}
 		},
 		},
 		onLoad(opt) {
 		onLoad(opt) {
-			this.theme = getApp().globalData.theme
+			this.theme = getApp({ allowDefault: true }).globalData.theme
 			if(opt){
 			if(opt){
 				this.pageData = {
 				this.pageData = {
 					type: opt.pageType || 'edit',
 					type: opt.pageType || 'edit',
@@ -165,6 +165,16 @@
 		onUnload() {
 		onUnload() {
 			uni.$off('refreshEditBL')
 			uni.$off('refreshEditBL')
 		},
 		},
+		computed: {
+			 // 是否自建单据
+			 isOwerEdit () {
+			   return this.detailData && this.detailData.sourceType == 'SALES'
+			 },
+			 // 是否审核通过
+			 isAudit () {
+			   return this.detailData ? (this.detailData.billStatus == 'WAIT_OUT_WAREHOUSE' || this.detailData.billStatus == 'FINISH') : false
+			 },
+		},
 		methods: {
 		methods: {
 			init(){
 			init(){
 				this.getList(1)
 				this.getList(1)
@@ -186,16 +196,9 @@
 					if (res.status == 200) {
 					if (res.status == 200) {
 						if(res.data && res.data.list){
 						if(res.data && res.data.list){
 							res.data.list.map(item => {
 							res.data.list.map(item => {
-								const productCode = (item.productEntity && item.productEntity.code) || (item.dealerProductEntity && item.dealerProductEntity.code)
-								const productName = (item.productEntity && item.productEntity.name) || (item.dealerProductEntity && item.dealerProductEntity.name)
-								const productOrigCode = (item.productEntity && item.productEntity.origCode) || (item.dealerProductEntity && item.dealerProductEntity.origCode) || '--'
-								const productOrigUnit = (item.productEntity && item.productEntity.unit) || (item.dealerProductEntity && item.dealerProductEntity.unit)
-								item.productCode = productCode || '--'
-								item.productName = productName || '--'
-								item.productOrigCode = productOrigCode || '--'
-								item.productUnit = productOrigUnit || '--'
-								item.warehouseName = item.warehouseEntity && item.warehouseEntity.name || '--'
-								item.warehouseLocationName = item.warehouseLocationEntity && item.warehouseLocationEntity.name || '--'
+								item.productName = item.productEntity && item.productEntity.name || item.dealerProductEntity && item.dealerProductEntity.name
+								item.productCode = item.productEntity && item.productEntity.code || item.dealerProductEntity && item.dealerProductEntity.code
+								item.productUnit = item.productEntity && item.productEntity.unit || item.dealerProductEntity && item.dealerProductEntity.unit
 							})
 							})
 							if(this.pageNo>1){
 							if(this.pageNo>1){
 								this.listData = this.listData.concat(res.data && res.data.list || [])
 								this.listData = this.listData.concat(res.data && res.data.list || [])
@@ -252,8 +255,8 @@
 					productMainImage: data.productMainImage,
 					productMainImage: data.productMainImage,
 					productCode: data.productCode,
 					productCode: data.productCode,
 					productOrigCode: data.productOrigCode,
 					productOrigCode: data.productOrigCode,
-					warehouseName: data.warehouseName,
-					warehouseLocationName: data.warehouseLocationName,
+					warehouseName: data.warehouseEntity && data.warehouseEntity.name,
+					warehouseLocationName: data.warehouseLocationEntity && data.warehouseLocationEntity.name,
 					price: data.price,
 					price: data.price,
 					qty: data.qty
 					qty: data.qty
 				}
 				}

+ 13 - 3
pages/sales/salesDetail.vue

@@ -46,9 +46,9 @@
 						<view class="font_13 flex_1 flex justify_between">
 						<view class="font_13 flex_1 flex justify_between">
 							<view class="pimgs">
 							<view class="pimgs">
 								<u-image :src="item.productMainImage?item.productMainImage:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
 								<u-image :src="item.productMainImage?item.productMainImage:`../../static/${$config('themePath')}/def_img@2x.png`" width="128" height="128" border-radius="10"></u-image>
-								<view v-if="item.oosFlag == 1" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
-								<view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('errorColor')}">亏</view>
-								<view v-if="item.price == 0" class="sign" :style="{backgroundColor: $config('errorColor')}">赠</view>
+								<view v-if="(isOwerEdit && item.oosFlag == 1) || (isOwerEdit && item.oosFlag == 1)" class="sign" :style="{backgroundColor: $config('errorColor')}">急</view>
+								<view v-if="item.price < item.cost" class="sign" :style="{backgroundColor: $config('warringColor')}">亏</view>
+								<view v-if="!isOwerEdit&&!isAudit&&(!item.currentStockQty || item.currentStockQty < item.qty)" class="sign" :style="{backgroundColor: $config('errorColor')}">缺</view>
 							</view>
 							</view>
 							<view class="sales-item-main flex_1">
 							<view class="sales-item-main flex_1">
 								<view class="sales-item-name">{{item.productName || '--'}}</view>
 								<view class="sales-item-name">{{item.productName || '--'}}</view>
@@ -161,6 +161,16 @@
 				this.changeScrollH()
 				this.changeScrollH()
 			}
 			}
 		},
 		},
+		computed: {
+			 // 是否自建单据
+			 isOwerEdit () {
+			   return this.detailData && this.detailData.sourceType == 'SALES'
+			 },
+			 // 是否审核通过
+			 isAudit () {
+			   return this.detailData ? (this.detailData.billStatus == 'WAIT_OUT_WAREHOUSE' || this.detailData.billStatus == 'FINISH') : false
+			 },
+		},
 		methods: {
 		methods: {
 			//获取收款记录
 			//获取收款记录
 			getRecodeData(pageNo){
 			getRecodeData(pageNo){