Browse Source

商户余额转化

xiaomei 1 year ago
parent
commit
5f317f7102

+ 6 - 0
src/pages.json

@@ -572,6 +572,12 @@
 					"style": {
 					"style": {
 						"navigationBarTitleText": "修改信息"
 						"navigationBarTitleText": "修改信息"
 					}
 					}
+				},
+				{
+					"path": "convert/index",
+					"style": {
+						"navigationBarTitleText": "转化"
+					}
 				}
 				}
 			]
 			]
 		}
 		}

+ 2 - 2
src/pages/my/index.vue

@@ -30,7 +30,7 @@
                         </view>
                         </view>
                     </view>
                     </view>
                     <view class="user_option flex_r flex_ac flex_je">
                     <view class="user_option flex_r flex_ac flex_je">
-                        <navigator class="flex_c flex_ac" @tap="getImgPage" hover-class="none" v-if="localInfo.level_id>1">
+                        <navigator class="flex_c flex_ac" @tap="getImgPage" hover-class="none">
                             <image class="fun_img" src="/static/my/f_img_code.png"></image>
                             <image class="fun_img" src="/static/my/f_img_code.png"></image>
                             <view class="fun_text">分享海报</view>
                             <view class="fun_text">分享海报</view>
                         </navigator>
                         </navigator>
@@ -137,7 +137,7 @@
                         <image class="fun_img" src="/static/my/11.png"></image>
                         <image class="fun_img" src="/static/my/11.png"></image>
                         <view class="fun_text">激活升级</view>
                         <view class="fun_text">激活升级</view>
                     </navigator>
                     </navigator>
-                    <navigator v-if="localInfo.level_id>1" class="fun_list flex_c flex_ac" url="/pagesB/orderingfood/friend" hover-class="none">
+                    <navigator class="fun_list flex_c flex_ac" url="/pagesB/orderingfood/friend" hover-class="none">
                         <image class="fun_img" src="/static/my/12.png"></image>
                         <image class="fun_img" src="/static/my/12.png"></image>
                         <view class="fun_text">社区</view>
                         <view class="fun_text">社区</view>
                     </navigator>
                     </navigator>

+ 36 - 3
src/pagesB/my/shuZhiWallet.vue

@@ -14,14 +14,19 @@
             </div>
             </div>
         </div>
         </div>
         <div class="btn_bar flex_r flex_jse">
         <div class="btn_bar flex_r flex_jse">
-            <div class="btn_item" @click="getToCash('local')">
+            <div class="btn_item" @click="getToCash('local')" :style="{'width':isMerchant?'210rpx':'280rpx'}">
                 <span class="ico iconfont">&#xe603;</span>
                 <span class="ico iconfont">&#xe603;</span>
                 <span class="btn_txt">提现</span>
                 <span class="btn_txt">提现</span>
             </div>
             </div>
-            <div class="btn_item corc" @click="goto('/pagesB/topUp/Local')">
+            <div class="btn_item corc" @click="goto('/pagesB/topUp/Local')" :style="{'width':isMerchant?'210rpx':'280rpx'}">
                 <span class="ico iconfont">&#xe68a;</span>
                 <span class="ico iconfont">&#xe68a;</span>
                 <span class="btn_txt">充值</span>
                 <span class="btn_txt">充值</span>
             </div>
             </div>
+            <div class="btn_item conv" v-if="isMerchant" @click="goto('/pagesC/convert/index')">
+                <!-- <span class="ico iconfont">&#xe68a;</span> -->
+                <image class="ico" src="@/static/icon/convert.png" mode="widthFix" />
+                <span class="btn_txt">转化</span>
+            </div>
         </div>
         </div>
         <div class="detailList" v-if="List.length">
         <div class="detailList" v-if="List.length">
             <div class="tit"><span>收支明细</span></div>
             <div class="tit"><span>收支明细</span></div>
@@ -57,6 +62,7 @@ import { post } from "@/request/api.js";
                 page: 1,
                 page: 1,
                 rows: 20
                 rows: 20
             },
             },
