shish 1 месяц назад
Родитель
Сommit
1a84de271c
2 измененных файлов с 207 добавлено и 3 удалено
  1. 5 0
      ghsApp/src/api/custom/index.js
  2. 202 3
      ghsApp/src/pagesClient/member/detail.vue

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

@@ -138,4 +138,9 @@ export const changeDebtLimitPay = data => {
 //拉取(刷新)客户累计消费
 export const refreshCustomBuyAmount = data => {
 	return https.get('/custom/refresh-buyamount', data)
+}
+
+// 手动减少客户净余额(财务操作)
+export const deductBalance = data => {
+	return https.post('/custom/deduct-amount', data)
 }

+ 202 - 3
ghsApp/src/pagesClient/member/detail.vue

@@ -291,7 +291,7 @@
       </template>
 		</modal-module>
 
-		<modal-module :show="czShow" @click="confirmRecharge" :maskClosable="true" title="充值销账" padding="10rpx 10rpx" >
+		<modal-module :show="czShow" @click="confirmRecharge" :maskClosable="true" title="充值余额" padding="30rpx 30rpx" >
       <template v-slot:content>
         <div class="app-modal-input-wrap">
 
@@ -370,6 +370,47 @@
       </view>
     </uni-popup>
 
+    <!-- 减余额弹框 -->
+    <uni-popup ref="deductPopupRef" background-color="#fff" type="center" :animation="true" :mask-click="false" :safe-area="false">
+      <view class="deduct-popup-container">
+        <view class="popup-header">
+          <text class="popup-title">减余额</text>
+          <view class="popup-close" @click="closeDeductPopup">
+            <text class="close-icon">×</text>
+          </view>
+        </view>
+        <scroll-view class="popup-content" scroll-y="true" :style="{maxHeight: '70vh'}">
+          <view class="input-section">
+            <view class="input-label">金额</view>
+            <view class="input-wrapper">
+              <input
+                type="digit"
+                placeholder="请输入金额"
+                v-model="deductAmount"
+                :adjust-position="false"
+                class="amount-input"
+                :focus="deductInputFocus"
+                :cursor-spacing="20"
+                confirm-type="done"
+                confirm-hold="true"
+                @blur="onDeductInputBlur"
+              />
+            </view>
+          </view>
+          <view class="input-section">
+            <view class="input-label">备注</view>
+            <view class="input-wrapper">
+              <input type="text" v-model="deductRemark" class="remark-input" placeholder="选填" />
+            </view>
+          </view>
+        </scroll-view>
+        <view class="popup-footer">
+          <button class="admin-button-com middle" @click="closeDeductPopup">取消</button>
+          <button class="admin-button-com middle blue" @click="confirmDeduct">确认</button>
+        </view>
+      </view>
+    </uni-popup>
+
   </view>
 </template>
 <script>
@@ -380,7 +421,7 @@ import { getUserDet,debt} from "@/api/member";
 import { IMGHOST } from '@/config'
 import { mapGetters } from "vuex"
 import { changeShowStock,changePassStatus,toChangeHome,changeWlName,modifyShortName,modifyHomeParams,changeRiseRule,changeLevel,changeDebtLimitPay,createSeatSnFn,modifySeatSnFn,changeDelStatus,refreshCustomBuyAmount } from "@/api/custom"
-import { updateDebtLimit,updateCustomBlack,changeDiscount,changeName,rechargeFn,getGatheringCode} from "@/api/custom";
+import { updateDebtLimit,updateCustomBlack,changeDiscount,changeName,rechargeFn,getGatheringCode,deductBalance} from "@/api/custom";
 import { getAllDist,changeDist } from "@/api/dist"
 import { getAllWl } from "@/api/shop"
 export default {
@@ -430,7 +471,7 @@ export default {
           }
         },
         {
-          name: "充值清账",
+          name: "充值余额",
           img: `${this.$constant.imgUrl}/retail/member/tab-icon-1.png`,
           funtion: () => {
             this.czShow = true
@@ -443,6 +484,15 @@ export default {
               })
             }, 200)
           }
