谢杰标 2 lat temu
rodzic
commit
4166a14bc3
15 zmienionych plików z 246 dodań i 71 usunięć
  1. 20 0
      .gitignore
  2. 4 1
      App.vue
  3. 7 0
      common/tool.js
  4. 58 0
      common/wechat.js
  5. 2 0
      main.js
  6. 2 1
      package.json
  7. 2 1
      pages.json
  8. 9 5
      pages/actlist/index.vue
  9. 21 3
      pages/bill/index.vue
  10. 38 12
      pages/cashout/index.vue
  11. 44 11
      pages/cashout/record.vue
  12. 4 6
      pages/commission/index.vue
  13. 10 0
      utils/bill.js
  14. 6 30
      utils/request.js
  15. 19 1
      utils/user.js

+ 20 - 0
.gitignore

@@ -0,0 +1,20 @@
+.DS_Store
+node_modules/
+/dist/
+unpackage/
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+/test/unit/coverage/
+/test/e2e/reports/
+selenium-debug.log
+project.private.config.json
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+.hbuilderx

+ 4 - 1
App.vue

@@ -1,7 +1,10 @@
 <script>
 export default {
   onLaunch: function () {
-    if (this.$method.isLogin()) {
+    if (
+      this.$method.isLogin() &&
+      !this.$route.path.includes("/pages/bill/index")
+    ) {
       !this.$store.state.userInfo && this.$store.dispatch("getUserInfo");
     }
   },

+ 7 - 0
common/tool.js

@@ -161,6 +161,8 @@ export default {
     });
   },
 };
+
+// 监测域名
 export function checkDomain(str) {
   let domain =
     /^([\w-]+\.)+((com)|(net)|(org)|(gov\.cn)|(info)|(cc)|(com\.cn)|(net\.cn)|(org\.cn)|(name)|(biz)|(tv)|(cn)|(mobi)|(name)|(sh)|(ac)|   (io)|(tw)|(com\.tw)|(hk)|(com\.hk)|(ws)|(travel)|(us)|(tm)|(la)|(me\.uk)|(org\.uk)|(ltd\.uk)|(plc\.uk)|(in)|(eu)|(it)|(jp))$/;
@@ -182,3 +184,8 @@ export function getQueryString(name) {
   }
   return theRequest;
 }
+
+export function isWechat() {
+  var ua = window.navigator.userAgent.toLowerCase();
+  return ua.match(/micromessenger/i) == "micromessenger"
+}

+ 58 - 0
common/wechat.js

@@ -0,0 +1,58 @@
+var jweixin = require("jweixin-module");
+import { getShareGzh } from "@/utils/bill";
+export default {
+  //判断是否在微信中
+  isWechat: function () {
+    var ua = window.navigator.userAgent.toLowerCase();
+    return ua.match(/micromessenger/i) == "micromessenger";
+  },
+  //初始化sdk配置
+  initJssdkShare: function (callback) {
+    getShareGzh().then((result) => {
+      jweixin.config({
+        debug: true,
+        appId: result.appid,
+        timestamp: result.timestamp,
+        nonceStr: result.nonceStr,
+        signature: result.signature,
+        jsApiList: [
+          "checkJsApi",
+          "updateTimelineShareData",
+          "updateAppMessageShareData",
+        ],
+      });
+      //配置完成后,再执行分享等功能
+      if (callback) {
+        callback(result);
+      }
+    });
+  },
+  //在需要自定义分享的页面中调用
+  share: function (data, url) {
+    // if (!this.isWechat()) {
+    //   return;
+    // }
+    url = url || window.location.href;
+    //每次都需要重新初始化配置,才可以进行分享
+    this.initJssdkShare(function (signData) {
+      console.log(signData, "signData");
+      jweixin.ready(function () {
+        var shareData = {
+          title: data && data.title ? data.title : signData.site_name,
+          desc: data && data.desc ? data.desc : signData.site_description,
+          link: url,
+          imgUrl: data && data.img ? data.img : signData.site_logo,
+          success: function (res) {
+            // 分享后的一些操作,比如分享统计等等
+            console.log("分享成功");
+          },
+          cancel: function (res) {},
+        };
+        //分享给朋友接口
+        jweixin.updateAppMessageShareData(shareData);
+        //分享到朋友圈接口
+        // jweixin.updateTimelineShareData(shareData);
+      });
+    });
+  },
+};

