谢杰标 2 سال پیش
والد
کامیت
e70fcd5fec

+ 3 - 1
App.vue

@@ -1,7 +1,9 @@
 <script>
 export default {
   onLaunch: function () {
-    console.log("App Launch");
+    if (this.$method.isLogin()) {
+      !this.$store.state.userInfo && this.$store.dispatch("getUserInfo");
+    }
   },
   onShow: function () {
     console.log("App Show");

+ 15 - 1
common/tool.js

@@ -60,7 +60,6 @@ export default {
   exit() {
     uni.removeStorageSync("user_account");
     uni.removeStorageSync("token");
-    uni.removeStorageSync("h5_code");
     store.state.userInfo = null;
     uni.reLaunch({
       url: "/pages/index/index",
@@ -168,3 +167,18 @@ export function checkDomain(str) {
   return domain.test(str);
 }
 
+export function getQueryString(name) {
+  const url = location.search; //获取url中"?"符后的字串
+  let theRequest = new Object();
+  if (url.indexOf("?") != -1) {
+    let str = url.substr(1);
+    let strs = str.split("&");
+    for (let i = 0; i < strs.length; i++) {
+      theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
+    }
+  }
+  if (name) {
+    return theRequest[name];
+  }
+  return theRequest;
+}

+ 30 - 0
node_modules/_jweixin-module@1.6.0@jweixin-module/README.md

@@ -0,0 +1,30 @@
+# jweixin-module
+
+微信JS-SDK
+
+## 安装
+
+### NPM
+
+```shell
+npm install jweixin-module --save
+```
+
+### UMD
+
+```http
+https://unpkg.com/jweixin-module/out/index.js
+```
+
+## 使用
+
+```js
+var jweixin = require('jweixin-module')
+jweixin.ready(function(){
+    // TODO
+});
+```
+
+## 完整API
+
+>[微信JS-SDK说明文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115)

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
node_modules/_jweixin-module@1.6.0@jweixin-module/lib/index.js


+ 29 - 0
node_modules/_jweixin-module@1.6.0@jweixin-module/package.json

@@ -0,0 +1,29 @@
+{
+  "name": "jweixin-module",
+  "version": "1.6.0",
+  "description": "微信JS-SDK",
+  "main": "lib/index.js",
+  "scripts": {},
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/zhetengbiji/jweixin-module.git"
+  },
+  "keywords": [
+    "wxjssdk",
+    "weixin",
+    "jweixin",
+    "wechat",
+    "jssdk",
+    "wx"
+  ],
+  "author": "Shengqiang Guo",
+  "license": "ISC",
+  "bugs": {
+    "url": "https://github.com/zhetengbiji/jweixin-module/issues"
+  },
+  "homepage": "https://github.com/zhetengbiji/jweixin-module#readme",
+  "devDependencies": {},
+  "__npminstall_done": true,
+  "_from": "jweixin-module@1.6.0",
+  "_resolved": "https://registry.npmmirror.com/jweixin-module/-/jweixin-module-1.6.0.tgz"
+}

+ 30 - 0
node_modules/jweixin-module/README.md

@@ -0,0 +1,30 @@
+# jweixin-module
+
+微信JS-SDK
+
+## 安装
+
+### NPM
+
+```shell
+npm install jweixin-module --save
+```
+
+### UMD
+
+```http
+https://unpkg.com/jweixin-module/out/index.js
+```
+
+## 使用
+
+```js
+var jweixin = require('jweixin-module')
+jweixin.ready(function(){
+    // TODO
+});
+```
+
+## 完整API
+
+>[微信JS-SDK说明文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115)

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
node_modules/jweixin-module/lib/index.js


+ 29 - 0
node_modules/jweixin-module/package.json

@@ -0,0 +1,29 @@
+{
+  "name": "jweixin-module",
+  "version": "1.6.0",
+  "description": "微信JS-SDK",
+  "main": "lib/index.js",
+  "scripts": {},
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/zhetengbiji/jweixin-module.git"
+  },
+  "keywords": [
+    "wxjssdk",
+    "weixin",
+    "jweixin",
+    "wechat",
+    "jssdk",
+    "wx"
+  ],
+  "author": "Shengqiang Guo",
+  "license": "ISC",
+  "bugs": {
+    "url": "https://github.com/zhetengbiji/jweixin-module/issues"
+  },
+  "homepage": "https://github.com/zhetengbiji/jweixin-module#readme",
+  "devDependencies": {},
+  "__npminstall_done": true,
+  "_from": "jweixin-module@1.6.0",
+  "_resolved": "https://registry.npmmirror.com/jweixin-module/-/jweixin-module-1.6.0.tgz"
+}

+ 1 - 0
package.json

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

+ 19 - 4
pages/actdetail/index.vue

@@ -36,7 +36,9 @@
             </view>
             <view class="fl lebel">
               <view>数值:</view>
-              <view>{{ item.profitMax }}{{ item.profitType == 1 ? "%" : "" }}</view>
+              <view
+                >{{ item.profitMax }}{{ item.profitType == 1 ? "%" : "" }}</view
+              >
             </view>
             <view class="fl lebel">
               <view>一级佣金:</view>
@@ -67,17 +69,16 @@
     </view>
     <view class="actdetail-btn">
       <u-button
-        :disabled="isUse"
         class="c_btn"
         text="生成专属海报"
-        @click="jumpLogin"
+        @click="getLinkCode"
       ></u-button>
     </view>
   </view>
 </template>
 
 <script>
-import { getActDetail } from "@/utils/act";
+import { getActDetail, getLinkCode } from "@/utils/act";
 export default {
   name: "SaasManagerIndex",
 
@@ -95,6 +96,20 @@ export default {
         this.detailInfo = res;
       });
     },
+    getLinkCode() {
+      let { distributionId } = this.detailInfo;
+      getLinkCode({ distributionId }).then((res) => {
+        uni.navigateTo({
+          url:
+            "/pages/bill/index?distributionId=" +
+            distributionId +
+            "&linkCode=" +
+            res +
+            "&shareCode=" +
+            this.$store.state.userInfo.shareCode,
+        });
+      });
+    },
   },
 };
 </script>

+ 13 - 6
pages/actlist/index.vue

@@ -31,8 +31,7 @@
 </template>
 
 <script>
-import { getActList, makePoster } from "@/utils/act";
-import { downloadFile, base64ToPath } from "@/common/upload";
+import { getActList, getLinkCode } from "@/utils/act";
 export default {
   data() {
     return {
@@ -56,8 +55,16 @@ export default {
       };
     },
     makePoster(distributionId) {
-      makePoster({ distributionId }).then(async (res) => {
-        downloadFile(await base64ToPath(res), "海报");
+      getLinkCode({ distributionId }).then((res) => {
+        uni.navigateTo({
+          url:
+            "/pages/bill/index?distributionId=" +
+            distributionId +
+            "&linkCode=" +
+            res +
+            "&shareCode=" +
+            this.$store.state.userInfo.shareCode,
+        });
       });
     },
     toDetail(distributionId) {
@@ -72,11 +79,11 @@ export default {
     this.getActList();
   },
   onReachBottom() {
-    if (this.actList.length < this.total) {
+    if (this.actList.length >= this.total) {
       return;
     }
     this.param.pageNum++;
-    this.getBankList();
+    this.getActList();
   },
 };
 </script>

+ 93 - 33
pages/bill/index.vue

@@ -1,51 +1,111 @@
 <template>
-  <view>
-    <tki-qrcode
-      ref="qrcode"
-      :val="val"
-      :size="size"
-      :unit="unit"
-      :background="background"
-      :foreground="foreground"
-      :pdground="pdground"
-      :lv="lv"
-      :onval="onval"
-      :loadMake="loadMake"
-      @result="qrR"
-    />
+  <view class="bill-ward">
+    <view v-for="(item, index) in posterConfig" :key="index">
+      <image
+        :style="item.css"
+        v-if="item.type == 0 && item.checked"
+        :src="$method.splitImgHost(item.name, true)"
+        mode=""
+      />
+      <view :style="backPosition(item)" style="white-space:pre-wrap;">
+        <view :style="item.css" v-if="item.type == 1">
+          {{ item.name }}
+        </view>
+      </view>
+      <view :style="backPosition(item)">
+        <image
+          :style="item.css"
+          v-if="item.type == 2"
+          :src="$method.splitImgHost(item.name, true)"
+          mode=""
+        />
+      </view>
+      <view v-if="item.type == 3" :style="backPosition(item)">
+        <tki-qrcode
+          :cid="item.codeUrl"
+          ref="qrcode"
+          :val="item.codeUrl"
+          :size="item.height * 2"
+          unit="upx"
+          background="#ffffff"
+          foreground="#000000"
+          pdground="#000000"
+          :lv="3"
+          :onval="true"
+          :loadMake="true"
+        />
+      </view>
+    </view>
   </view>
 </template>
 
 <script>
+import { getSharePoster } from "@/utils/bill";
 import tkiQrcode from "tki-qrcode";
 export default {
-  name: "SaasManagerIndex",
-
   data() {
     return {
-      val: "生成二维码内容", //要生成二维码的值
-      size: 250, // 二维码的大小 单位为rpx
-      background: "#ffffff", //背景色
-      foreground: "#000000",
-      pdground: "#000000", //角标色
-      icon: "", //二维码图标
-      iconsize: 30, //二维码图标大小
-      lv: 3, //二维码容错级别
-      onval: true, //val值变化时自动重新生成二维码
-      unit: "upx",
-      loadMake: true, //组件加载完成后自动生成二维码
-      src: "",
-      showLoading: true, //loading
-      loadingText: "loading内容", //loading内容
-      title: "Hello",
+      options: {},
+      posterConfig: [],
+      billDetail: {},
+      bg: {},
     };
   },
+  onLoad(options) {
+    this.options = options;
+    this.getSharePoster();
+  },
   components: {
     tkiQrcode,
   },
 
-  methods: {},
+  methods: {
+    getSharePoster() {
+      getSharePoster(this.options).then((res) => {
+        this.billDetail = res;
+        this.posterConfig = this.changeData(JSON.parse(res.posterConfig));
+      });
+    },
+    changeData(data) {
+      Object.keys(data)
+        .filter((key) => {
+          if (key == "distribution" || key == "cardCode") {
+            data[key].codeUrl =
+              this.billDetail[
+                key == "distribution" ? "urlCard" : "urlActivity"
+              ];
+          }
+          return data[key].checked;
+        })
+        .forEach((key) => this.backStyle(data[key].css));
+      return Object.values(data);
+    },
+    px2rpx(data) {
+      if (!data.includes("px")) {
+        return data;
+      }
+      return data.split("px")[0] * 2 + "rpx";
+    },
+    backPosition(item) {
+      return {
+        position: "absolute",
+        left: item.left * 2 + "rpx",
+        top: item.top * 2 + "rpx",
+        width: item.width * 2 + "rpx",
+        height: item.height * 2 + "rpx",
+      };
+    },
+    backStyle(item) {
+      Object.keys(item).forEach((e) => {
+        item[e] = this.px2rpx(item[e]);
+      });
+    },
+  },
 };
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.bill-ward {
+  position: relative;
+}
+</style>

+ 40 - 9
pages/cashout/index.vue

@@ -49,11 +49,10 @@
           <image src="../../static/image/icon_tick.png" mode="" />
         </view>
         <u-button
-        :disabled="isUse"
-        class="c_btn popup-main-btn"
-        text="确 认"
-        @click="jumpLogin"
-      ></u-button>
+          class="c_btn popup-main-btn"
+          text="确 认"
+          @click="jumpLogin"
+        ></u-button>
       </view>
     </u-popup>
   </view>
@@ -61,9 +60,9 @@
 
 <script>
 import { mapGetters } from "vuex";
+import { getQueryString } from "@/common/tool";
+import { checkBindGzh, getWxConfig, OfficialLogin } from "@/utils/user";
 export default {
-  name: "SaasManagerIndex",
-
   data() {
     return {
       show: false,
@@ -75,20 +74,52 @@ export default {
       return;
     }
     !this.userInfo && this.$store.dispatch("getUserInfo");
+    location.search.includes("code") && this.OfficialLogin();
   },
   methods: {
     close() {
       this.show = false;
     },
     open() {
-      this.show = true;
-      this.money = this.userInfo.cash;
+      checkBindGzh().then((res) => {
+        if (res || process.env.NODE_ENV == "development") {
+          this.show = true;
+          this.money = this.userInfo.cash;
+        } else {
+          this.authorize();
+        }
+      });
     },
     toRecord() {
       uni.navigateTo({
         url: "/pages/cashout/record",
       });
     },
+    authorize() {
+      // 没有code,就重定向到地址https://www.xyyxt.net?ask_type=https://api.xyyxt.net/pages2/order/confirm_pay 去获取code,授权后就会把code带上然后访问域名
+      // ?fromCart=&code=061F5a1w3aolh03SLe1w3sMsCF4F5a16&state=STATE
+      const url = window.location.host + "/pages/cashout/index";
+      getWxConfig().then((res) => {
+        location.replace(
+          `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${
+            res.gzhAppId
+          }&redirect_uri=${encodeURIComponent(
+            "https://" + url
+          )}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
+        );
+      });
+    },
+    OfficialLogin() {
+      this.$api
+        .OfficialLogin({
+          code: getQueryString("code"),
+        })
+        .then((res) => {
+          if (res.data.code !== 200) {
+            this.$u.toast(res.data.msg);
+          }
+        });
+    },
   },
   computed: {
     ...mapGetters(["userInfo"]),

+ 42 - 19
pages/commission/index.vue

@@ -11,31 +11,58 @@
           <view class="title u-line-1"
             >活动名称一行展示,超出省略活动名称一行展示,超出省略...</view
           >
-          <view class="money">+120</view>
+          <view class="money">+{{ item.diffNum }}</view>
         </view>
-        <view class="fl com-ward-list-item-status">
-          <view class="u-border-right">正常</view>
-          <view>2023年3月1日 10:53</view>
+        <view class="com-ward-list-item-status">
+          {{ item.createTime | formate("yyyy-mm-dd hh:mm") }}
         </view>
       </view>
     </view>
-    <view class="nomore">已显示全部</view>
+    <view class="nomore" v-if="total && list.length == tota">
+      "已显示全部"
+    </view>
+    <view class="nomore" v-if="!total"> 暂无数据 </view>
   </view>
 </template>
 
 <script>
+import { getCashList } from "@/utils/commission";
 export default {
   name: "commission",
 
   data() {
     return {
-      list: [{ id: 1 }, { id: 2 }],
+      list: [],
+      total: 0,
+      param: {},
     };
   },
-
-  mounted() {},
-
-  methods: {},
+  onShow() {
+    this.reset();
+    this.getCashList();
+  },
+  onReachBottom() {
+    if (this.list.length >= this.total) {
+      return;
+    }
+    this.param.pageNum++;
+    this.getCashList();
+  },
+  methods: {
+    reset() {
+      this.actList = [];
+      this.param = {
+        pageNum: 1,
+        pageSize: 10,
+      };
+    },
+    getCashList() {
+      getCashList(this.param).then((res) => {
+        this.list.push(...res.rows);
+        this.total = res.total;
+      });
+    },
+  },
 };
 </script>
 
@@ -50,9 +77,10 @@ page {
       margin-top: 40rpx;
       .com-ward-list-item-top {
         image {
-          width: 40rpx;
-          height: 40rpx;
-          margin-right: 12rpx;
+          width: 32rpx;
+          height: 32rpx;
+          margin-right: 14rpx;
+          padding-top: 4rpx;
         }
         .title {
           flex: 1;
@@ -72,12 +100,7 @@ page {
         margin: 24rpx 0 40rpx;
         color: #7e7d83;
         font-size: 28rpx;
-
-        view {
-          line-height: 28rpx;
-          padding-right: 24rpx;
-          margin-right: 24rpx;
-        }
+        padding-left: 44rpx;
       }
     }
   }

+ 0 - 1
unpackage/dist/dev/mp-weixin/common/vendor.js

@@ -9640,7 +9640,6 @@ var _default = {
   exit: function exit() {
     uni.removeStorageSync("user_account");
     uni.removeStorageSync("token");
-    uni.removeStorageSync("h5_code");
     _index.default.state.userInfo = null;
     uni.reLaunch({
       url: "/pages/index/index"

+ 9 - 0
utils/act.js

@@ -22,3 +22,12 @@ export function getActDetail(id) {
     method: "get",
   });
 }
+
+// 获得链条吗
+export function getLinkCode(data) {
+  return myRequest({
+    url: "/distribution/poster/linkCode",
+    method: "get",
+    data
+  });
+}

+ 10 - 0
utils/bill.js

@@ -0,0 +1,10 @@
+import { myRequest } from "./request.js";
+// 获取分享页面参数
+export function getSharePoster(data) {
+  return myRequest({
+    url: "/app/common/distribution/sharePoster",
+    method: "get",
+    data: data,
+    noToken: true,
+  });
+}

+ 8 - 0
utils/commission.js

@@ -0,0 +1,8 @@
+import { myRequest } from "./request.js";
+//登录短信
+export function getCashList() {
+  return myRequest({
+    url: "/distribution/cash/log/fromOrderCashList",
+    method: "get",
+  });
+}

+ 0 - 1
utils/request.js

@@ -118,7 +118,6 @@ export const myRequest = (options) => {
         uni.navigateTo({
           url: "/pages4/login/login",
         });
-        uni.removeStorageSync("h5_code");
       }
     }
   }

+ 29 - 1
utils/user.js

@@ -14,4 +14,32 @@ export function getInfoByShareCode(data) {
     data: data,
     noToken: true,
   });
-}
+}
+
+// 查询用户是否绑定公众号
+export function checkBindGzh(data) {
+  return myRequest({
+    url: "/distribution/seller/checkBindGzh",
+    method: "get",
+    data,
+  });
+}
+
+// 获取appid
+export function getWxConfig(data) {
+  return myRequest({
+    url: "/app/common/wx/config",
+    method: "get",
+    data: data,
+    noToken: true,
+  });
+}
+
+//绑定公众号
+export function OfficialLogin(data) {
+  return myRequest({
+    url: "/app/user/gzh_bind",
+    method: "post",
+    data: data,
+  });
+}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است