shish 11 mesi fa
parent
commit
6daf297760

+ 4 - 0
hdPad/src/api/member/index.js

@@ -49,4 +49,8 @@ export const getCustomDetail = data => {
  */
  */
 export const updateCustomBirthday = data => {
 export const updateCustomBirthday = data => {
 	return https.post("/custom/update-birthday", data);
 	return https.post("/custom/update-birthday", data);
+};
+
+export const getWeal = data => {
+	return https.get("/member-weal/get-weal", data);
 };
 };

+ 6 - 1
hdPad/src/api/recharge/index.js

@@ -21,4 +21,9 @@ export const saveRechargeHb = async data => {
 //客户充值记录
 //客户充值记录
 export const customRechargeList = data => {
 export const customRechargeList = data => {
 	return https.get('/recharge/custom-list', data)
 	return https.get('/recharge/custom-list', data)
-}
+}
+
+//手动给客户充值
+export const toManRecharge = data => {
+	return https.post("/recharge/man-recharge", data);
+};

+ 1 - 1
hdPad/src/pages/home/components/customInfo.vue

@@ -154,7 +154,7 @@ export default {
       this.$emit('goBalance')
       this.$emit('goBalance')
     },
     },
     goRecharge(){
     goRecharge(){
-
+      this.$emit('goRecharge')
     },
     },
     goOrder(){
     goOrder(){
 
 

+ 369 - 0
hdPad/src/pages/home/components/recharge.vue

@@ -0,0 +1,369 @@
+<template>
+  <view class="recharge-wrapper">
+    <scroll-view class="recharge-scroll" scroll-y="true">
+      <view class="recharge-container">
+        <!-- 充值金额输入 -->
+        <view class="input-section">
+          <view class="input-label">充值金额</view>
+          <view class="input-wrapper">
+            <input 
+              type="digit" 
+              placeholder="请输入金额" 
+              v-model="rForm.rechargeAmount" 
+              :adjust-position="false" 
+              class="amount-input"
+              :focus="rechargeInputFocus"
+              :cursor-spacing="20"
+              confirm-type="done"
+              confirm-hold="true"
+              @blur="onRechargeInputBlur"
+            />
+          </view>
+        </view>
+
+        <!-- 付款方式 -->
+        <view class="input-section">
+          <view class="input-label">付款方式</view>
+          <view class="payment-buttons">
+            <button 
+              class="admin-button-com middle" 
+              :class="[rForm.rechargePayWay == 0 ? 'blue' : 'default']" 
+              @click="rForm.rechargePayWay = 0"
+            >微信</button>
+            <button 
+              class="admin-button-com middle" 
+              :class="[rForm.rechargePayWay == 1 ? 'blue' : 'default']" 
+              @click="rForm.rechargePayWay = 1"
+            >支付宝</button>
+            <button 
+              class="admin-button-com middle" 
+              :class="[rForm.rechargePayWay == 4 ? 'blue' : 'default']" 
+              @click="rForm.rechargePayWay = 4"
+            >现金</button>
+            <button 
+              class="admin-button-com middle" 
+              :class="[rForm.rechargePayWay == 5 ? 'blue' : 'default']" 
+              @click="rForm.rechargePayWay = 5"
+            >银行卡</button>
+          </view>
+        </view>
+
+        <!-- 备注输入 -->
+        <view class="input-section">
+          <view class="input-label">备注</view>
+          <view class="input-wrapper">
+            <input 
+              type="text" 
+              v-model="rForm.rechargeRemark" 
+              class="remark-input" 
+              placeholder="选填" 
+            />
+          </view>
+        </view>
+
+        <!-- 充值升级优惠 -->
+        <view v-if="rechargeWeal == 1" class="recharge-options">
+          <view class="options-title">充值活动:</view>
+          <view v-for="(item,index) in weal" :key="index" class="option-item">
+            <button 
+              @click="getRecharge(item.recharge)"
+              class="recharge-option-btn"
+              :class="[rForm.rechargeAmount == item.recharge ? 'selected' : '']"
+            >
+            <view class="option-content">
+              <view class="option-left">
+                <text class="recharge-amount">充值{{ item.recharge }}元</text>
+                <text class="upgrade-info">升{{ item.name }}</text>
+                <text class="discount-info">({{item.discount*100}}折)</text>
+              </view>
+              <view class="option-right">
+                {{ rForm.rechargeAmount == item.recharge ? '✓' : '选择' }}
+              </view>
+            </view>
+          </button>
+        </view>
+      </view>
+
+        <!-- 充值送金额 -->
+        <view v-if="rechargeWeal == 2" class="recharge-options">
+          <view class="options-title">充值优惠方案:</view>
+          <view v-for="(item,index) in weal" :key="index" class="option-item">
+            <button 
+              @click="getRecharge(item.recharge)"
+              class="recharge-option-btn"
+              :class="[rForm.rechargeAmount == item.recharge ? 'selected' : '']"
+            >
+            <view class="option-content">
+              <view class="option-left">
+                <text class="recharge-amount">充值{{ item.recharge }}元</text>
+                <text class="give-info">送{{ item.give }}元</text>
+              </view>
+              <view class="option-right">
+                {{ rForm.rechargeAmount == item.recharge ? '✓' : '选择' }}
+              </view>
+            </view>
+          </button>
+        </view>
+      </view>
+    </view>
+    </scroll-view>
+
+    <!-- 底部按钮 -->
+    <view class="footer-buttons">
+      <button class="admin-button-com middle" @click="cancelRecharge">取消</button>
+      <button class="admin-button-com middle blue" @click="confirmRecharge">充值</button>
+    </view>
+  </view>
+</template>
+
+<script>
+import { getWeal } from "@/api/member"
+import { toManRecharge } from "@/api/recharge"
+
+export default {
+  name: "recharge",
+  props: {
+    customId: {
+      type: Number,
+      default: 0
+    }
+  },
+  data() {
+    return {
+      rechargeInputFocus: false,
+      weal: [],
+      rechargeWeal: 0,
+      rForm: {
+        rechargeAmount: '',
+        rechargeRemark: '',
+        rechargePayWay: 0,
+      }
+    };
+  },
+  created() {
+    this.getWealData()
+  },
+  methods: {
+    getWealData() {
+      getWeal().then(res => {
+        if (res.code == 1) {
+          this.weal = res.data.weal ? res.data.weal : []
+          this.rechargeWeal = res.data.rechargeWeal ? res.data.rechargeWeal : 0
+        }
+      })
+    },
+    getRecharge(amount) {
+      this.rForm.rechargeAmount = amount
+    },
+    onRechargeInputBlur() {
+      this.rechargeInputFocus = false
+    },
+    cancelRecharge() {
+      this.$emit('cancel')
+    },
+    confirmRecharge() {
+      if (this.$util.isEmpty(this.rForm.rechargeAmount)) {
+        this.$msg('请填写充值金额')
+        return false
+      }
+      if (Number(this.rForm.rechargeAmount) < 0) {
+        this.$msg('充值金额要大于0')
+        return false
+      }
+      this.$util.confirmModal({ content: '确认充值?' }, () => {
+        uni.showLoading({ mask: true })
+        toManRecharge({
+          amount: this.rForm.rechargeAmount,
+          remark: this.rForm.rechargeRemark,
+          payWay: this.rForm.rechargePayWay,
+          customId: this.customId
+        }).then(res => {
+          uni.hideLoading()
+          if (res.code == 1) {
+            this.$msg('充值成功')
+            this.$emit('success')
+          }
+        })
+      })
+    }
+  }
+};
+</script>
+
+<style lang="scss" scoped>
+.recharge-wrapper {
+  display: flex;
+  flex-direction: column;
+  height: 100%;
+}
+
+.recharge-scroll {
+  flex: 1;
+  height: calc(100% - 56px);
+}
+
+.recharge-container {
+  padding: 15px;
+  background: #fff;
+  border-radius: 8px;
+}
+
+.input-section {
+  margin-bottom: 15px;
+}
+
+.input-label {
+  font-size: 14px;
+  color: #333;
+  margin-bottom: 6px;
+  font-weight: 500;
+}
+
+.input-wrapper {
+  position: relative;
+}
+
+.amount-input, .remark-input {
+  width: 100%;
+  height: 36px;
+  padding: 0 10px;
+  border: 1px solid #e9ecef;
+  border-radius: 4px;
+  font-size: 14px;
+  text-align: center;
+  background: #fff;
+  box-sizing: border-box;
+}
+
+.amount-input:focus, .remark-input:focus {
+  border-color: #3385FF;
+  background: #f8f9fa;
+}
+
+.payment-buttons {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 6px;
+  
+  button {
+    flex: 1;
+    min-width: 60px;
+  }
+}
+
+.recharge-options {
+  margin-top: 10px;
+}
+
+.options-title {
+  font-size: 13px;
+  color: #666;
+  margin-bottom: 8px;
+}
+
+.option-item {
+  margin-bottom: 8px;
+}
+
+.recharge-option-btn {
+  width: 100%;
+  padding: 8px 10px;
+  background: #f8f9fa;
+  border: 1px solid #e9ecef;
+  border-radius: 4px;
+  text-align: left;
+  transition: all 0.3s;
+}
+
+.recharge-option-btn.selected {
+  border-color: #3385FF;
+  background: #f0f7ff;
+}
+
+.option-content {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.option-left {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  gap: 5px;
+}
+
+.recharge-amount {
+  font-weight: 500;
+  font-size: 13px;
+  color: #333;
+}
+
+.upgrade-info {
+  font-size: 12px;
+  color: #666;
+}
+
+.discount-info, .give-info {
+  font-size: 12px;
+  color: #ff6b35;
+  font-weight: bold;
+}
+
+.option-right {
+  color: #3385FF;
+  font-size: 12px;
+  font-weight: bold;
+}
+
+.footer-buttons {
+  display: flex;
+  gap: 8px;
+  padding: 10px 8px;
+  background: #fff;
+  border-top: 1px solid #eee;
+  
+  button {
+    flex: 1;
+    min-width: 0;
+    height: 36px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+}
+
+/* 按钮样式 */
+.admin-button-com {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border-radius: 4px;
+  font-size: 13px;
+  border: none;
+  padding: 0 12px;
+  
+  &.middle {
+    height: 32px;
+    font-size: 13px;
+  }
+  
+  &.blue {
+    background-color: #3385FF;
+    color: #fff;
+    
+    &:active {
+      background-color: #2970d6;
+    }
+  }
+  
+  &.default {
+    background-color: #f0f0f0;
+    color: #333;
+    
+    &:active {
+      background-color: #e0e0e0;
+    }
+  }
+}
+</style>

+ 9 - 11
hdPad/src/pages/home/custom.vue

@@ -9,7 +9,7 @@
                 <customList ref="customListRef" @getCustomInfo="getCustomInfo"></customList>
                 <customList ref="customListRef" @getCustomInfo="getCustomInfo"></customList>
             </view>
             </view>
             <view class="custom-info">
             <view class="custom-info">
-                <customInfo ref="customInforRef" :selectCustomId="selectCustomId" @goBalance="goBalance" @changeBirthday="changeBirthday"></customInfo>
+                <customInfo ref="customInforRef" :selectCustomId="selectCustomId" @goBalance="goBalance" @changeBirthday="changeBirthday" @goRecharge="goRecharge"></customInfo>
             </view>
             </view>
 
 
             <view class="custom-asset" v-if="showIndex == 0"></view>
             <view class="custom-asset" v-if="showIndex == 0"></view>
@@ -19,6 +19,9 @@
             <view class="custom-asset" v-if="showIndex == 2">
             <view class="custom-asset" v-if="showIndex == 2">
                 <birthdayEdit ref="birthRef" :customId="selectCustomId" @refreshCustomInfo="refreshCustomInfo"></birthdayEdit>
                 <birthdayEdit ref="birthRef" :customId="selectCustomId" @refreshCustomInfo="refreshCustomInfo"></birthdayEdit>
             </view>
             </view>
+            <view class="custom-asset" v-if="showIndex == 3">
+                <recharge ref="rechargeRef" :customId="selectCustomId" @cancel="showIndex = 0" @success="refreshCustomInfo"></recharge>
+            </view>
 
 
         </view>
         </view>
     </view>
     </view>
@@ -32,16 +35,17 @@ import customList from './components/customList.vue'
 import customInfo from './components/customInfo.vue'
 import customInfo from './components/customInfo.vue'
 import balanceChange from './components/balanceChange.vue'
 import balanceChange from './components/balanceChange.vue'
 import birthdayEdit from './components/birthdayEdit.vue'
 import birthdayEdit from './components/birthdayEdit.vue'
+import recharge from './components/recharge.vue'
 export default {
 export default {
     name: "custom",
     name: "custom",
-    components: {casherNav,customList,customInfo,balanceChange,birthdayEdit},
+    components: {casherNav,customList,customInfo,balanceChange,birthdayEdit,recharge},
     mixins: [productMins],
     mixins: [productMins],
     data() {
     data() {
         return {
         return {
             currentJobType:'custom',
             currentJobType:'custom',
             currentJobId:0,
             currentJobId:0,
             selectCustomId:0,
             selectCustomId:0,
-            showIndex:0,//0操作按钮 1余额变动 2修改生日
+            showIndex:0,//0操作按钮 1余额变动 2修改生日 3充值
         }
         }
     },
     },
     computed: {
     computed: {
@@ -75,14 +79,8 @@ export default {
             this.currentJobId = Number(item.id)
             this.currentJobId = Number(item.id)
             this.$refs.customInforRef.getCustomDetail(this.selectCustomId)
             this.$refs.customInforRef.getCustomDetail(this.selectCustomId)
         },
         },
-        handleRecharge() {
-            if (!this.selectCustomId) {
-                uni.showToast({
-                    title: '请先选择客户',
-                    icon: 'none'
-                })
-                return
-            }
+        goRecharge() {
+            this.showIndex = 3
         },
         },
         handleReduceBalance() {
         handleReduceBalance() {
             if (!this.selectCustomId) {
             if (!this.selectCustomId) {