+ 2 - 0
main.js

@@ -25,6 +25,8 @@ uni.$u.setConfig({
 });
 Vue.filter('formate', filters['formDate'])
 Vue.filter('toFixed', filters['toFixed'])
+import vconsole from "vconsole";
+new vconsole();
 // #ifndef VUE3
 import Vue from "vue";
 Vue.config.productionTip = false;

+ 2 - 1
package.json

@@ -1,6 +1,7 @@
 {
   "dependencies": {
     "jweixin-module": "^1.6.0",
-    "tki-qrcode": "^0.1.6"
+    "tki-qrcode": "^0.1.6",
+    "vconsole": "^3.15.0"
   }
 }

+ 2 - 1
pages.json

@@ -81,7 +81,8 @@
     {
       "path": "pages/bill/index",
       "style": {
-        "navigationBarTitleText": "海报"
+        "navigationBarTitleText": "海报",
+        "navigationStyle": "custom"
       }
     }
   ],

+ 9 - 5
pages/actlist/index.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="act-ward">
     <view
-      v-for="item in actList"
+      v-for="item in list"
       :key="item.distributionId"
       class="act-ward-box"
       @click="toDetail(item.distributionId)"
@@ -27,6 +27,10 @@
         <view @click.stop="makePoster(item.distributionId)">生成海报</view>
       </view>
     </view>
+    <view class="nomore" v-if="total && list.length == total">
+      已显示全部
+    </view>
+    <view class="nomore" v-if="!total"> 暂无数据 </view>
   </view>
 </template>
 