+            isMerchant: false, // 是否是商户
       }
       }
     },
     },
     methods: {
     methods: {
@@ -70,6 +76,14 @@ import { post } from "@/request/api.js";
                 }
                 }
             })
             })
         },
         },
+        // 商家中心权限
+        merchantSet(){
+            post("v1/merchant/settled").then((res) => {
+                if (res.code === 0) {
+                    this.isMerchant = res.data.shop
+                }
+            });
+        },
         async getLU() {
         async getLU() {
             this.localInfo = await uni.Luserfun();
             this.localInfo = await uni.Luserfun();
         },
         },
@@ -88,12 +102,21 @@ import { post } from "@/request/api.js";
     onLoad(da) {
     onLoad(da) {
         this.getList();
         this.getList();
         this.getLU();
         this.getLU();
+        this.merchantSet()
     },
     },
     onShow() {},
     onShow() {},
     mounted() {},
     mounted() {},
     onReachBottom() {
     onReachBottom() {
         if (this.Query.page < this.last_page) this.getList();
         if (this.Query.page < this.last_page) this.getList();
     },
     },
+    // 监听卸载页面  同等于  返回拦截
+    onUnload() {
+        let pages = getCurrentPages();
+        let prevPage = pages[pages.length - 2]?.route
+        if (prevPage == "pagesC/convert/index") {
+            uni.switchTab({ url: "/pages/my/index" });
+        }
+    },
   }
   }
 </script>
 </script>
 
 
