Ver código fonte

新增“现有生效”按钮,实现批量上门最低消费设置

shizhongqi 9 meses atrás
pai
commit
366d8fd1b7
2 arquivos alterados com 57 adições e 5 exclusões
  1. 53 5
      ghsApp/src/admin/custom/set.vue
  2. 4 0
      ghsApp/src/api/custom/index.js

+ 53 - 5
ghsApp/src/admin/custom/set.vue

@@ -39,10 +39,18 @@
 
 				<tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
 					<view class="tui-title">上门最低消费</view>
-					<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="width:37%;border:1upx solid #ddd;margin-left:8upx;height:70upx;text-align:center;" />
+					<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>
+
+						<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">
@@ -65,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 } from "@/api/custom"
+import { setChange,setCheck,setShowStock,modifyAllHomeAmount } from "@/api/custom"
 export default {
 	name: 'set',
 	components: {
@@ -123,6 +131,19 @@ export default {
 		homeChange(e){
 			this.form.home = e.target.value ? 1 : 0
 		},
+		submitHomeDelivery() {
+			const homeData = {
+				homeType: this.form.homeType,
+				homeAmount: this.form.homeAmount
+			}
+			modifyAllHomeAmount(homeData).then(res => {
+				uni.hideLoading()
+				this.$msg('上门最低消费设置成功')
+				setTimeout(() => {
+					this.getShopInfo()
+				}, 1500)
+			})
+		},
 		toSubmit() {
 			uni.showLoading({title: '稍等几秒...',mask:true})
 			setChange(this.form).then(res => {
@@ -173,4 +194,31 @@ export default {
 			width: 100%;
 		}
 	}
+	.btn-row {
+		width: 100%;
+		margin-top: 20upx;
+		display: flex;
+		justify-content: flex-start;
+		.admin-button-com {
+			width: auto;
+		}
+	}
+	.home-delivery-wrap {
+		width: 100%;
+		display: flex;
+		flex-direction: column;
+	}
+	.home-delivery-row {
+		width: 100%;
+		display: flex;
+		align-items: center;
+		flex-wrap: wrap;
+	}
+	.home-delivery-wrap .btn-row {
+		justify-content: flex-end;
+		margin-top: 20upx;
+		.admin-button-com {
+			width: 100%;
+		}
+	}
 </style>

+ 4 - 0
ghsApp/src/api/custom/index.js

@@ -52,6 +52,10 @@ export const modifyHomeAmount = data => {
 	return https.get('/custom/modify-home-amount', data)
 }
 
+export const modifyAllHomeAmount = data => {
+	return https.get('/custom/modify-all-home-amount', data)
+}
+
 export const changeWlName = data => {
 	return https.get('/custom/change-wl-name', data)
 }