shish 4 лет назад
Родитель
Сommit
fe3c5ec739

+ 21 - 13
hdPad/src/admin/work/components/leftItem.vue

@@ -9,9 +9,11 @@
                     </view>
                     <view class="item-price-num">
                         <template v-if="item.property && item.property == 1">
-                            <view v-if="item.unitType == 0">{{parseFloat(item.bigPrice)}}元/{{item.bigUnit}}</view>
-                            <view v-else>{{parseFloat(item.smallPrice)}}元/{{item.smallUnit}}</view>
-                            <view>{{item.buyNum}} {{item.unitType == 0 ? item.bigUnit : item.smallUnit}}</view>
+
+                            <view>{{parseFloat(item.unitPrice)}}元/{{item.unitName}}</view>
+
+                            <view>{{item.buyNum}} {{item.unitName}}</view>
+
                         </template>
                         <template v-else>
                             <view>{{parseFloat(item.unitPrice)}}/份</view>
@@ -40,25 +42,31 @@ export default {
     components:{},
 	mixins: [productMins],
 	props: {
-		customId: {
+        changeSelectJobType:{
+			type: String,
+			default: 'bill'
+        },
+        changeSelectJobId:{
 			type: Number,
 			default: 0
-		}
+        }
     },
     data(){
         return {
             totalShop:{ bigUnit: 0, smallUnit:0, totalPrice: 0 },
-            itemList:[],
-            selectJobType:'make',
-            selectJobId:0
+            itemList:[]
         }
     },
-    created(){
-    },
     watch:{
-        customId:{
-            handler(newCustomId){
-                this.selectJobId = newCustomId
+        changeSelectJobType:{
+            handler(id){
+                this.selectJobType = id
+            },
+            immediate:true
+        },
+        changeSelectJobId:{
+            handler(id){
+                this.selectJobId = id
             },
             immediate:true
         }

+ 17 - 8
hdPad/src/admin/work/components/rightItemArea.vue

@@ -39,24 +39,33 @@ export default {
             classData:[],
             categoryId: '',
             totalItemData:[],
-            itemInfoList:[],
-            selectJobType:'bill',
-            selectJobId:0
+            itemInfoList:[]
         }
     },
 	props: {
-		customId: {
+        changeSelectJobType:{
+			type: String,
+			default: 'bill'
+        },
+        changeSelectJobId:{
 			type: Number,
 			default: 0
-		}
+        }
     },
     created(){
         this.init()
     },
     watch:{
-        customId:{
-            handler(newCustomId){
-                this.selectJobId = newCustomId
+        changeSelectJobType:{
+            handler(id){
+                console.log('changeSelectJobType',id)
+                this.selectJobType = id
+            },
+            immediate:true
+        },
+        changeSelectJobId:{
+            handler(id){
+                this.selectJobId = id
             },
             immediate:true
         }

+ 1 - 1
hdPad/src/admin/work/make.vue

@@ -44,7 +44,7 @@ export default {
 			selectItemUser:{},
 			isLogin:2,
 			customId:0,
-            selectJobType:'make',
+            selectJobType:'makeWork',
             selectJobId:0,
 			chooseCustomer:false
 		}

+ 21 - 46
hdPad/src/admin/work/modify.vue

@@ -4,11 +4,11 @@
             <view class="nav-left"> </view>
             <!-- 已选花材列表 -->
             <view class="itemList-box">
-                <leftItem></leftItem>
+                <leftItem :changeSelectJobType.sync="selectJobType" :changeSelectJobId.sync="selectJobId"></leftItem>
             </view>
             <!-- 分类和花材图片 -->
             <view class="all-item-area">
-                <rightItemArea> </rightItemArea>
+                <rightItemArea :changeSelectJobType.sync="selectJobType" :changeSelectJobId.sync="selectJobId"> </rightItemArea>
             </view>
             <!-- 按钮操作 -->
             <view class="open-box">
@@ -28,53 +28,23 @@ import { mapGetters } from "vuex";
 import rightItemArea from './components/rightItemArea.vue'
 import leftItem from './components/leftItem.vue'
 import productMins from "@/mixins/product";
+import { getFullInfo } from '@/api/work'
 export default {
 	name: "modify",
 	components: { rightItemArea,leftItem},
 	mixins: [productMins],
 	data() {
 		return {
-			//0成品 1花材
-			currentProperty:0,
-			itemList:[],
-			currenSelectShop:{},
 			selectItem: {},
 			selectItemUser:{},
-			isLogin:2,
-			customId:0,
-            selectJobType:'bill',
+            selectJobType:'modifyWork',
             selectJobId:0,
-			chooseCustomer:false
+			orderItem:[]
 		}
 	},
 	computed: {
 		...mapGetters(["getLoginInfo"])
 	},
-	onLoad() {
-		this.initDataFromStorage()
-	},
-	onPullDownRefresh() {
-	},
-	onShow() {
-	},
-	mounted() {
-		if(this.$util.isEmpty(this.getLoginInfo.admin) || this.getLoginInfo.admin.currentShopId == 0){
-			this.isLogin = 0
-		}else{
-			this.isLogin = 1
-		}
-	},
-	watch:{
-		getLoginInfo: {
-			handler(newValue) {
-				if(this.$util.isEmpty(newValue.admin) == false && newValue.admin.currentShopId > 0){
-					this.isLogin = 1
-				}else{
-					this.isLogin = 0
-				}			
-			}
-		}
-	},
 	methods: {
 		cancel(){
 			uni.navigateBack({delta: 1})
@@ -82,18 +52,23 @@ export default {
 		confirmModify(){
 			uni.navigateBack({delta: 1})
 		},
-		changeProperty(property){
-			this.currentProperty = property
-		},
-		resetCustomer(){
-			this.chooseCustomer = true
-		},
-		selectCustomer(info){
-			this.customId = info.id ? parseInt(info.id) : 0
-			this.selectJobId = this.customId
-		},
-		init() {
+		getOrderDetail(id){
+			getFullInfo({id}).then(res=>{
+				if(res.code == 1){
+					if(res.data.item && !this.$util.isEmpty(res.data.item)){
+						const newItem = res.data.item.map(ele=>{
+							return {property:1,name:ele.name,unitType:ele.unitType,unitPrice:ele.unitPrice,unitName:ele.unitName,buyNum:ele.num,id:ele.id}
+						})
+						this.setSelectInfo({ selectJobType: this.selectJobType, info: newItem,selectJobId:this.selectJobId })
+					}
+				}
+			})
 		},
+		init(){
+			let id = this.option.id || 0
+			this.selectJobId = Number(id)
+			this.getOrderDetail(id)
+		}
 	}
 };
 </script>

+ 25 - 10
hdPad/src/mixins/product.js

@@ -30,14 +30,21 @@ export default {
 		...mapGetters(["getSelectInfo"]),
 		selectList() {
 			let selectInfo = this.getSelectInfo;
+			//console.log('selectInfo',selectInfo,this.selectJobType+'_'+this.selectJobId,selectInfo[this.selectJobType+'_'+this.selectJobId])
 			return selectInfo[this.selectJobType+'_'+this.selectJobId] || []
 		},
 		allPrice() {
 			let price = 0;
-			if (this.selectList) {
-				for (const item of this.selectList) {
-					let currentPrice = this.$util.mul(item.unitPrice,item.buyNum)
-					price = this.$util.add(currentPrice,price)
+			if(!this.$util.isEmpty(this.selectList)){
+				if(this.selectJobType == 'makeWork'){
+
+				}else if(this.selectJobType == 'modifyWork'){
+
+				}else{
+					for (const item of this.selectList) {
+						let currentPrice = this.$util.mul(item.unitPrice,item.buyNum)
+						price = this.$util.add(currentPrice,price)
+					}
 				}
 			}
 			return parseFloat(price)
@@ -45,12 +52,20 @@ export default {
 		allCount() {
 			let bigNum = 0;
 			let smallNum = 0;
-			if (this.selectList) {
-				for (const item of this.selectList) {
-					if(item.unitType == 0){
-						bigNum = this.$util.add(bigNum,item.buyNum)
-					}else{
-						smallNum = this.$util.add(smallNum,item.buyNum)
+			if(!this.$util.isEmpty(this.selectList)){
+				if(this.selectJobType == 'makeWork'){
+
+				}else if(this.selectJobType == 'modifyWork'){
+
+				}else{
+
+				
+					for (const item of this.selectList) {
+						if(item.unitType == 0){
+							bigNum = this.$util.add(bigNum,item.buyNum)
+						}else{
+							smallNum = this.$util.add(smallNum,item.buyNum)
+						}
 					}
 				}
 			}