Browse Source

客户设置

shish 6 months ago
parent
commit
a2708b4967

+ 35 - 39
ghsApp/src/admin/custom/set.vue

@@ -7,7 +7,7 @@
 					<view class="tui-title">新客享受价格</view>
 					<view>
 						<button class="admin-button-com middle" :class="[form.isHd == 1 ? 'blue' : 'default']" @click="form.isHd = 1">批发价</button>
-						<button class="admin-button-com middle" :class="[form.isHd == 0 ? 'blue' : 'default']" @click="form.isHd = 0" style="margin-left:8upx;">零售价</button>
+						<button class="admin-button-com middle" :class="[form.isHd == 0 ? 'blue' : 'default']" @click="form.isHd = 0" style="margin-left:30upx;">零售价</button>
 					</view>
 				</tui-list-cell>
 
@@ -31,30 +31,27 @@
 						<switch style="transform:scale(0.7,0.7)" :checked="form.needCheck == 0 ? false : true" @change="needCheckChange" /> {{form.needCheck==0 ? '不要' : '需要'}}
 					</view>
 				</tui-list-cell>
-
-				<tui-list-cell class="line-cell" :hover="false">
-					<view class="tui-title">新客送货上门</view>
-					<view>
-						<switch style="transform:scale(0.7,0.7)" :checked="form.home == 0 ? false : true" @change="homeChange" /> {{form.home==1 ? '支持' : '不支持'}}
-					</view>
-				</tui-list-cell>
-
-				<tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
-					<view class="tui-title">上门最低消费</view>
-					<view class="home-delivery-wrap">
-						<view class="home-delivery-row">
-							<button class="admin-button-com middle" :class="[form.homeType == 0 ? 'blue' : 'default']" @click="form.homeType=0">金额</button>
-							<button class="admin-button-com middle" :class="[form.homeType == 1 ? 'blue' : 'default']" @click="form.homeType=1" style="margin-left:8upx;">扎数</button>
-							<input v-model="form.homeAmount" placeholder-class="phcolor" @focus="form.homeAmount=''" class="tui-input" name="homeAmount" placeholder="输数值,没门槛填0" type="digit"
-							style="flex:1;border:1upx solid #ddd;margin-left:8upx;height:70upx;text-align:center;" />
+				<view style="border:1upx solid #CCCCCC;margin:0 10upx 0 10upx;">
+					<tui-list-cell class="line-cell" :hover="false">
+						<view class="tui-title">新客送货上门</view>
+						<view>
+							<switch style="transform:scale(0.7,0.7)" :checked="form.home == 0 ? false : true" @change="homeChange" /> {{form.home==1 ? '支持' : '不支持'}}
 						</view>
+					</tui-list-cell>
 
-						<view class="btn-row">
-							<button class="admin-button-com middle blue" @click="submitHomeDelivery">已有客户生效</button>
-						</view>
-					</view>
-				</tui-list-cell>
-
+					<tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
+						<view class="tui-title">最低消费金额</view>
+						<input v-model="form.homeAmount" placeholder-class="phcolor" @focus="form.homeAmount=''" class="tui-input" name="homeAmount" placeholder="输入数值" type="digit" style="border:1upx solid #ddd;height:70upx;text-align:center;width:260upx;" />
+					</tui-list-cell>
+					<tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
+						<view class="tui-title">最低消费数量</view>
+						<input v-model="form.homeNum" placeholder-class="phcolor" @focus="form.homeNum=''" class="tui-input" name="homeNum" placeholder="输入数值" type="number" style="border:1upx solid #ddd;height:70upx;text-align:center;width:260upx;" />
+					</tui-list-cell>
+					<tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
+						<view class="tui-title">已有客户生效</view>
+						<button class="admin-button-com middle blue" @click="submitHomeDelivery">需要生效</button>
+					</tui-list-cell>
+				</view>
 				<tui-list-cell class="line-cell" :hover="false">
 					<view class="tui-title">客户查看销量</view>
 					<view>