@@ -35,7 +39,7 @@ import { getActList, getLinkCode } from "@/utils/act";
 export default {
   data() {
     return {
-      actList: [],
+      list: [],
       param: {},
       total: 0,
     };
@@ -43,12 +47,12 @@ export default {
   methods: {
     getActList() {
       getActList(this.param).then((res) => {
-        this.actList.push(...res.rows);
+        this.list.push(...res.rows);
         this.total = res.total;
       });
     },
     reset() {
-      this.actList = [];
+      this.list = [];
       this.param = {
         pageNum: 1,
         pageSize: 10,
@@ -79,7 +83,7 @@ export default {
     this.getActList();
   },
   onReachBottom() {
-    if (this.actList.length >= this.total) {
+    if (this.list.length >= this.total) {
       return;
     }
     this.param.pageNum++;

+ 21 - 3
pages/bill/index.vue

@@ -7,7 +7,7 @@
         :src="$method.splitImgHost(item.name, true)"
         mode=""
       />
-      <view :style="backPosition(item)" style="white-space:pre-wrap;">
+      <view :style="backPosition(item)" style="white-space: pre-wrap">
         <view :style="item.css" v-if="item.type == 1">
           {{ item.name }}
         </view>
@@ -20,12 +20,12 @@
           mode=""
         />
       </view>
-      <view v-if="item.type == 3" :style="backPosition(item)">
+      <view class="code-box" v-if="item.type == 3" :style="backPosition(item)">
         <tki-qrcode
           :cid="item.codeUrl"
           ref="qrcode"
           :val="item.codeUrl"
-          :size="item.height * 2"
+          :size="item.height * 2 - 20"
           unit="upx"
           background="#ffffff"
           foreground="#000000"
@@ -42,6 +42,7 @@
 <script>
 import { getSharePoster } from "@/utils/bill";
 import tkiQrcode from "tki-qrcode";
+import wechat from "@/common/wechat";
 export default {
   data() {
     return {
@@ -54,6 +55,7 @@ export default {
   onLoad(options) {
     this.options = options;
     this.getSharePoster();
+    this.share();
   },
   components: {
     tkiQrcode,
@@ -100,6 +102,17 @@ export default {
         item[e] = this.px2rpx(item[e]);
       });
     },
+    share() {
+      //分享微信好友
+      wechat.share(
+        {
+          title: "穷期先生的名片",
+          desc: "拥有多年财富管理经验的理财专家",
+          img: "",
+        },
+        "h.xyyxt.net"
+      );
+    },
   },
 };
 </script>
@@ -107,5 +120,10 @@ export default {
 <style lang="scss" scoped>
 .bill-ward {
   position: relative;
+  .code-box {
+    padding: 10rpx;
+    background: #ffffff;
+    box-sizing: border-box;
+  }
 }
 </style>

+ 38 - 12
pages/cashout/index.vue

@@ -31,13 +31,14 @@
           <text>提现金额</text>
           <u--input
             placeholder="请输入提现金额"
-            v-model="money"
+            v-model.number="money"
             type="number"
             border="node"
             placeholderStyle="fontSize:36rpx"
             inputAlign="center"
             color="#24263D"
             fontSize="36px"
+            @input="changeMoney"
           ></u--input>
         </view>
         <view class="popup-main-mode fl_b u-border-bottom">
@@ -51,7 +52,7 @@
         <u-button
           class="c_btn popup-main-btn"
           text="确 认"
-          @click="jumpLogin"
+          @click="withdrawal"
         ></u-button>
       </view>
     </u-popup>
@@ -61,7 +62,12 @@
 <script>
 import { mapGetters } from "vuex";
 import { getQueryString } from "@/common/tool";
-import { checkBindGzh, getWxConfig, OfficialLogin } from "@/utils/user";
+import {
+  checkBindGzh,
+  getWxConfig,
+  OfficialLogin,
+  withdrawal,
+} from "@/utils/user";
 export default {
   data() {
     return {
@@ -77,6 +83,16 @@ export default {
     location.search.includes("code") && this.OfficialLogin();
   },
   methods: {
+    changeMoney(val) {
+      val *= 1;
+      console.log(val < 0, val >= this.userInfo.cash, val);
+      if (val < 0) {
+        this.money = 0;
+      }
+      if (val >= this.userInfo.cash) {
+        this.money = this.userInfo.cash;
+      }
+    },
     close() {
       this.show = false;
     },
@@ -110,15 +126,25 @@ export default {
       });
     },
     OfficialLogin() {
-      this.$api
-        .OfficialLogin({
-          code: getQueryString("code"),
-        })
-        .then((res) => {
-          if (res.data.code !== 200) {
-            this.$u.toast(res.data.msg);
-          }
-        });
+      OfficialLogin({
+        code: getQueryString("code"),
+      }).then((res) => {
+        if (res.data.code !== 200) {
+          this.$u.toast(res.data.msg);
+        }
+      });
+    },
+    withdrawal() {
+      if (!this.money) {
+        this.$u.toast("请输入提现金额");
+        return;
+      }
+      
+      withdrawal({ cash: this.money }).then((res) => {
+        this.show = false;
+        this.$u.toast("提现成功");
+        this.$store.dispatch("getUserInfo")
+      });
     },
   },
   computed: {

+ 44 - 11
pages/cashout/record.vue

@@ -7,33 +7,66 @@
         :key="item.id"
       >
         <view class="fl_b com-ward-list-item-top">
-          <view class="title"
-            >2023年3月1日 10:53</view
-          >
-          <view class="money">120</view>
+          <view class="title">{{
+            item.applyTime | formate("yyyy-mm-dd hh:mm")
+          }}</view>
+          <view class="money">{{ item.cash }}</view>
         </view>
-        <view class="com-ward-list-item-status">
-           已申请
+        <view class="com-ward-list-item-status"
+          >{{
+            ["已拒绝", "未审核", "初审通过", "二审通过", "三审通过", "已打款"][
+              item.cwStatus + 1
+            ]
+          }}
         </view>
       </view>
     </view>
-    <view class="nomore">已显示全部</view>
+    <view class="nomore" v-if="total && list.length == total">
+      已显示全部
+    </view>
+    <view class="nomore" v-if="!total"> 暂无数据 </view>
   </view>
 </template>
 
 <script>
+import { getWithdrawalList } from "@/utils/user";
 export default {
   name: "commission",
 
   data() {
     return {
-      list: [{ id: 1 }, { id: 2 }],
+      list: [],
+      param: {},
+      total: 0,
     };
   },
 
-  mounted() {},
-
-  methods: {},
+  onShow() {
+    this.reset();
+    this.getWithdrawalList();
+  },
+  onReachBottom() {
+    if (this.list.length >= this.total) {
+      return;
+    }
+    this.param.pageNum++;
+    this.getWithdrawalList();
+  },
+  methods: {
+    reset() {
+      this.list = [];
+      this.param = {
+        pageNum: 1,
+        pageSize: 10,
+      };
+    },
+    getWithdrawalList() {
+      getWithdrawalList(this.param).then((res) => {
+        this.list.push(...res.rows);
+        this.total = res.total;
+      });
+    },
+  },
 };
 </script>
 

+ 4 - 6
pages/commission/index.vue

@@ -8,9 +8,7 @@
       >
         <view class="fl_b com-ward-list-item-top">
           <image src="../../static/image/icon_com.png" mode="" />
-          <view class="title u-line-1"
-            >活动名称一行展示,超出省略活动名称一行展示,超出省略...</view
-          >
+          <view class="title u-line-1">{{ item.relatedSn }}</view>
           <view class="money">+{{ item.diffNum }}</view>
         </view>
         <view class="com-ward-list-item-status">
@@ -18,8 +16,8 @@
         </view>
       </view>
     </view>
-    <view class="nomore" v-if="total && list.length == tota">
-      "已显示全部"
+    <view class="nomore" v-if="total && list.length == total">
+      已显示全部
     </view>
     <view class="nomore" v-if="!total"> 暂无数据 </view>
   </view>
@@ -50,7 +48,7 @@ export default {
   },
   methods: {
     reset() {
-      this.actList = [];
+      this.list = [];
       this.param = {
         pageNum: 1,
         pageSize: 10,

+ 10 - 0
utils/bill.js

@@ -7,4 +7,14 @@ export function getSharePoster(data) {
     data: data,
     noToken: true,
   });
+}
+
+// 公众号分享微信参数
+export function getShareGzh(data) {
+  return myRequest({
+    url: "/app/common/shareGzh",
+    method: "get",
+    data: data,
+    noToken: true,
+  });
 }

+ 6 - 30
utils/request.js

@@ -7,7 +7,6 @@ var num = 1;
 export const BASE_URL = config.BASE_URL;
 export const host = setHost();
 export let tenantId = uni.getStorageSync(host) || "";
-
 export const myRequest = (options) => {
   if (store.state.allowLoading && !options.noLoading) {
     uni.showLoading({
@@ -88,38 +87,15 @@ export const myRequest = (options) => {
   });
   async function doRequest(response) {
     let user_account = uni.getStorageSync("user_account");
-    var datas = {
+    const res = await myRequest({
       url: "/app/common/seller/refreshToken/" + user_account,
       method: "get",
       noToken: true,
-    };
-    const res = await myRequest(datas);
-    if (res.data.code === 200) {
-      uni.setStorageSync("token", res.data.data.token);
-
-      var userInfo = {
-        url: "/app/user/getInfo",
-        method: "get",
-        data: { fromPlat: 1 }, // 来源平台 1小程序 2PC网站
-      };
-      const resUser = await myRequest(userInfo);
-      if (resUser.data.code === 200) {
-        store.state.userInfo = resUser.data.data;
-        uni.setStorageSync("user_account", user_account);
-        num = 1;
-      }
-      let onset = await myRequest(response);
-      return onset;
-    } else {
-      var pages = getCurrentPages(); // 获取栈实例
-      let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由
-      console.log("request-->333:", currentRoute);
-      if (currentRoute != "pages4/login/login") {
-        uni.navigateTo({
-          url: "/pages4/login/login",
-        });
-      }
-    }
+    });
+    uni.setStorageSync("token", res.token);
+    num = 1;
+    await store.dispatch("getUserInfo");
+    return await myRequest(response);
   }
 };
 function getTenantId() {

+ 19 - 1
utils/user.js

@@ -38,8 +38,26 @@ export function getWxConfig(data) {
 //绑定公众号
 export function OfficialLogin(data) {
   return myRequest({
-    url: "/app/user/gzh_bind",
+    url: "/distribution/seller/gzh_bind",
     method: "post",
     data: data,
   });
 }
+
+// 提现
+export function withdrawal(data) {
+  return myRequest({
+    url: "/distribution/withdrawal",
+    method: "post",
+    data: data,
+  });
+}
+
+// 提现记录
+export function getWithdrawalList(data) {
+  return myRequest({
+    url: "/distribution/withdrawal/list",
+    method: "get",
+    data: data,
+  });
+}