|
|
@@ -157,6 +157,61 @@
|
|
|
<view class="tabs-name">充值</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 送货上门规则:单独设置时覆盖 xhPsMethod(style=0) 总配置 -->
|
|
|
+ <view class="module-com home-rule-wrap">
|
|
|
+ <view class="home-rule-inner">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">送货上门规则</view>
|
|
|
+ <view class="home-rule-actions">
|
|
|
+ <button class="admin-button-com middle" :class="[homeForm.homeRule == 0 ? 'blue' : 'default']" @click="changeHomeRuleBtn(0)">遵循总设置</button>
|
|
|
+ <button class="admin-button-com middle home-rule-btn-gap" :class="[homeForm.homeRule == 1 ? 'blue' : 'default']" @click="changeHomeRuleBtn(1)">单独设置</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <!-- 单独设置:可编辑客户级覆盖 -->
|
|
|
+ <block v-if="homeForm.homeRule == 1">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">送货上门</view>
|
|
|
+ <view class="home-rule-actions">
|
|
|
+ <button class="admin-button-com middle" :class="[homeForm.home == 1 ? 'blue' : 'default']" @click="changeHomeBtn(1)">启用</button>
|
|
|
+ <button class="admin-button-com middle home-rule-btn-gap" :class="[homeForm.home == 0 ? 'blue' : 'default']" @click="changeHomeBtn(0)">禁用</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" v-if="homeForm.home == 1">
|
|
|
+ <view class="tui-title">最低消费金额</view>
|
|
|
+ <view class="home-rule-input-row">
|
|
|
+ <input v-model="homeForm.homeAmount" @click="homeForm.homeAmount = ''" placeholder-class="phcolor" class="home-rule-input" confirm-type="go" placeholder="不限制填0" type="digit" />
|
|
|
+ <text class="home-rule-unit">元</text>
|
|
|
+ </view>
|
|
|
+ <button class="admin-button-com blue middle" @tap="changeHomeParams">确定</button>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" v-if="homeForm.home == 1">
|
|
|
+ <view class="tui-title">最低消费扎数</view>
|
|
|
+ <view class="home-rule-input-row">
|
|
|
+ <input v-model="homeForm.homeNum" @click="homeForm.homeNum = ''" placeholder-class="phcolor" class="home-rule-input" confirm-type="go" placeholder="不限制填0" type="number" />
|
|
|
+ <text class="home-rule-unit">扎</text>
|
|
|
+ </view>
|
|
|
+ <button class="admin-button-com blue middle" @tap="changeHomeParams">确定</button>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" v-if="homeForm.home == 1">
|
|
|
+ <view class="tui-title">不满最低要求</view>
|
|
|
+ <view class="home-rule-unmeet-group">
|
|
|
+ <button class="admin-button-com middle" :class="[homeForm.homeUnMeet == 0 ? 'blue' : 'default']" @click="homeUnMeetBtn(0)">收运费</button>
|
|
|
+ <button class="admin-button-com middle home-rule-unmeet-gap" :class="[homeForm.homeUnMeet == 2 ? 'blue' : 'default']" @click="homeUnMeetBtn(2)">收包装费</button>
|
|
|
+ <button class="admin-button-com middle home-rule-unmeet-gap" :class="[homeForm.homeUnMeet == 1 ? 'blue' : 'default']" @click="homeUnMeetBtn(1)">不能买</button>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false" v-if="homeForm.home == 1 && homeForm.homeUnMeet != 1">
|
|
|
+ <view class="tui-title">{{ homeUnFeeLabel }}</view>
|
|
|
+ <view class="home-rule-input-row">
|
|
|
+ <input v-model="homeForm.homeUnFee" @click="homeForm.homeUnFee = ''" placeholder-class="phcolor" class="home-rule-input" confirm-type="go" placeholder="请填写" type="digit" />
|
|
|
+ <text class="home-rule-unit">元</text>
|
|
|
+ </view>
|
|
|
+ <button class="admin-button-com blue middle" @tap="changeHomeParams(true)">确定</button>
|
|
|
+ </tui-list-cell>
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
|
|
|
<view class="module-com content_box user-open_bx">
|
|
|
<view class="input-line-wrap">
|
|
|
@@ -510,7 +565,8 @@ import ModalModule from "@/components/plugin/modal";
|
|
|
import { getLevel } from "@/utils/config";
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import { getUserDet, remarkAdd, remarkDel, upgrade, resetPassword } from "@/api/member";
|
|
|
-import { changeName,changeMemberLevel,modifyBirthday,updateBuyAmount,changeVip } from "@/api/custom"
|
|
|
+import { changeName,changeMemberLevel,modifyBirthday,updateBuyAmount,changeVip,toChangeHome,modifyHomeParams } from "@/api/custom"
|
|
|
+import { getPsMethodConfig } from '@/api/ps-method'
|
|
|
import { getLevelInitData } from "@/api/member"
|
|
|
import {toManRecharge} from "@/api/recharge"
|
|
|
import {deductBalance} from "@/api/deduct"
|
|
|
@@ -570,11 +626,26 @@ export default {
|
|
|
rechargeInputFocus: false,
|
|
|
showBalanceDetail: false,
|
|
|
memberLevelSet:0,
|
|
|
- memberLevelData:[]
|
|
|
+ memberLevelData:[],
|
|
|
+ /** 送货上门规则表单,单独设置时覆盖 xhPsMethod(style=0) */
|
|
|
+ homeForm: {
|
|
|
+ home: 1,
|
|
|
+ homeRule: 0,
|
|
|
+ homeAmount: 0,
|
|
|
+ homeNum: 0,
|
|
|
+ homeUnMeet: 0,
|
|
|
+ homeUnFee: 0
|
|
|
+ },
|
|
|
+ /** 门店送货上门总设置(xhPsMethod style=0) */
|
|
|
+ psHomeConfig: null
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters({ levelData: "getLevel" })
|
|
|
+ ...mapGetters({ levelData: "getLevel" }),
|
|
|
+ /** 不满最低要求时的费用标签,与 psMethod 页 unMeet 编码一致 */
|
|
|
+ homeUnFeeLabel() {
|
|
|
+ return Number(this.homeForm.homeUnMeet) === 2 ? '包装费' : '运费'
|
|
|
+ }
|
|
|
},
|
|
|
onLoad(){
|
|
|
getLevelInitData().then(res=>{
|
|
|
@@ -768,9 +839,31 @@ export default {
|
|
|
this.userTagModal = true;
|
|
|
},
|
|
|
initInfo() {
|
|
|
- this.getCustomInfo()
|
|
|
+ this.loadPsHomeConfig().then(() => {
|
|
|
+ this.getCustomInfo()
|
|
|
+ })
|
|
|
getLevel()
|
|
|
},
|
|
|
+ /** 加载门店送货上门总设置 xhPsMethod style=0 */
|
|
|
+ loadPsHomeConfig() {
|
|
|
+ return getPsMethodConfig({ style: 0 }).then(res => {
|
|
|
+ if (res.code == 1 && res.data) {
|
|
|
+ this.psHomeConfig = res.data
|
|
|
+ }
|
|
|
+ }).catch(() => {})
|
|
|
+ },
|
|
|
+ /** 从 xhPsMethod 总设置填充客户单独规则表单 */
|
|
|
+ fillHomeFormFromPsConfig() {
|
|
|
+ if (!this.psHomeConfig) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const cfg = this.psHomeConfig
|
|
|
+ this.homeForm.home = cfg.status != null ? Number(cfg.status) : 1
|
|
|
+ this.homeForm.homeAmount = cfg.minAmount != null ? cfg.minAmount : 0
|
|
|
+ this.homeForm.homeNum = cfg.minNum != null ? cfg.minNum : 0
|
|
|
+ this.homeForm.homeUnMeet = cfg.unMeet != null ? Number(cfg.unMeet) : 0
|
|
|
+ this.homeForm.homeUnFee = cfg.unMeetFee != null ? cfg.unMeetFee : 0
|
|
|
+ },
|
|
|
getCustomInfo() {
|
|
|
getUserDet({ userId: this.option.id }).then(res => {
|
|
|
if (this.$util.isEmpty(res.data)) {
|
|
|
@@ -781,8 +874,136 @@ export default {
|
|
|
this.debtAmount = res.data.debtAmount?parseFloat(res.data.debtAmount):0;
|
|
|
this.buyAmount = res.data.buyAmount?parseFloat(res.data.buyAmount):0;
|
|
|
this.balance = res.data.balance?parseFloat(res.data.balance):0;
|
|
|
+ this.syncHomeFormFromData(res.data);
|
|
|
})
|
|
|
},
|
|
|
+ /** 从客户详情同步送货上门规则字段 */
|
|
|
+ syncHomeFormFromData(customData) {
|
|
|
+ if (!customData || !customData.id) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const homeRule = customData.homeRule != null ? Number(customData.homeRule) : 0;
|
|
|
+ this.homeForm.homeRule = homeRule;
|
|
|
+
|
|
|
+ // 单独设置:先按 xhPsMethod 总设置预填,再用客户已保存值覆盖
|
|
|
+ if (homeRule === 1 && this.psHomeConfig) {
|
|
|
+ this.fillHomeFormFromPsConfig();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (customData.home != null) {
|
|
|
+ this.homeForm.home = Number(customData.home);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (homeRule === 1) {
|
|
|
+ const psUnMeet = this.psHomeConfig && this.psHomeConfig.unMeet != null
|
|
|
+ ? Number(this.psHomeConfig.unMeet)
|
|
|
+ : 0;
|
|
|
+ const hasSavedHomeParams = Number(customData.homeAmount || 0) > 0
|
|
|
+ || Number(customData.homeNum || 0) > 0
|
|
|
+ || Number(customData.homeUnFee || 0) > 0
|
|
|
+ || (customData.homeUnMeet != null && Number(customData.homeUnMeet) !== psUnMeet);
|
|
|
+
|
|
|
+ if (customData.homeUnMeet != null) {
|
|
|
+ this.homeForm.homeUnMeet = Number(customData.homeUnMeet);
|
|
|
+ }
|
|
|
+ if (hasSavedHomeParams) {
|
|
|
+ if (customData.homeAmount != null && customData.homeAmount !== '') {
|
|
|
+ this.homeForm.homeAmount = customData.homeAmount;
|
|
|
+ }
|
|
|
+ if (customData.homeNum != null && customData.homeNum !== '') {
|
|
|
+ this.homeForm.homeNum = customData.homeNum;
|
|
|
+ }
|
|
|
+ if (customData.homeUnFee != null && customData.homeUnFee !== '') {
|
|
|
+ this.homeForm.homeUnFee = customData.homeUnFee;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 保存送货上门相关参数
|
|
|
+ * @param {boolean} validateFee - 是否校验运费/包装费
|
|
|
+ */
|
|
|
+ changeHomeParams(validateFee = false) {
|
|
|
+ if (this.$util.isEmpty(this.homeForm.homeAmount)) {
|
|
|
+ this.$msg('请填写最低消费金额');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (this.$util.isEmpty(this.homeForm.homeNum)) {
|
|
|
+ this.$msg('请填写最低消费扎数');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const homeUnMeet = Number(this.homeForm.homeUnMeet) || 0;
|
|
|
+ if (validateFee && homeUnMeet !== 1 && this.$util.isEmpty(this.homeForm.homeUnFee)) {
|
|
|
+ this.$msg(homeUnMeet === 2 ? '请填写包装费' : '请填写运费');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ modifyHomeParams({
|
|
|
+ id: this.data.id,
|
|
|
+ homeRule: this.homeForm.homeRule,
|
|
|
+ homeAmount: this.homeForm.homeAmount,
|
|
|
+ homeNum: this.homeForm.homeNum,
|
|
|
+ homeUnMeet: homeUnMeet,
|
|
|
+ homeUnFee: homeUnMeet === 1 ? 0 : (this.homeForm.homeUnFee || 0)
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.$msg(res.msg || '修改成功');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 切换不满最低要求时的处理方式(0收运费 2收包装费 1不能买) */
|
|
|
+ homeUnMeetBtn(value) {
|
|
|
+ if (Number(this.homeForm.homeUnMeet) === value) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ this.homeForm.homeUnMeet = value;
|
|
|
+ modifyHomeParams({
|
|
|
+ id: this.data.id,
|
|
|
+ homeRule: this.homeForm.homeRule,
|
|
|
+ homeAmount: this.homeForm.homeAmount,
|
|
|
+ homeNum: this.homeForm.homeNum,
|
|
|
+ homeUnMeet: value,
|
|
|
+ homeUnFee: value === 1 ? 0 : (this.homeForm.homeUnFee || 0)
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.$msg(res.msg || '修改成功');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 切换遵循总设置 / 单独设置 */
|
|
|
+ changeHomeRuleBtn(value) {
|
|
|
+ if (Number(this.homeForm.homeRule) === value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 切到单独设置时,先用总设置预填,避免界面全是 0
|
|
|
+ if (Number(value) === 1) {
|
|
|
+ this.fillHomeFormFromPsConfig();
|
|
|
+ }
|
|
|
+ this.homeForm.homeRule = value;
|
|
|
+ modifyHomeParams({
|
|
|
+ id: this.data.id,
|
|
|
+ homeRule: value,
|
|
|
+ homeAmount: this.homeForm.homeAmount,
|
|
|
+ homeNum: this.homeForm.homeNum,
|
|
|
+ homeUnMeet: this.homeForm.homeUnMeet,
|
|
|
+ homeUnFee: Number(this.homeForm.homeUnMeet) === 1 ? 0 : (this.homeForm.homeUnFee || 0)
|
|
|
+ }).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.$msg(res.msg || '修改成功');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 切换客户送货上门启用状态 */
|
|
|
+ changeHomeBtn(value) {
|
|
|
+ if (Number(this.homeForm.home) === value) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.homeForm.home = value;
|
|
|
+ toChangeHome({ customId: this.data.id, home: value }).then(res => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ this.$msg(res.msg || '修改成功');
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
handleUpdateBuyAmount() {
|
|
|
uni.showLoading()
|
|
|
updateBuyAmount({ customId: this.option.id }).then(res => {
|
|
|
@@ -955,6 +1176,73 @@ export default {
|
|
|
box-shadow: 0upx 6upx 16upx #ddd;
|
|
|
border-radius: 10upx;
|
|
|
}
|
|
|
+
|
|
|
+// 送货上门规则(客户级,覆盖 xhPsMethod 总设置)
|
|
|
+.home-rule-wrap {
|
|
|
+ padding: 0;
|
|
|
+ overflow: hidden;
|
|
|
+
|
|
|
+ .home-rule-inner {
|
|
|
+ border: 2upx solid #cccccc;
|
|
|
+ border-radius: 10upx;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ .line-cell {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .tui-title {
|
|
|
+ font-size: 30upx;
|
|
|
+ color: #333333;
|
|
|
+ width: 200upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-rule-actions {
|
|
|
+ margin-left: auto;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-rule-btn-gap {
|
|
|
+ margin-left: 20upx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-rule-input-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex: 1;
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-rule-input {
|
|
|
+ width: 245upx;
|
|
|
+ border: 1upx solid #dddddd;
|
|
|
+ margin-right: 10upx;
|
|
|
+ height: 70upx;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 30upx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-rule-unit {
|
|
|
+ margin-right: 30upx;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #666666;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-rule-unmeet-group {
|
|
|
+ margin-left: auto;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ justify-content: flex-end;
|
|
|
+ }
|
|
|
+
|
|
|
+ .home-rule-unmeet-gap {
|
|
|
+ margin-left: 4upx;
|
|
|
+ }
|
|
|
+}
|
|
|
// 用户信息
|
|
|
.user-info {
|
|
|
padding: 30upx 30upx 40upx;
|