@@ -76,7 +73,7 @@ import AppAvatarModule from '@/components/module/app-avatar'
 import AppAreaSel from '@/components/app-area-sel'
 import AppUploader from "@/components/app-uploader";
 import { getDetail } from '@/api/shop'
-import { setChange,setCheck,setShowStock,modifyAllHomeAmount,allCredit,allSetLookStock,allSetLookSale } from "@/api/custom"
+import { setChange,setCheck,setShowStock,modifyAllHomeParams,allCredit,allSetLookStock,allSetLookSale } from "@/api/custom"
 export default {
 	name: 'set',
 	components: {
@@ -91,7 +88,7 @@ export default {
 				needCheck:0,
 				home:1,
 				homeAmount:0,
-				homeType:0,
+				homeNum:0,
 				allowDebtAmount:5000,
 				showStock:1,
 				showSold:0,
@@ -162,25 +159,24 @@ export default {
 			})
 		},
 		submitHomeDelivery() {
-			const homeData = {
-				homeType: this.form.homeType,
-				homeAmount: this.form.homeAmount
-			}
-			this.$util.confirmModal({content:'确认全部生效?'},() => {
-				modifyAllHomeAmount(homeData).then(res => {
+			const homeData = {homeAmount: this.form.homeAmount,homeNum: this.form.homeNum}
+			this.$util.confirmModal({content:'确认已存在客户要生效?'},() => {
+				modifyAllHomeParams(homeData).then(res => {
 					uni.hideLoading()
-					this.$msg('设置成功')
+					this.$msg('已操作成功')
 				})
 			})
 		},
 		toSubmit() {
-			uni.showLoading({title: '稍等几秒...',mask:true})
-			setChange(this.form).then(res => {
-				uni.hideLoading()
-				this.$msg('修改成功')
-				setTimeout(() => {
-					this.$util.pageTo(1)
-				}, 1000)
+			this.$util.confirmModal({content:'确认提交修改?'},() => {
+				uni.showLoading({})
+				setChange(this.form).then(res => {
+					uni.hideLoading()
+					this.$msg('修改成功')
+					setTimeout(() => {
+						this.$util.pageTo(1)
+					}, 1000)
+				})
 			})
 		}
 	}

+ 2 - 2
ghsApp/src/api/custom/index.js

@@ -48,11 +48,11 @@ export const modifyShortName = data => {
 	return https.get('/custom/modify-short-name', data)
 }
 
-export const modifyHomeAmount = data => {
+export const modifyHomeParams = data => {
 	return https.get('/custom/modify-home-amount', data)
 }
 
-export const modifyAllHomeAmount = data => {
+export const modifyAllHomeParams = data => {
 	return https.get('/custom/modify-all-home-amount', data)
 }
 

+ 35 - 23
ghsApp/src/pagesClient/member/detail.vue

@@ -179,24 +179,27 @@
                 <switch :checked="form.passStatus == 0 ? false : true" @change="passStatusChangeFn" style="transform: scale(0.8,0.8)" />
               </div>
             </tui-list-cell>
-
-            <tui-list-cell class="line-cell" :hover="false">
-              <div class="tui-title">送货上门</div>
-              <div class="switch_bx">
-                <text v-if="form.home == 0">不支持</text>
-                <text v-else>支持</text>
-                <switch :checked="form.home == 0 ? false : true" @change="homeChangeFn" style="transform: scale(0.8,0.8)" />
-              </div>
-            </tui-list-cell>
-
-            <tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
-              <div class="tui-title">上门最低消费</div>
-              <button class="admin-button-com middle" :class="[userInfo.homeType == 0 ? 'blue' : 'default']" @click="userInfo.homeType=0">金额</button>
-              <button class="admin-button-com middle" :class="[userInfo.homeType == 1 ? 'blue' : 'default']" @click="userInfo.homeType=1" style="margin-left:5upx;margin-right:5upx;">扎数</button>
-              <input v-model="userInfo.homeAmount" @click="userInfo.homeAmount=''" placeholder-class="phcolor" class="tui-input" confirm-type="go" placeholder="不限填0" type="digit" style="width:100upx;border:1upx solid #ddd;margin-right:5upx;height:70upx;text-align:center;" />
-              <button class="admin-button-com blue middle" @tap="changeHomeAmount">确定</button>
-            </tui-list-cell>
-
+            <view style="border:1upx solid #CCCCCC;">
+              <tui-list-cell class="line-cell" :hover="false">
+                <div class="tui-title">送货上门</div>
+                <div class="switch_bx">
+                  <text v-if="form.home == 0">不支持</text>
+                  <text v-else>支持</text>
+                  <switch :checked="form.home == 0 ? false : true" @change="homeChangeFn" style="transform: scale(0.8,0.8)" />
+                </div>
+              </tui-list-cell>
+
+              <tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
+                <div class="tui-title">最低消费金额</div>
+                <input v-model="userInfo.homeAmount" @click="userInfo.homeAmount=''" placeholder-class="phcolor" class="tui-input" confirm-type="go" placeholder="不限制填0" type="digit" style="width:260upx;border:1upx solid #ddd;margin-right:30upx;height:70upx;text-align:center;" />
+                <button class="admin-button-com blue middle" @tap="changeHomeParams">确定</button>
+              </tui-list-cell>
+              <tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
+                <div class="tui-title">最低消费扎数</div>
+                <input v-model="userInfo.homeNum" @click="userInfo.homeNum=''" placeholder-class="phcolor" class="tui-input" confirm-type="go" placeholder="不限制填0" type="digit" style="width:260upx;border:1upx solid #ddd;margin-right:30upx;height:70upx;text-align:center;" />
+                <button class="admin-button-com blue middle" @tap="changeHomeParams">确定</button>
+              </tui-list-cell>
+            </view>
             <tui-list-cell class="line-cell" :hover="false">
               <div class="tui-title">查看库存</div>
               <div class="switch_bx">
@@ -340,7 +343,7 @@ import ModalModule from "@/components/plugin/modal"
 import { getUserDet,debt} from "@/api/member";
 import { IMGHOST } from '@/config'
 import { mapGetters } from "vuex"
-import { changeShowStock,changePassStatus,toChangeHome,changeWlName,modifyShortName,modifyHomeAmount,changeLevel,changeDebtLimitPay,createSeatSnFn,modifySeatSnFn,changeDelStatus } from "@/api/custom"
+import { changeShowStock,changePassStatus,toChangeHome,changeWlName,modifyShortName,modifyHomeParams,changeLevel,changeDebtLimitPay,createSeatSnFn,modifySeatSnFn,changeDelStatus } from "@/api/custom"
 import { updateDebtLimit,updateCustomBlack,changeDiscount,changeName,rechargeFn,getGatheringCode} from "@/api/custom";
 import { getAllDist,changeDist } from "@/api/dist"
 export default {
@@ -363,6 +366,7 @@ export default {
         passStatus:0,
         home:1,
         homeAmount:0,
+        homeNum:0,
         wlId:0,
         level:1,
         staffName:'',
@@ -558,10 +562,18 @@ export default {
         })
       })
     },
-    changeHomeAmount(){
-      let homeAmount = this.userInfo.homeAmount||0
-      let homeType = this.userInfo.homeType||0
-      modifyHomeAmount({id:this.option.id,homeAmount:homeAmount,homeType:homeType}).then(res=>{
+    changeHomeParams(){
+      if(this.$util.isEmpty(this.userInfo.homeAmount)){
+        this.$msg('请填写最低消费金额')
+        return false
+      }
+      if(this.$util.isEmpty(this.userInfo.homeNum)){
+        this.$msg('请填写最低消费扎数')
+        return false
+      }
+      let homeAmount = this.userInfo.homeAmount
+      let homeNum = this.userInfo.homeNum
+      modifyHomeParams({id:this.option.id,homeAmount:homeAmount,homeNum:homeNum}).then(res=>{
         if(res.code == 1){
           this.$msg(res.msg)
         }