@@ -123,7 +146,7 @@ import { post } from "@/request/api.js";
 .btn_bar{
 .btn_bar{
     padding: 30rpx 0;
     padding: 30rpx 0;
     .btn_item{
     .btn_item{
-        width: 280rpx;
+        width: 210rpx;
         height: 70rpx;
         height: 70rpx;
         line-height: 70rpx;
         line-height: 70rpx;
         text-align: center;
         text-align: center;
@@ -137,6 +160,16 @@ import { post } from "@/request/api.js";
             background-color: #d3aa79;
             background-color: #d3aa79;
             color: #fff;
             color: #fff;
         }
         }
+        &.conv{
+            color: #fff;
+            background-color: #18bb88;
+        }
+        image{
+            width: 50rpx;
+            height: 50rpx;
+            background: #fff;
+            border-radius: 50%;
+        }
     }
     }
     .ico{
     .ico{
         color: #d3aa79;
         color: #d3aa79;

+ 245 - 0
src/pagesC/convert/index.vue

@@ -0,0 +1,245 @@
+<template>
+  <view class="container">
+    <view class="content">
+      <view class="moeny flex_r flex_ae"
+        >¥
+        <input
+          type="number"
+          :maxlength="12"
+          v-model="inputMoney"
+          placeholder="请输入转化金额"
+        />
+      </view>
+      <view class="option flex_r flex_ac flex_jb">
+        <view class="balance flex_r flex_ac">
+          <!-- <span>账户余额:{{ available_money }}</span> -->
+          <span>可转化额度:{{ available_money }}</span>
+        </view>
+        <view class="option_text" @tap="getListPage">转化记录</view>
+      </view>
+    </view>
+    <view class="btn flex_r flex_ac flex_jc" @tap="onSubForm">立即转化</view>
+    <view class="showlist" v-for="(item, index) in show" :key="index">{{
+      item
+    }}</view>
+  </view>
+</template>
+<script>
+import { post } from "@/request/api.js";
+export default {
+  data() {
+    return {
+      show: [],
+      inputMoney: undefined,
+      imgs: "",
+      index: 0,
+      userinfo: undefined, // 获取用户信息
+      localInfo: undefined,
+
+      user_money: 0, //余额
+      available_money: 0, //数智生活可提金额
+      merchant_money: 0, //商家中心余额
+
+      islocal: false,
+    };
+  },
+  onLoad(e) {
+    this.getLU();
+    this.getExolain();
+  },
+  methods: {
+    getExolain() {
+      post("v1/merchant/convertDesc").then((res) => {
+        this.show = this.islocal ? res.data[0] : res.data;
+      });
+    },
+    onSubForm() {
+      let that = this;
+      let url = "v1/merchant/convertMoney";
+      if (this.inputMoney == "") {
+        this.$toast("请输入金额");
+        return;
+      }
+      if (this.inputMoney <= 0) {
+        this.$toast("请输入正确的金额");
+        return;
+      }
+      if (Number(this.inputMoney) > Number(this.available_money)) {
+        uni.showModal({
+          content: `当前可转化${that.available_money}`,
+          showCancel: false,
+          success(res) {},
+        });
+        return;
+      }
+      uni.showModal({
+        content: "请确认“商户余额”转化为“个人余额”?",
+        confirmText: "确认转化",
+        cancelText: "取消",
+        success: (res) => {
+          if (res.confirm) {
+            uni.showLoading({
+              mask: true,
+            });
+            let data = {
+              money: that.inputMoney,
+            };
+            post(url, data).then((res) => {
+              uni.hideLoading();
+              if (res.code === 0) {
+                that.inputMoney = "";
+                uni.showModal({
+                  content: res.msg,
+                  confirmText: "知道了",
+                  showCancel: false,
+                  success(res) {
+                    that.getListPage()
+                  },
+                });
+                that.getLU();
+              } else {
+                that.$toast(res.msg || "");
+              }
+            });
+          }
+        },
+      });
+    },
+
+    getListPage() {
+      uni.navigateTo({
+        url: "/pagesB/my/shuZhiWallet",
+      });
+    },
+
+    async getLU() {
+      this.localInfo = await uni.Luserfun();
+      this.available_money = this.localInfo.merchant_money;
+    },
+  },
+  computed: {
+    isBank() {
+      if (this.islocal) return false;
+      else {
+        if (!this.inputMoney) return false;
+        else return this.inputMoney > 1000;
+      }
+    },
+  },
+};
+</script>
+<style lang="scss" scoped>
+// 页面配置
+.container {
+  border-top: 20rpx solid #f5f5f5;
+  padding: 43rpx 30rpx;
+  box-sizing: border-box;
+}
+
+// 页面配置-end
+
+.title_select {
+  margin-left: 36rpx;
+}
+
+.upload {
+  width: 100%;
+  overflow: hidden;
+}
+
+.balance {
+  font-size: 26rpx;
+  color: #7c838d;
+  span {
+    margin-right: 22rpx;
+    &:last-child {
+      margin-right: 0;
+    }
+  }
+}
+
+.option_text {
+  font-size: 28rpx;
+  color: #18bb88;
+}
+
+.upload_con text {
+  color: #898989;
+  font-size: 40rpx;
+}
+
+.hint {
+  font-size: 26rpx;
+  color: #8f8f8f;
+  margin-top: 40rpx;
+}
+
+.upload_img {
+  width: 200rpx;
+  height: 200rpx;
+  margin-top: 60rpx;
+}
+
+.title {
+  font-size: 28rpx;
+  color: #7c838d;
+  margin-bottom: 40rpx;
+}
+
+.upload_text {
+  font-size: 26rpx;
+  color: #898989;
+  margin-top: 20rpx;
+}
+
+.showlist {
+  font-size: 26rpx;
+  color: #7c838d;
+  margin-bottom: 20rpx;
+}
+
+.moeny input {
+  color: #121922;
+  font-size: 56rpx;
+  height: 56rpx;
+  margin-left: 10rpx;
+}
+
+.upload_con {
+  width: 200rpx;
+  height: 200rpx;
+  border: 3rpx solid #898989;
+  border-radius: 10rpx;
+  margin-top: 60rpx;
+}
+
+.moeny {
+  font-size: 42rpx;
+  color: #121922;
+  line-height: 1;
+  height: 56rpx;
+  border-bottom: 3rpx solid #e4e4ee;
+  margin-bottom: 70rpx;
+  padding: 37rpx 0;
+}
+
+.content {
+  box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.1);
+  width: 100%;
+  overflow: hidden;
+  padding: 40rpx;
+  box-sizing: border-box;
+  border-radius: 20rpx;
+}
+
+.btn {
+  width: 348rpx;
+  height: 80rpx;
+  background: #18bb88;
+  color: #fff;
+  font-size: 40rpx;
+  border-radius: 10rpx;
+  box-shadow: 0px 8px 22px 2px rgba(24, 187, 136, 0.22);
+  margin: 64rpx auto;
+}
+</style>

+ 36 - 1
src/pagesC/settledMerchant/myShop.vue

@@ -1,12 +1,17 @@
 <template>
 <template>
     <div class="myshop">
     <div class="myshop">
         <div class="card">
         <div class="card">
+            <div class="acc">商户余额</div>
             <div class="money" @click="goto('/pagesC/settledMerchant/balanceLog',{s:0})">¥{{money.withdraw_money || "0.00"}}</div>
             <div class="money" @click="goto('/pagesC/settledMerchant/balanceLog',{s:0})">¥{{money.withdraw_money || "0.00"}}</div>
             <div class="msg">可提现金额(元)</div>
             <div class="msg">可提现金额(元)</div>
             <div class="btn" @click="getToCash">
             <div class="btn" @click="getToCash">
                 <span>去提现</span>
                 <span>去提现</span>
                 <span class="iconfont">&#xe62e;</span>
                 <span class="iconfont">&#xe62e;</span>
             </div>
             </div>
+            <div class="btn1" @click="getToConvert">
+                <span>去转化</span>
+                <span class="iconfont">&#xe62e;</span>
+            </div>
         </div>
         </div>
         <div class="elseMoney flex_r flex_jb flex_ac">
         <div class="elseMoney flex_r flex_jb flex_ac">
             <div class="total_money" @click="goto('/pagesC/settledMerchant/balanceLog',{s:1})">总收入<span>¥{{money.total_money || "0.00"}}</span></div>
             <div class="total_money" @click="goto('/pagesC/settledMerchant/balanceLog',{s:1})">总收入<span>¥{{money.total_money || "0.00"}}</span></div>
@@ -70,6 +75,10 @@ export default {
         getToCash(type) {
         getToCash(type) {
             this.goto("/pages/cash/index", { type })
             this.goto("/pages/cash/index", { type })
         },
         },
+        // 跳转到转化页面
+        getToConvert() {
+            this.goto("/pagesC/convert/index")
+        },
         // 跳转到店铺详情
         // 跳转到店铺详情
         goDetail(id) {
         goDetail(id) {
             this.goto("/pagesC/settledMerchant/merchantDetail", { id })
             this.goto("/pagesC/settledMerchant/merchantDetail", { id })
@@ -106,6 +115,11 @@ export default {
     background: linear-gradient(to right, #696EFD, #2E57FD);
     background: linear-gradient(to right, #696EFD, #2E57FD);
     position: relative;
     position: relative;
     color: #fff;
     color: #fff;
+    .acc{
+        font-size: 26rpx;
+        padding-left: 38rpx;
+        padding-top: 30rpx;
+    }
 
 
     .money {
     .money {
         font-size: 56rpx;
         font-size: 56rpx;
@@ -130,7 +144,7 @@ export default {
         color: #2E57FD;
         color: #2E57FD;
         position: absolute;
         position: absolute;
         right: 0;
         right: 0;
-        top: calc(50% - 50rpx);
+        top: calc(50% - 65rpx);
         width: 170rpx;
         width: 170rpx;
         text-align: center;
         text-align: center;
         height: 55rpx;
         height: 55rpx;
@@ -144,6 +158,27 @@ export default {
             margin-left: 12rpx;
             margin-left: 12rpx;
         }
         }
     }
     }
+
+    
+    .btn1 {
+        color: #fff;
+        position: absolute;
+        right: 0;
+        top: calc(50% + 20rpx);
+        width: 170rpx;
+        text-align: center;
+        height: 55rpx;
+        line-height: 55rpx;
+        font-size: 30rpx;
+        background-color: #d3aa79;
+        border-radius: 28rpx 0 0 28rpx;
+
+        .iconfont {
+            color: #fff;
+            font-size: 25rpx;
+            margin-left: 12rpx;
+        }
+    }
 }
 }
 
 
 .elseMoney {
 .elseMoney {

BIN
src/static/icon/convert.png