Explorar el Código

超级会员价 批量操作

shish hace 3 años
padre
commit
63d81f801b

+ 1 - 1
ghsApp/src/admin/itemClass/add.vue

@@ -9,7 +9,7 @@
 						{{ item.name || '' }}
 						</div>
 						<div class="list-operate">
-							<text class="add-price">批量修改</text>
+							<text class="add-price">修改加价</text>
 						</div>
 					</div>
 				</div>

+ 61 - 60
ghsApp/src/admin/itemClass/addPrice.vue

@@ -2,30 +2,52 @@
 	<view class="app-content">
 		<view v-if="!$util.isEmpty(list.data)" style="padding-bottom:120upx;">
 			<t-table :headerBackgroundColor="'#F0F2F6'">
-				<view style="position:fixed;width:100%;top:0;z-index:99999">
+				<view style="position:fixed;width:100%;top:0;z-index:99">
 					<t-tr header>
 						<t-th><view style="color:black;">名称</view></t-th>
 						<t-th>
 							<view style="color:black;">
-								<view>零售价</view>
-								<view>比成本加</view>
+								<view>会员价</view>
+								<view>比成本加</view>
 							</view>
 						</t-th>
 						<t-th>
 							<view style="color:black;">
 								<view>批发价</view>
-								<view>比成本加</view>
+								<view>比成本加</view>
 							</view>
 						</t-th>
 						<t-th>
 							<view style="color:black;">
-								<view>会员价</view>
-								<view>比成本加</view>
+								<view>零售价</view>
+								<view>比成本加</view>
 							</view>
 						</t-th>
 					</t-tr>
 				</view>
 				<view style="margin-top:115upx;">
+
+				<t-tr>
+					<t-td align="center" color="info">
+						<view></view>
+					</t-td>
+					<t-td align="center" color="info">
+						<view>
+							<button class="admin-button-com mini-btn blue" @click="modify(3)">整列修改</button>
+						</view>
+					</t-td>
+					<t-td align="center" color="info">
+						<view>
+							<button class="admin-button-com mini-btn blue" @click="modify(2)">整列修改</button>
+						</view>
+					</t-td>
+					<t-td align="center" color="info">
+						<view>
+							<button class="admin-button-com mini-btn blue" @click="modify(1)">整列修改</button>
+						</view>
+					</t-td>
+				</t-tr>
+
 				<view v-for="(item, index) in list.data" :key="index">
 					<t-tr>
                         <t-td align="center" color="info">
@@ -33,19 +55,19 @@
 						</t-td>
 						<t-td align="center" color="info">
                             <view>
-							<input v-model="item.skMore" @focus="item.skMore=''" name="skMore" 
+							<input v-model="item.hjAddPrice" name="hjAddPrice" 
 							type="digit" style="border:1upx solid #cccccc;color:#333333;" />
 							</view>
                         </t-td>
 						<t-td align="center" color="info">
                             <view>
-							<input v-model="item.addPrice" @focus="item.addPrice=''" name="price" 
+							<input v-model="item.addPrice" name="addPrice" 
 							type="digit" style="border:1upx solid #cccccc;color:#333333;" />
 							</view>
                         </t-td>
 						<t-td align="center" color="info">
                             <view>
-							<input v-model="item.addPrice" @focus="item.addPrice=''" name="price" 
+							<input v-model="item.skMore" name="skMore" 
 							type="digit" style="border:1upx solid #cccccc;color:#333333;" />
 							</view>
                         </t-td>
@@ -58,7 +80,6 @@
 			<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
 		</view>
         <view class="app-footer">
-            <view style="margin-left:20upx;" class="admin-button-com middle blue" @click="showBatchUpdate('update')">选择要修改的列</view>
 		    <view style="margin-left:20upx;" class="admin-button-com middle blue" @click="savePrice">保存修改</view>
 		</view>
 
@@ -66,9 +87,9 @@
 			<template slot="customContent">
 				<view class="select-cmd_bx">
 					<view class="num_bx" style="margin:60upx 0 60upx 0;font-size:35upx;">
-						<view class="flex">金额:
-						<input v-model="batchPrice" placeholder="填写要批量修改的金额" 
-						type="digit" style="border:1upx solid #CCCCCC;height:60upx;" />
+						<view class="flex">
+						<input v-model="batchPrice" placeholder="填写金额" 
+						type="digit" style="border:1upx solid #CCCCCC;height:60upx;margin:0 auto;text-align:center;" />
 						</view>
 					</view>
 				</view>