+        },
+        {
+          name: "减少余额",
+          img: `${this.$constant.imgUrl}/retail/member/tab-icon-1.png`,
+          funtion: () => {
+            this.deductAmount = ''
+            this.deductRemark = ''
+            this.openDeductPopup()
+          }
         }
       ],
       customName:'',
@@ -455,6 +505,9 @@ export default {
       rechargeRemark:'',
       payWay:-1,
       rechargeType:0,
+      deductAmount: '',
+      deductRemark: '',
+      deductInputFocus: false,
       title:'付款结账',
       needRefresh:0,
       allDist:[],
@@ -702,6 +755,56 @@ export default {
         }
       })
     },
+    // 打开减余额弹框
+    openDeductPopup() {
+      this.$refs.deductPopupRef.open('center')
+      setTimeout(() => {
+        this.deductInputFocus = true
+      }, 300)
+    },
+    // 关闭减余额弹框
+    closeDeductPopup() {
+      this.$refs.deductPopupRef.close()
+      this.deductInputFocus = false
+      this.deductAmount = ''
+      this.deductRemark = ''
+    },
+    onDeductInputBlur() {
+      this.deductInputFocus = false
+    },
+    // 确认减余额
+    confirmDeduct() {
+      if (this.$util.isEmpty(this.deductAmount)) {
+        this.$msg('请填写减余额金额')
+        return false
+      }
+      if (Number(this.deductAmount) <= 0) {
+        this.$msg('金额要大于0')
+        return false
+      }
+      const available = Number(this.userInfo.balance || 0)
+      if (available <= 0) {
+        this.$msg('没有可减余额')
+        return false
+      }
+      if (Number(this.deductAmount) > available) {
+        this.$msg('余额不够扣')
+        return false
+      }
+      this.$util.confirmModal({ content: '确认减少?' }, () => {
+        deductBalance({
+          amount: this.deductAmount,
+          customId: this.userInfo.id,
+          remark: this.deductRemark
+        }).then(res => {
+          if (res.code == 1) {
+            this.closeDeductPopup()
+            this.$msg(res.msg)
+            this.getUserDetail()
+          }
+        })
+      })
+    },
     confirmRecharge(val){
 			let that = this;
 			if (val.index == 0) {
@@ -1047,4 +1150,100 @@ export default {
   color: #333;
   border-color: #e0e0e0;
 }
+
+.deduct-popup-container {
+  width: 82vw;
+  max-width: 600upx;
+  background: #fff;
+  border-radius: 20upx;
+  overflow: hidden;
+  box-shadow: 0 10upx 30upx rgba(0, 0, 0, 0.3);
+}
+
+.popup-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  padding: 40upx 40upx 30upx;
+  border-bottom: 1upx solid #f0f0f0;
+  background: #fff;
+}
+
+.popup-title {
+  font-size: 38upx;
+  font-weight: 600;
+  color: #333;
+}
+
+.popup-close {
+  width: 60upx;
+  height: 60upx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border-radius: 50%;
+  background: #f8f9fa;
+}
+
+.close-icon {
+  font-size: 42upx;
+  color: #999;
+  line-height: 1;
+}
+
+.popup-content {
+  padding: 40upx;
+  background: #fff;
+}
+
+.input-section {
+  margin-bottom: 35upx;
+}
+
+.input-label {
+  font-size: 34upx;
+  color: #333;
+  margin-bottom: 18upx;
+  font-weight: 500;
+}
+
+.amount-input,
+.remark-input {
+  width: 100%;
+  height: 90upx;
+  padding: 0 25upx;
+  border: 2upx solid #e9ecef;
+  border-radius: 12upx;
+  font-size: 34upx;
+  text-align: center;
+  background: #fff;
+  box-sizing: border-box;
+}
+
+.amount-input:focus,
+.remark-input:focus {
+  border-color: #3385ff;
+  background: #f8f9fa;
+}
+
+.popup-footer {
+  display: flex;
+  padding: 40upx;
+  background: #fff;
+  border-top: 1upx solid #f0f0f0;
+
+  button {
+    flex: 1;
+    min-width: 0;
+    height: 90upx;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    margin-right: 20upx;
+
+    &:last-child {
+      margin-right: 0;
+    }
+  }
+}
 </style>