@@ -92,30 +113,16 @@ export default {
 	data() {
 		return {
             batchModel:false,
-            batchStyle:'add',
             batchPrice:'',
             focusOn:false,
             levelIndex:0
 		};
 	},
 	methods: {
-        showBatchUpdate(styleInfo){
-            if (this.$util.isEmpty(this.list.data)){
-                this.$msg('没有花材')
-                return false
-            }
-
-            this.batchStyle = styleInfo
-			let self = this
-			let levelList = ['请选择:','零售价比成本贵', '批发价比成本贵']
-			uni.showActionSheet({
-				itemList: levelList,
-				success: function (respond) {
-					self.levelIndex = respond.tapIndex
-                    self.batchModel = true
-				}
-			})
-        },
+		modify(index){
+			this.levelIndex = index
+			this.batchModel = true
+		},
 		affirmBatch(val) {
             let that = this
 			if (val.index === 0) {
@@ -128,23 +135,15 @@ export default {
                 }
                 let currentPrice = Number(this.batchPrice)
                 this.list.data.forEach(function(value,index,array){
-                    if(that.batchStyle =='add'){
-                        if(that.levelIndex == 1){
-                            array[index].skMore =  parseFloat((Number(array[index].skMore) + currentPrice).toFixed(2))
-                        }else if(that.levelIndex == 2){
-                            array[index].addPrice =  parseFloat((Number(array[index].addPrice) + currentPrice).toFixed(2))
-                        }else{
-
-                        }
-                    }else{
-                        if(that.levelIndex == 1){
-                            array[index].skMore =  parseFloat((currentPrice).toFixed(2))
-                        }else if(that.levelIndex == 2){
-                            array[index].addPrice =  parseFloat((currentPrice).toFixed(2))
-                        }else{
-
-                        }
-                    }
+					if(that.levelIndex == 1){
+						array[index].skMore = parseFloat((currentPrice).toFixed(2))
+					}
+					if(that.levelIndex == 2){
+						array[index].addPrice = parseFloat((currentPrice).toFixed(2))
+					}
+					if(that.levelIndex == 3){
+						array[index].hjAddPrice = parseFloat((currentPrice).toFixed(2))
+					}
 				});
                 this.batchPrice = ''
                 this.batchModel = false;
@@ -155,20 +154,22 @@ export default {
            let addData = [];
            uni.showLoading({mask:true})
            this.list.data.forEach(function(value,index,array){
-
-               if(that.$util.isMoney(value.skMore) == false){
-                   that.$msg('【'+value.name+'】的 零售价比成本贵 填写错误')
-                   return false
-               }
-               if(that.$util.isMoney(value.addPrice) == false){
-                   that.$msg('【'+value.name+'】的 批发价比成本贵 填写错误')
-                   return false
-               }
-
-                addData.push({id:value.id,skMore:value.skMore,addPrice:value.addPrice})
+				if(that.$util.isMoney(value.skMore) == false){
+					that.$msg('【'+value.name+'】的 填写错误')
+					return false
+				}
+				if(that.$util.isMoney(value.addPrice) == false){
+					that.$msg('【'+value.name+'】的 填写错误')
+					return false
+				}
+				if(that.$util.isMoney(value.hjAddPrice) == false){
+					that.$msg('【'+value.name+'】的 填写错误')
+					return false
+				}
+            	addData.push({id:value.id,skMore:value.skMore,addPrice:value.addPrice,hjAddPrice:value.hjAddPrice})
            })
            let addString = JSON.stringify(addData)
-           batchChangeAddPrice({addData:addString}).then(res=>{
+           batchChangeAddPrice({addData:addString,appVersion:1}).then(res=>{
                uni.hideLoading()
                if(res.code == 1){
                     setTimeout(function(){

+ 5 - 49
ghsApp/src/admin/itemClass/more.vue

@@ -5,7 +5,6 @@
 				<t-tr header>
                     <t-th><view style="color:black;">名称</view></t-th>
 					<t-th><view style="color:black;">排序</view></t-th>
-					<t-th><view style="color:black;">保鲜天数</view></t-th>
 				</t-tr>
 				<view v-for="(item, index) in list.data" :key="index">
 					<t-tr>
@@ -17,12 +16,6 @@
 							<input v-model="item.inTurn" @focus="item.inTurn=''" name="inTurn" 
 							type="number" style="border:1upx solid #cccccc;color:#333333;" />
 							</view>
-                        </t-td>
-						<t-td align="center" color="info">
-                            <view>
-							<input v-model="item.shelfLife" @focus="item.shelfLife=''" name="shelfLife" 
-							type="digit" style="border:1upx solid #cccccc;color:#333333;" />
-							</view>
                         </t-td>
 					</t-tr>
 				</view>
@@ -32,7 +25,6 @@
 			<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
 		</view>
         <view class="app-footer">
-            <view style="margin-left:20upx;" class="admin-button-com middle blue" @click="showBatchUpdate('update')">选择要修改的列</view>
 		    <view style="margin-left:20upx;" class="admin-button-com middle blue" @click="savePrice">保存修改</view>
 		</view>
 
@@ -40,9 +32,9 @@
 			<template slot="customContent">
 				<view class="select-cmd_bx">
 					<view class="num_bx" style="margin:60upx 0 60upx 0;font-size:35upx;">
-						<view class="flex">数值:
-						<input v-model="batchNum" placeholder="填写要批量修改的数值" 
-						type="digit" style="border:1upx solid #CCCCCC;height:60upx;" />
+						<view class="flex">
+						<input v-model="batchNum" placeholder="填写数值" 
+						type="digit" style="border:1upx solid #CCCCCC;height:60upx;margin:0 auto;text-align:center;" />
 						</view>
 					</view>
 				</view>
@@ -51,7 +43,6 @@
 
 	</view>
 </template>
-
 <script>
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { productList,batchChangeMore } from '@/api/product'
@@ -66,29 +57,10 @@ export default {
 	data() {
 		return {
             batchModel:false,
-            batchStyle:'add',
-            batchNum:'',
-            focusOn:false,
-            levelIndex:0
+            batchNum:''
 		};
 	},
 	methods: {
-        showBatchUpdate(styleInfo){
-            if (this.$util.isEmpty(this.list.data)){
-                this.$msg('没有花材')
-                return false
-            }
-            this.batchStyle = styleInfo
-			let self = this
-			let levelList = ['请选择:','排序', '保持期']
-			uni.showActionSheet({
-				itemList: levelList,
-				success: function (respond) {
-					self.levelIndex = respond.tapIndex
-                    self.batchModel = true
-				}
-			})
-        },
 		affirmBatch(val) {
             let that = this
 			if (val.index === 0) {
@@ -101,23 +73,7 @@ export default {
                 }
                 let currentNum = Number(this.batchNum)
                 this.list.data.forEach(function(value,index,array){
-                    if(that.batchStyle =='add'){
-                        if(that.levelIndex == 1){
-                            array[index].inTurn =  parseFloat((Number(array[index].inTurn) + currentNum).toFixed(2))
-                        }else if(that.levelIndex == 2){
-                            array[index].shelfLife =  parseFloat((Number(array[index].shelfLife) + currentNum).toFixed(2))
-                        }else{
-
-                        }
-                    }else{
-                        if(that.levelIndex == 1){
-                            array[index].inTurn =  parseFloat((currentNum).toFixed(2))
-                        }else if(that.levelIndex == 2){
-                            array[index].shelfLife =  parseFloat((currentNum).toFixed(2))
-                        }else{
-
-                        }
-                    }
+					array[index].inTurn =  parseFloat((currentNum).toFixed(2))
 				});
                 this.batchNum = ''
                 this.batchModel = false;

+ 2 - 2
ghsApp/src/admin/itemClass/sort.vue

@@ -1,5 +1,5 @@
 <template>
-	<div class="app-content" @click="globalClick">
+	<div class="app-content">
 		<div class="list-wrap">
 			<block v-if="!$util.isEmpty(list.data)">
 				<div class="list" v-for="(item, index) in list.data" :key="index">
@@ -9,7 +9,7 @@
 						{{ item.name || '' }}
 						</div>
 						<div class="list-operate">
-							<text class="add-price">批量修改</text>
+							<text class="add-price">修改排序</text>
 						</div>
 					</div>
 				</div>