瀏覽代碼

完成部分模块

wzy 1 年之前
父節點
當前提交
c4a29ad6bc

+ 8 - 1
components/modal/modal.vue

@@ -11,7 +11,7 @@
             </view>
             <view class="modal-btn" v-if="showBtn">
                 <button @click="closeModal">取消</button>
-                <button>注册开店</button>
+                <button @click="btnClick">{{ showText }}</button>
             </view>
         </view>
     </tui-modal>
@@ -34,6 +34,10 @@ export default {
         showBtn: {
             type: Boolean,
             default: false
+        },
+        showText:{
+            type:String,
+            default:'注册开店'
         }
     },
     data() {
@@ -43,6 +47,9 @@ export default {
     methods: {
         closeModal(){
             this.$emit('closeModal')
+        },
+        btnClick(){
+            this.$emit('btnClick')
         }
     },
 };

+ 2 - 1
config/index.js

@@ -1,4 +1,5 @@
 //  导出所有模块的请求
 export * from "./modules/login"
 export * from "./modules/home"
-export * from "./modules/order"
+export * from "./modules/order"
+export * from "./modules/user"

+ 16 - 0
config/modules/user.js

@@ -0,0 +1,16 @@
+import { request, request1 } from "@/utils/request.js";
+
+// 获取流水
+export function getFinanceCount(data) {
+    return request(`/finance/getFinanceCount`, data, "POST");
+  }
+
+  //  更新店铺信息
+  export function updateShopInfo(data) {
+    return request(`/shop/update`, data, "POST");
+  }
+
+  //  获取店铺收款码
+  export function getShopQrcode(data) {
+    return request(`/paymentCode/generateCode`, data, "POST");
+  }

+ 7 - 0
main.js

@@ -3,10 +3,17 @@ import App from './App'
 // #ifndef VUE3
 import Vue from 'vue'
 import './uni.promisify.adaptor'
+
+
 //  将工具函数挂载到原型上面去
 import { showToast,loading } from '@/utils/index'
 Vue.prototype.$showToast = showToast
 Vue.prototype.$loading = loading
+
+//  挂载全局的 mixin
+import mixin from '@/mixins/index'
+Vue.mixin(mixin)
+
 //  挂载 Vuex
 import store from './store'
 Vue.config.productionTip = false

+ 16 - 0
mixins/index.js

@@ -0,0 +1,16 @@
+// 这里的 mixin 是混入到全局的 mixin
+
+export default {
+    data () {
+        return {
+            
+        }
+    },
+    methods: {
+        navigateTo(url){
+            uni.navigateTo({
+                url: url
+            })
+        }
+    }
+}

+ 44 - 2
pages.json

@@ -33,7 +33,8 @@
     {
       "path": "pages/tabbar/user/index",
       "style": {
-        "navigationBarTitleText": "我的"
+        "navigationBarTitleText": "个人中心",
+        "navigationStyle": "custom"
       }
     }
   ],
@@ -67,12 +68,53 @@
 					}
 				}
       ]
+    },
+    {
+      "root": "user_module",
+			"name":"user_module",
+      "pages":[
+        {
+					"path": "businessInfo/index",
+					"style": {
+						"navigationBarTitleText": "商家信息"
+					}
+				},
+        {
+					"path": "changeLogo/index",
+					"style": {
+						"navigationBarTitleText": "店铺LOGO",
+            "navigationBarBackgroundColor":"#000",
+            "navigationBarTextStyle":"white"
+					}
+				},
+        {
+					"path": "changeInfo/index",
+					"style": {
+						"navigationBarTitleText": "信息修改"
+					}
+				},
+        {
+					"path": "merchantCode/index",
+					"style": {
+						"navigationBarTitleText": "商家码",
+            "navigationBarBackgroundColor":"#F7F7F7",
+            "navigationBarTextStyle":"black"
+					}
+				},
+        {
+					"path": "codeDetail/index",
+					"style": {
+						"navigationBarTitleText": "商家码详情",
+            "navigationStyle": "custom"
+					}
+				}
+      ]
     }
   ],
   "globalStyle": {
     "navigationBarTextStyle": "black",
     "navigationBarTitleText": "uni-app",
-    "navigationBarBackgroundColor": "#F8F8F8",
+    "navigationBarBackgroundColor": "#FFFFFF",
     "backgroundColor": "#F8F8F8"
   },
   "tabBar": {

+ 4 - 1
pages/login/index.vue

@@ -196,7 +196,10 @@ export default {
                 });
 
             } catch (error) {
-                console.log(error);
+                uni.showToast({
+                    title: error,
+                    duration: 1000000
+                });
             } finally {
                 this.$loading.hide();
             }

+ 2 - 2
pages/tabbar/order/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="order">
+  <view class="order">
     <capsule :showBorder="true" bgColor="#FFFFFF">
       <template v-slot:top>
         <view class="order-box">订单列表</view>
@@ -77,7 +77,7 @@
        <view class="empty-title">暂无订单信息</view>
        <view class="empty-info">有订单信息您会在这边看到的</view>
     </view>
-  </div>
+  </view>
 </template>
 
 <script>

+ 172 - 0
pages/tabbar/user/index.scss

@@ -0,0 +1,172 @@
+.user {
+  width: 100vw;
+  min-height: 100vh;
+  background-color: rgb(247, 247, 247);
+
+  .user-box {
+    width: 100%;
+    height: 100%;
+    @include flex(center);
+  }
+  .seize {
+    width: 100%;
+    height: 20rpx;
+    background-color: #ffffff;
+  }
+  .picture-bg {
+    width: 100%;
+    height: 372rpx;
+    position: relative;
+    .bg-icon {
+      position: absolute;
+      top: 40rpx;
+      right: 30rpx;
+      z-index: 2;
+      @include flex(null, null, 26rpx);
+    }
+    .bg-image {
+      width: 100%;
+      height: 100%;
+      filter: blur(4rpx);
+      image {
+        width: 100%;
+        height: 100%;
+        display: block;
+      }
+    }
+    .bg-info {
+      position: absolute;
+      bottom: -74rpx;
+      left: 32rpx;
+      @include flex(null, null, 26rpx);
+      .info-image {
+        position: relative;
+        .img {
+          width: 158rpx;
+          height: 158rpx;
+          padding: 5rpx;
+          box-sizing: border-box;
+          border-radius: 50%;
+          background-color: rgba(255, 255, 255, 0.5);
+          @include flex(center);
+          image {
+            width: 148rpx;
+            height: 148rpx;
+            border-radius: 50%;
+          }
+        }
+        .info-switch {
+          width: 52rpx;
+          height: 52rpx;
+          position: absolute;
+          right: 6rpx;
+          bottom: 0;
+          image {
+            width: 100%;
+            height: 100%;
+          }
+        }
+      }
+      .info-text {
+        height: 150rpx;
+        display: flex;
+        justify-content: space-around;
+        flex-direction: column;
+        .text-title {
+          font-size: 36rpx;
+          color: #ffffff;
+          font-weight: 700;
+        }
+        .text-lable {
+          @include flex(null, null, 20rpx);
+          .lable {
+            font-size: 24rpx;
+            color: #3d3d3d;
+            padding: 4rpx 20rpx;
+            background-color: #f9f9f9;
+            border-radius: 30rpx;
+          }
+        }
+      }
+    }
+  }
+  .user-container {
+    padding: 114rpx 28rpx 28rpx;
+    box-sizing: border-box;
+    background-color: #ffffff;
+    .user-flowing {
+      width: 100%;
+      height: 132rpx;
+      background: linear-gradient(270deg, #fe4b1e 0%, #fb8857 100%);
+      border-radius: 30rpx 30rpx 0 0;
+      @include flex(null, null, null);
+      .flowing-box {
+        flex: 1;
+        @include flex(null, column, 22rpx);
+        .flowing-txt {
+          font-size: 24rpx;
+          color: #ffffff;
+          font-weight: 600;
+        }
+        .flowing-price {
+          font-size: 32rpx;
+          color: #ffffff;
+          font-weight: 600;
+        }
+      }
+      .left {
+        position: relative;
+        &::after {
+          content: "";
+          width: 4rpx;
+          height: 95%;
+          background-color: #ffffff;
+          position: absolute;
+          right: 0;
+          top: 50%;
+          transform: translateY(-50%);
+        }
+      }
+    }
+    .user-account {
+      width: 100%;
+      .account-top {
+        width: 100%;
+        padding: 36rpx 0;
+        padding-right: 16rpx;
+        box-sizing: border-box;
+        border-bottom: 1rpx solid #e4e4e4;
+        @include flex(space-between);
+        text {
+          font-size: 28rpx;
+          color: #333333;
+          font-weight: 600;
+        }
+      }
+      .account-bottom {
+        width: 100%;
+        @include flex(null, null, null);
+        flex-wrap: wrap;
+        .bottom-box {
+          width: 25%;
+          margin-top: 20rpx;
+          @include flex(center, column, 20rpx);
+          image{
+            width: 50rpx;
+            height: 50rpx;
+            display: block;
+          }
+          text{
+            font-size: 28rpx;
+            color: #666666;
+          }
+        }
+      }
+    }
+  }
+}
+
+.number {
+    line-height: 30rpx;
+    transition: transform 0.3s linear;
+  }

+ 163 - 6
pages/tabbar/user/index.vue

@@ -1,15 +1,172 @@
 <template>
-  <div class="user">
-    这里是我的页面
-  </div>
+  <view class="user">
+    <capsule :showBorder="true" bgColor="#FFFFFF">
+      <template v-slot:top>
+        <view class="user-box">个人中心</view>
+      </template>
+    </capsule>
+    <view class="seize"></view>
+    <view class="picture-bg">
+      <view class="bg-icon">
+        <tui-icon name="notice" :size="24" color="#FFFFFF"></tui-icon>
+        <tui-icon name="setup" :size="24" color="#FFFFFF" @click="navigateTo('/user_module/businessInfo/index')"></tui-icon>
+      </view>
+      <view class="bg-image">
+        <image
+          class=""
+          :src="shopInfo.shopLogo"
+          mode="center"
+        />
+      </view>
+      <view class="bg-info">
+        <view class="info-image">
+          <view class="img">
+            <image
+              class=""
+              :src="shopInfo.shopLogo"
+            />
+          </view>
+          <view class="info-switch">
+            <image class="" src="@/static/image/user/switch.png" />
+          </view>
+        </view>
+        <view class="info-text">
+          <view class="text-title">{{ shopInfo.shopName }}</view>
+          <view class="text-lable">
+            <view class="lable">{{ shopInfo.shopReturn.returnPerson }}</view>
+            <view class="lable">{{ shopInfo.shopPhone }}</view>
+          </view>
+        </view>
+      </view>
+    </view>
+    <view class="user-container">
+      <view class="user-flowing">
+        <view class="flowing-box left">
+          <view class="flowing-txt">营业额</view>
+          <view class="flowing-price">¥{{ turnover }}元</view>
+        </view>
+        <view class="flowing-box left">
+          <view class="flowing-txt">途中金额</view>
+          <view class="flowing-price"
+            >¥{{ frozenMoney }}元</view
+          >
+        </view>
+        <view class="flowing-box">
+          <view class="flowing-txt">已到账金额</view>
+          <view class="flowing-price"
+            >¥{{ withdrawableMoney }}元</view
+          >
+        </view>
+      </view>
+      <view class="user-account">
+        <view class="account-top">
+          <text>我的账户</text>
+          <tui-icon name="arrowright" :size="26" colo="#666666"></tui-icon>
+        </view>
+        <view class="account-bottom">
+          <view
+            class="bottom-box"
+            v-for="item in accountList"
+            :key="item.title"
+            @click="userAccount(item)"
+          >
+            <image class="" :src="item.image" />
+            <text>{{ item.title }}</text>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
 </template>
 
 <script>
+import { getFinanceCount,getShopDetail } from "@/config/index.js";
 export default {
+  created() {
+    this.getFinance();
 
-}
+    //  本地获取店铺信息
+    this.shopInfo = uni.getStorageSync('shopInfo')
+    //  如果没有店铺信息 请求店铺信息
+    if(!this.shopInfo){
+      this.getShop()
+    }
+  },
+  data() {
+    return {
+      shopInfo:null,
+      turnover: 0,
+      frozenMoney: 0,
+      withdrawableMoney:0,
+      accountList: [
+        {
+          title: "商家入驻",
+          image: require("@/static/image/user/account_01.png"),
+        },
+        {
+          title: "商家码",
+          image: require("@/static/image/user/account_02.png"),
+          url:'/user_module/merchantCode/index'
+        },
+        {
+          title: "员工账户",
+          image: require("@/static/image/user/account_03.png"),
+        },
+        {
+          title: "官方客服",
+          image: require("@/static/image/user/account_04.png"),
+        },
+      ],
+      financeInfo: {},
+    };
+  },
+  methods: {
+    // 获取流水
+    async getFinance() {
+      let res = await getFinanceCount({ condition: "1", time: "" });
+      this.financeInfo = res.data;
+      this.animateNumber('turnover',res.data.turnover)
+      this.animateNumber('frozenMoney',res.data.frozenMoney)
+      this.animateNumber('withdrawableMoney',res.data.withdrawableMoney)
+    },
+    //  获取店铺详情
+		async getShop() {
+			let { data } = await getShopDetail({});
+			this.shopInfo = data
+			//  将店铺存到本地
+			uni.setStorageSync('shopInfo', data)
+		},
+    //  流水动画
+    animateNumber(str,targetNum) {
+      const duration = 2000; // 动画时长,单位毫秒
+      const interval = 20; // 动画间隔时间,单位毫秒
+      const distance = targetNum - this[str];
+      const steps = duration / interval;
+      const step = distance / steps;
+
+      let currentStep = 0;
+      const timer = setInterval(() => {
+        if(!targetNum) return
+        currentStep++;
+        this[str] = parseFloat((this[str] + step).toFixed(2));
+        if (currentStep >= steps) {
+          this[str] = targetNum;
+          clearInterval(timer);
+        }
+      }, interval);
+    },
+    // 下方功能页面跳转
+    userAccount(item){
+      if(!item.url){
+        this.$showToast('功能暂未开放');
+        return
+      }
+      this.navigateTo(item.url)
+    }
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-
-</style>
+@import "./index.scss";
+</style>

+ 7 - 2
pages_module/scanCode/index.vue

@@ -45,7 +45,9 @@ export default {
     created() {
         //  获取本地存储的店铺数据
         this.shopInfo = uni.getStorageSync('shopInfo');
-        this.getOrderIdFromUrl('https://test.tuanfengkeji.cn/TFShop_Uni_H5/#/pages/jump/jump?orderId=4979&type=verification&code=4979~JFHXQSZD4F')
+        setTimeout(() => {
+            this.getOrderIdFromUrl('https://test.tuanfengkeji.cn/TFShop_Uni_H5/#/pages/jump/jump?orderId=4979&type=verification&code=4979~JFHXQSZD4F')
+        }, 8000)
     },
     onShow() {
         this.lineAnimation()
@@ -144,7 +146,10 @@ export default {
             })
         },
         backClick() {
-            uni.navigateBack()
+            // uni.navigateBack()
+            uni.switchTab({
+                 url: '/pages/tabbar/index/index'
+            });
         }
     },
 }

二進制
static/image/user/account_01.png


二進制
static/image/user/account_02.png


二進制
static/image/user/account_03.png


二進制
static/image/user/account_04.png


二進制
static/image/user/code.png


二進制
static/image/user/logo_1.png


二進制
static/image/user/logo_2.png


二進制
static/image/user/switch.png


+ 907 - 0
static/js/qrcode.js

@@ -0,0 +1,907 @@
+/**
+ * weapp.qrcode.js v1.0.0 (https://github.com/yingye/weapp-qrcode#readme)
+ */
+
+var hasOwn = Object.prototype.hasOwnProperty,
+  toStr = Object.prototype.toString,
+  defineProperty = Object.defineProperty,
+  gOPD = Object.getOwnPropertyDescriptor,
+  isArray = function (t) {
+    return "function" == typeof Array.isArray
+      ? Array.isArray(t)
+      : "[object Array]" === toStr.call(t);
+  },
+  isPlainObject = function (t) {
+    if (!t || "[object Object]" !== toStr.call(t)) return !1;
+    var e,
+      r = hasOwn.call(t, "constructor"),
+      o =
+        t.constructor &&
+        t.constructor.prototype &&
+        hasOwn.call(t.constructor.prototype, "isPrototypeOf");
+    if (t.constructor && !r && !o) return !1;
+    for (e in t);
+    return void 0 === e || hasOwn.call(t, e);
+  },
+  setProperty = function (t, e) {
+    defineProperty && "__proto__" === e.name
+      ? defineProperty(t, e.name, {
+          enumerable: !0,
+          configurable: !0,
+          value: e.newValue,
+          writable: !0,
+        })
+      : (t[e.name] = e.newValue);
+  },
+  getProperty = function (t, e) {
+    if ("__proto__" === e) {
+      if (!hasOwn.call(t, e)) return;
+      if (gOPD) return gOPD(t, e).value;
+    }
+    return t[e];
+  },
+  extend = function t() {
+    var e,
+      r,
+      o,
+      n,
+      i,
+      a,
+      s = arguments[0],
+      u = 1,
+      l = arguments.length,
+      h = !1;
+    for (
+      "boolean" == typeof s && ((h = s), (s = arguments[1] || {}), (u = 2)),
+        (null == s || ("object" != typeof s && "function" != typeof s)) &&
+          (s = {});
+      u < l;
+      ++u
+    )
+      if (null != (e = arguments[u]))
+        for (r in e)
+          (o = getProperty(s, r)),
+            s !== (n = getProperty(e, r)) &&
+              (h && n && (isPlainObject(n) || (i = isArray(n)))
+                ? (i
+                    ? ((i = !1), (a = o && isArray(o) ? o : []))
+                    : (a = o && isPlainObject(o) ? o : {}),
+                  setProperty(s, { name: r, newValue: t(h, a, n) }))
+                : void 0 !== n && setProperty(s, { name: r, newValue: n }));
+    return s;
+  };
+function QR8bitByte(t) {
+  (this.mode = QRMode.MODE_8BIT_BYTE), (this.data = t);
+}
+function QRCode(t, e) {
+  (this.typeNumber = t),
+    (this.errorCorrectLevel = e),
+    (this.modules = null),
+    (this.moduleCount = 0),
+    (this.dataCache = null),
+    (this.dataList = new Array());
+}
+(QR8bitByte.prototype = {
+  getLength: function (t) {
+    return this.data.length;
+  },
+  write: function (t) {
+    for (var e = 0; e < this.data.length; e++)
+      t.put(this.data.charCodeAt(e), 8);
+  },
+}),
+  (QRCode.prototype = {
+    addData: function (t) {
+      var e = new QR8bitByte(t);
+      this.dataList.push(e), (this.dataCache = null);
+    },
+    isDark: function (t, e) {
+      if (t < 0 || this.moduleCount <= t || e < 0 || this.moduleCount <= e)
+        throw new Error(t + "," + e);
+      return this.modules[t][e];
+    },
+    getModuleCount: function () {
+      return this.moduleCount;
+    },
+    make: function () {
+      if (this.typeNumber < 1) {
+        var t = 1;
+        for (t = 1; t < 40; t++) {
+          for (
+            var e = QRRSBlock.getRSBlocks(t, this.errorCorrectLevel),
+              r = new QRBitBuffer(),
+              o = 0,
+              n = 0;
+            n < e.length;
+            n++
+          )
+            o += e[n].dataCount;
+          for (n = 0; n < this.dataList.length; n++) {
+            var i = this.dataList[n];
+            r.put(i.mode, 4),
+              r.put(i.getLength(), QRUtil.getLengthInBits(i.mode, t)),
+              i.write(r);
+          }
+          if (r.getLengthInBits() <= 8 * o) break;
+        }
+        this.typeNumber = t;
+      }
+      this.makeImpl(!1, this.getBestMaskPattern());
+    },
+    makeImpl: function (t, e) {
+      (this.moduleCount = 4 * this.typeNumber + 17),
+        (this.modules = new Array(this.moduleCount));
+      for (var r = 0; r < this.moduleCount; r++) {
+        this.modules[r] = new Array(this.moduleCount);
+        for (var o = 0; o < this.moduleCount; o++) this.modules[r][o] = null;
+      }
+      this.setupPositionProbePattern(0, 0),
+        this.setupPositionProbePattern(this.moduleCount - 7, 0),
+        this.setupPositionProbePattern(0, this.moduleCount - 7),
+        this.setupPositionAdjustPattern(),
+        this.setupTimingPattern(),
+        this.setupTypeInfo(t, e),
+        this.typeNumber >= 7 && this.setupTypeNumber(t),
+        null == this.dataCache &&
+          (this.dataCache = QRCode.createData(
+            this.typeNumber,
+            this.errorCorrectLevel,
+            this.dataList
+          )),
+        this.mapData(this.dataCache, e);
+    },
+    setupPositionProbePattern: function (t, e) {
+      for (var r = -1; r <= 7; r++)
+        if (!(t + r <= -1 || this.moduleCount <= t + r))
+          for (var o = -1; o <= 7; o++)
+            e + o <= -1 ||
+              this.moduleCount <= e + o ||
+              (this.modules[t + r][e + o] =
+                (0 <= r && r <= 6 && (0 == o || 6 == o)) ||
+                (0 <= o && o <= 6 && (0 == r || 6 == r)) ||
+                (2 <= r && r <= 4 && 2 <= o && o <= 4));
+    },
+    getBestMaskPattern: function () {
+      for (var t = 0, e = 0, r = 0; r < 8; r++) {
+        this.makeImpl(!0, r);
+        var o = QRUtil.getLostPoint(this);
+        (0 == r || t > o) && ((t = o), (e = r));
+      }
+      return e;
+    },
+    createMovieClip: function (t, e, r) {
+      var o = t.createEmptyMovieClip(e, r);
+      this.make();
+      for (var n = 0; n < this.modules.length; n++)
+        for (var i = 1 * n, a = 0; a < this.modules[n].length; a++) {
+          var s = 1 * a;
+          this.modules[n][a] &&
+            (o.beginFill(0, 100),
+            o.moveTo(s, i),
+            o.lineTo(s + 1, i),
+            o.lineTo(s + 1, i + 1),
+            o.lineTo(s, i + 1),
+            o.endFill());
+        }
+      return o;
+    },
+    setupTimingPattern: function () {
+      for (var t = 8; t < this.moduleCount - 8; t++)
+        null == this.modules[t][6] && (this.modules[t][6] = t % 2 == 0);
+      for (var e = 8; e < this.moduleCount - 8; e++)
+        null == this.modules[6][e] && (this.modules[6][e] = e % 2 == 0);
+    },
+    setupPositionAdjustPattern: function () {
+      for (
+        var t = QRUtil.getPatternPosition(this.typeNumber), e = 0;
+        e < t.length;
+        e++
+      )
+        for (var r = 0; r < t.length; r++) {
+          var o = t[e],
+            n = t[r];
+          if (null == this.modules[o][n])
+            for (var i = -2; i <= 2; i++)
+              for (var a = -2; a <= 2; a++)
+                this.modules[o + i][n + a] =
+                  -2 == i || 2 == i || -2 == a || 2 == a || (0 == i && 0 == a);
+        }
+    },
+    setupTypeNumber: function (t) {
+      for (
+        var e = QRUtil.getBCHTypeNumber(this.typeNumber), r = 0;
+        r < 18;
+        r++
+      ) {
+        var o = !t && 1 == ((e >> r) & 1);
+        this.modules[Math.floor(r / 3)][(r % 3) + this.moduleCount - 8 - 3] = o;
+      }
+      for (r = 0; r < 18; r++) {
+        o = !t && 1 == ((e >> r) & 1);
+        this.modules[(r % 3) + this.moduleCount - 8 - 3][Math.floor(r / 3)] = o;
+      }
+    },
+    setupTypeInfo: function (t, e) {
+      for (
+        var r = (this.errorCorrectLevel << 3) | e,
+          o = QRUtil.getBCHTypeInfo(r),
+          n = 0;
+        n < 15;
+        n++
+      ) {
+        var i = !t && 1 == ((o >> n) & 1);
+        n < 6
+          ? (this.modules[n][8] = i)
+          : n < 8
+          ? (this.modules[n + 1][8] = i)
+          : (this.modules[this.moduleCount - 15 + n][8] = i);
+      }
+      for (n = 0; n < 15; n++) {
+        i = !t && 1 == ((o >> n) & 1);
+        n < 8
+          ? (this.modules[8][this.moduleCount - n - 1] = i)
+          : n < 9
+          ? (this.modules[8][15 - n - 1 + 1] = i)
+          : (this.modules[8][15 - n - 1] = i);
+      }
+      this.modules[this.moduleCount - 8][8] = !t;
+    },
+    mapData: function (t, e) {
+      for (
+        var r = -1,
+          o = this.moduleCount - 1,
+          n = 7,
+          i = 0,
+          a = this.moduleCount - 1;
+        a > 0;
+        a -= 2
+      )
+        for (6 == a && a--; ; ) {
+          for (var s = 0; s < 2; s++)
+            if (null == this.modules[o][a - s]) {
+              var u = !1;
+              i < t.length && (u = 1 == ((t[i] >>> n) & 1)),
+                QRUtil.getMask(e, o, a - s) && (u = !u),
+                (this.modules[o][a - s] = u),
+                -1 == --n && (i++, (n = 7));
+            }
+          if ((o += r) < 0 || this.moduleCount <= o) {
+            (o -= r), (r = -r);
+            break;
+          }
+        }
+    },
+  }),
+  (QRCode.PAD0 = 236),
+  (QRCode.PAD1 = 17),
+  (QRCode.createData = function (t, e, r) {
+    for (
+      var o = QRRSBlock.getRSBlocks(t, e), n = new QRBitBuffer(), i = 0;
+      i < r.length;
+      i++
+    ) {
+      var a = r[i];
+      n.put(a.mode, 4),
+        n.put(a.getLength(), QRUtil.getLengthInBits(a.mode, t)),
+        a.write(n);
+    }
+    var s = 0;
+    for (i = 0; i < o.length; i++) s += o[i].dataCount;
+    if (n.getLengthInBits() > 8 * s)
+      throw new Error(
+        "code length overflow. (" + n.getLengthInBits() + ">" + 8 * s + ")"
+      );
+    for (
+      n.getLengthInBits() + 4 <= 8 * s && n.put(0, 4);
+      n.getLengthInBits() % 8 != 0;
+
+    )
+      n.putBit(!1);
+    for (
+      ;
+      !(
+        n.getLengthInBits() >= 8 * s ||
+        (n.put(QRCode.PAD0, 8), n.getLengthInBits() >= 8 * s)
+      );
+
+    )
+      n.put(QRCode.PAD1, 8);
+    return QRCode.createBytes(n, o);
+  }),
+  (QRCode.createBytes = function (t, e) {
+    for (
+      var r = 0,
+        o = 0,
+        n = 0,
+        i = new Array(e.length),
+        a = new Array(e.length),
+        s = 0;
+      s < e.length;
+      s++
+    ) {
+      var u = e[s].dataCount,
+        l = e[s].totalCount - u;
+      (o = Math.max(o, u)), (n = Math.max(n, l)), (i[s] = new Array(u));
+      for (var h = 0; h < i[s].length; h++) i[s][h] = 255 & t.buffer[h + r];
+      r += u;
+      var f = QRUtil.getErrorCorrectPolynomial(l),
+        g = new QRPolynomial(i[s], f.getLength() - 1).mod(f);
+      a[s] = new Array(f.getLength() - 1);
+      for (h = 0; h < a[s].length; h++) {
+        var c = h + g.getLength() - a[s].length;
+        a[s][h] = c >= 0 ? g.get(c) : 0;
+      }
+    }
+    var d = 0;
+    for (h = 0; h < e.length; h++) d += e[h].totalCount;
+    var R = new Array(d),
+      m = 0;
+    for (h = 0; h < o; h++)
+      for (s = 0; s < e.length; s++) h < i[s].length && (R[m++] = i[s][h]);
+    for (h = 0; h < n; h++)
+      for (s = 0; s < e.length; s++) h < a[s].length && (R[m++] = a[s][h]);
+    return R;
+  });
+for (
+  var QRMode = {
+      MODE_NUMBER: 1,
+      MODE_ALPHA_NUM: 2,
+      MODE_8BIT_BYTE: 4,
+      MODE_KANJI: 8,
+    },
+    QRErrorCorrectLevel = { L: 1, M: 0, Q: 3, H: 2 },
+    QRMaskPattern = {
+      PATTERN000: 0,
+      PATTERN001: 1,
+      PATTERN010: 2,
+      PATTERN011: 3,
+      PATTERN100: 4,
+      PATTERN101: 5,
+      PATTERN110: 6,
+      PATTERN111: 7,
+    },
+    QRUtil = {
+      PATTERN_POSITION_TABLE: [
+        [],
+        [6, 18],
+        [6, 22],
+        [6, 26],
+        [6, 30],
+        [6, 34],
+        [6, 22, 38],
+        [6, 24, 42],
+        [6, 26, 46],
+        [6, 28, 50],
+        [6, 30, 54],
+        [6, 32, 58],
+        [6, 34, 62],
+        [6, 26, 46, 66],
+        [6, 26, 48, 70],
+        [6, 26, 50, 74],
+        [6, 30, 54, 78],
+        [6, 30, 56, 82],
+        [6, 30, 58, 86],
+        [6, 34, 62, 90],
+        [6, 28, 50, 72, 94],
+        [6, 26, 50, 74, 98],
+        [6, 30, 54, 78, 102],
+        [6, 28, 54, 80, 106],
+        [6, 32, 58, 84, 110],
+        [6, 30, 58, 86, 114],
+        [6, 34, 62, 90, 118],
+        [6, 26, 50, 74, 98, 122],
+        [6, 30, 54, 78, 102, 126],
+        [6, 26, 52, 78, 104, 130],
+        [6, 30, 56, 82, 108, 134],
+        [6, 34, 60, 86, 112, 138],
+        [6, 30, 58, 86, 114, 142],
+        [6, 34, 62, 90, 118, 146],
+        [6, 30, 54, 78, 102, 126, 150],
+        [6, 24, 50, 76, 102, 128, 154],
+        [6, 28, 54, 80, 106, 132, 158],
+        [6, 32, 58, 84, 110, 136, 162],
+        [6, 26, 54, 82, 110, 138, 166],
+        [6, 30, 58, 86, 114, 142, 170],
+      ],
+      G15: 1335,
+      G18: 7973,
+      G15_MASK: 21522,
+      getBCHTypeInfo: function (t) {
+        for (
+          var e = t << 10;
+          QRUtil.getBCHDigit(e) - QRUtil.getBCHDigit(QRUtil.G15) >= 0;
+
+        )
+          e ^=
+            QRUtil.G15 <<
+            (QRUtil.getBCHDigit(e) - QRUtil.getBCHDigit(QRUtil.G15));
+        return ((t << 10) | e) ^ QRUtil.G15_MASK;
+      },
+      getBCHTypeNumber: function (t) {
+        for (
+          var e = t << 12;
+          QRUtil.getBCHDigit(e) - QRUtil.getBCHDigit(QRUtil.G18) >= 0;
+
+        )
+          e ^=
+            QRUtil.G18 <<
+            (QRUtil.getBCHDigit(e) - QRUtil.getBCHDigit(QRUtil.G18));
+        return (t << 12) | e;
+      },
+      getBCHDigit: function (t) {
+        for (var e = 0; 0 != t; ) e++, (t >>>= 1);
+        return e;
+      },
+      getPatternPosition: function (t) {
+        return QRUtil.PATTERN_POSITION_TABLE[t - 1];
+      },
+      getMask: function (t, e, r) {
+        switch (t) {
+          case QRMaskPattern.PATTERN000:
+            return (e + r) % 2 == 0;
+          case QRMaskPattern.PATTERN001:
+            return e % 2 == 0;
+          case QRMaskPattern.PATTERN010:
+            return r % 3 == 0;
+          case QRMaskPattern.PATTERN011:
+            return (e + r) % 3 == 0;
+          case QRMaskPattern.PATTERN100:
+            return (Math.floor(e / 2) + Math.floor(r / 3)) % 2 == 0;
+          case QRMaskPattern.PATTERN101:
+            return ((e * r) % 2) + ((e * r) % 3) == 0;
+          case QRMaskPattern.PATTERN110:
+            return (((e * r) % 2) + ((e * r) % 3)) % 2 == 0;
+          case QRMaskPattern.PATTERN111:
+            return (((e * r) % 3) + ((e + r) % 2)) % 2 == 0;
+          default:
+            throw new Error("bad maskPattern:" + t);
+        }
+      },
+      getErrorCorrectPolynomial: function (t) {
+        for (var e = new QRPolynomial([1], 0), r = 0; r < t; r++)
+          e = e.multiply(new QRPolynomial([1, QRMath.gexp(r)], 0));
+        return e;
+      },
+      getLengthInBits: function (t, e) {
+        if (1 <= e && e < 10)
+          switch (t) {
+            case QRMode.MODE_NUMBER:
+              return 10;
+            case QRMode.MODE_ALPHA_NUM:
+              return 9;
+            case QRMode.MODE_8BIT_BYTE:
+            case QRMode.MODE_KANJI:
+              return 8;
+            default:
+              throw new Error("mode:" + t);
+          }
+        else if (e < 27)
+          switch (t) {
+            case QRMode.MODE_NUMBER:
+              return 12;
+            case QRMode.MODE_ALPHA_NUM:
+              return 11;
+            case QRMode.MODE_8BIT_BYTE:
+              return 16;
+            case QRMode.MODE_KANJI:
+              return 10;
+            default:
+              throw new Error("mode:" + t);
+          }
+        else {
+          if (!(e < 41)) throw new Error("type:" + e);
+          switch (t) {
+            case QRMode.MODE_NUMBER:
+              return 14;
+            case QRMode.MODE_ALPHA_NUM:
+              return 13;
+            case QRMode.MODE_8BIT_BYTE:
+              return 16;
+            case QRMode.MODE_KANJI:
+              return 12;
+            default:
+              throw new Error("mode:" + t);
+          }
+        }
+      },
+      getLostPoint: function (t) {
+        for (var e = t.getModuleCount(), r = 0, o = 0; o < e; o++)
+          for (var n = 0; n < e; n++) {
+            for (var i = 0, a = t.isDark(o, n), s = -1; s <= 1; s++)
+              if (!(o + s < 0 || e <= o + s))
+                for (var u = -1; u <= 1; u++)
+                  n + u < 0 ||
+                    e <= n + u ||
+                    (0 == s && 0 == u) ||
+                    (a == t.isDark(o + s, n + u) && i++);
+            i > 5 && (r += 3 + i - 5);
+          }
+        for (o = 0; o < e - 1; o++)
+          for (n = 0; n < e - 1; n++) {
+            var l = 0;
+            t.isDark(o, n) && l++,
+              t.isDark(o + 1, n) && l++,
+              t.isDark(o, n + 1) && l++,
+              t.isDark(o + 1, n + 1) && l++,
+              (0 != l && 4 != l) || (r += 3);
+          }
+        for (o = 0; o < e; o++)
+          for (n = 0; n < e - 6; n++)
+            t.isDark(o, n) &&
+              !t.isDark(o, n + 1) &&
+              t.isDark(o, n + 2) &&
+              t.isDark(o, n + 3) &&
+              t.isDark(o, n + 4) &&
+              !t.isDark(o, n + 5) &&
+              t.isDark(o, n + 6) &&
+              (r += 40);
+        for (n = 0; n < e; n++)
+          for (o = 0; o < e - 6; o++)
+            t.isDark(o, n) &&
+              !t.isDark(o + 1, n) &&
+              t.isDark(o + 2, n) &&
+              t.isDark(o + 3, n) &&
+              t.isDark(o + 4, n) &&
+              !t.isDark(o + 5, n) &&
+              t.isDark(o + 6, n) &&
+              (r += 40);
+        var h = 0;
+        for (n = 0; n < e; n++) for (o = 0; o < e; o++) t.isDark(o, n) && h++;
+        return (r += 10 * (Math.abs((100 * h) / e / e - 50) / 5));
+      },
+    },
+    QRMath = {
+      glog: function (t) {
+        if (t < 1) throw new Error("glog(" + t + ")");
+        return QRMath.LOG_TABLE[t];
+      },
+      gexp: function (t) {
+        for (; t < 0; ) t += 255;
+        for (; t >= 256; ) t -= 255;
+        return QRMath.EXP_TABLE[t];
+      },
+      EXP_TABLE: new Array(256),
+      LOG_TABLE: new Array(256),
+    },
+    i = 0;
+  i < 8;
+  i++
+)
+  QRMath.EXP_TABLE[i] = 1 << i;
+for (i = 8; i < 256; i++)
+  QRMath.EXP_TABLE[i] =
+    QRMath.EXP_TABLE[i - 4] ^
+    QRMath.EXP_TABLE[i - 5] ^
+    QRMath.EXP_TABLE[i - 6] ^
+    QRMath.EXP_TABLE[i - 8];
+for (i = 0; i < 255; i++) QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
+function QRPolynomial(t, e) {
+  if (void 0 == t.length) throw new Error(t.length + "/" + e);
+  for (var r = 0; r < t.length && 0 == t[r]; ) r++;
+  this.num = new Array(t.length - r + e);
+  for (var o = 0; o < t.length - r; o++) this.num[o] = t[o + r];
+}
+function QRRSBlock(t, e) {
+  (this.totalCount = t), (this.dataCount = e);
+}
+function QRBitBuffer() {
+  (this.buffer = new Array()), (this.length = 0);
+}
+function utf16to8(t) {
+  var e, r, o, n;
+  for (e = "", o = t.length, r = 0; r < o; r++)
+    (n = t.charCodeAt(r)) >= 1 && n <= 127
+      ? (e += t.charAt(r))
+      : n > 2047
+      ? ((e += String.fromCharCode(224 | ((n >> 12) & 15))),
+        (e += String.fromCharCode(128 | ((n >> 6) & 63))),
+        (e += String.fromCharCode(128 | ((n >> 0) & 63))))
+      : ((e += String.fromCharCode(192 | ((n >> 6) & 31))),
+        (e += String.fromCharCode(128 | ((n >> 0) & 63))));
+  return e;
+}
+function drawQrcode(t) {
+  (t = t || {}),
+    (t = extend(
+      !0,
+      {
+        width: 256,
+        height: 256,
+        x: 0,
+        y: 0,
+        typeNumber: -1,
+        correctLevel: QRErrorCorrectLevel.H,
+        background: "#ffffff",
+        foreground: "#000000",
+        image: { imageResource: "", dx: 0, dy: 0, dWidth: 100, dHeight: 100 },
+      },
+      t
+    )).canvasId || t.ctx
+      ? (function () {
+          var e,
+            r = new QRCode(t.typeNumber, t.correctLevel);
+          r.addData(utf16to8(t.text)),
+            r.make(),
+            (e = t.ctx
+              ? t.ctx
+              : t._this
+              ? wx.createCanvasContext &&
+                wx.createCanvasContext(t.canvasId, t._this)
+              : wx.createCanvasContext && wx.createCanvasContext(t.canvasId));
+          for (
+            var o = t.width / r.getModuleCount(),
+              n = t.height / r.getModuleCount(),
+              i = 0;
+            i < r.getModuleCount();
+            i++
+          )
+            for (var a = 0; a < r.getModuleCount(); a++) {
+              var s = r.isDark(i, a) ? t.foreground : t.background;
+              e.setFillStyle(s);
+              var u = Math.ceil((a + 1) * o) - Math.floor(a * o),
+                l = Math.ceil((i + 1) * o) - Math.floor(i * o);
+              e.fillRect(
+                Math.round(a * o) + t.x,
+                Math.round(i * n) + t.y,
+                u,
+                l
+              );
+            }
+          t.image.imageResource &&
+            e.drawImage(
+              t.image.imageResource,
+              t.image.dx,
+              t.image.dy,
+              t.image.dWidth,
+              t.image.dHeight
+            );
+          e.draw(!1, function (e) {
+            t.callback && t.callback(e);
+          });
+        })()
+      : console.warn("please set canvasId or ctx!");
+}
+(QRPolynomial.prototype = {
+  get: function (t) {
+    return this.num[t];
+  },
+  getLength: function () {
+    return this.num.length;
+  },
+  multiply: function (t) {
+    for (
+      var e = new Array(this.getLength() + t.getLength() - 1), r = 0;
+      r < this.getLength();
+      r++
+    )
+      for (var o = 0; o < t.getLength(); o++)
+        e[r + o] ^= QRMath.gexp(
+          QRMath.glog(this.get(r)) + QRMath.glog(t.get(o))
+        );
+    return new QRPolynomial(e, 0);
+  },
+  mod: function (t) {
+    if (this.getLength() - t.getLength() < 0) return this;
+    for (
+      var e = QRMath.glog(this.get(0)) - QRMath.glog(t.get(0)),
+        r = new Array(this.getLength()),
+        o = 0;
+      o < this.getLength();
+      o++
+    )
+      r[o] = this.get(o);
+    for (o = 0; o < t.getLength(); o++)
+      r[o] ^= QRMath.gexp(QRMath.glog(t.get(o)) + e);
+    return new QRPolynomial(r, 0).mod(t);
+  },
+}),
+  (QRRSBlock.RS_BLOCK_TABLE = [
+    [1, 26, 19],
+    [1, 26, 16],
+    [1, 26, 13],
+    [1, 26, 9],
+    [1, 44, 34],
+    [1, 44, 28],
+    [1, 44, 22],
+    [1, 44, 16],
+    [1, 70, 55],
+    [1, 70, 44],
+    [2, 35, 17],
+    [2, 35, 13],
+    [1, 100, 80],
+    [2, 50, 32],
+    [2, 50, 24],
+    [4, 25, 9],
+    [1, 134, 108],
+    [2, 67, 43],
+    [2, 33, 15, 2, 34, 16],
+    [2, 33, 11, 2, 34, 12],
+    [2, 86, 68],
+    [4, 43, 27],
+    [4, 43, 19],
+    [4, 43, 15],
+    [2, 98, 78],
+    [4, 49, 31],
+    [2, 32, 14, 4, 33, 15],
+    [4, 39, 13, 1, 40, 14],
+    [2, 121, 97],
+    [2, 60, 38, 2, 61, 39],
+    [4, 40, 18, 2, 41, 19],
+    [4, 40, 14, 2, 41, 15],
+    [2, 146, 116],
+    [3, 58, 36, 2, 59, 37],
+    [4, 36, 16, 4, 37, 17],
+    [4, 36, 12, 4, 37, 13],
+    [2, 86, 68, 2, 87, 69],
+    [4, 69, 43, 1, 70, 44],
+    [6, 43, 19, 2, 44, 20],
+    [6, 43, 15, 2, 44, 16],
+    [4, 101, 81],
+    [1, 80, 50, 4, 81, 51],
+    [4, 50, 22, 4, 51, 23],
+    [3, 36, 12, 8, 37, 13],
+    [2, 116, 92, 2, 117, 93],
+    [6, 58, 36, 2, 59, 37],
+    [4, 46, 20, 6, 47, 21],
+    [7, 42, 14, 4, 43, 15],
+    [4, 133, 107],
+    [8, 59, 37, 1, 60, 38],
+    [8, 44, 20, 4, 45, 21],
+    [12, 33, 11, 4, 34, 12],
+    [3, 145, 115, 1, 146, 116],
+    [4, 64, 40, 5, 65, 41],
+    [11, 36, 16, 5, 37, 17],
+    [11, 36, 12, 5, 37, 13],
+    [5, 109, 87, 1, 110, 88],
+    [5, 65, 41, 5, 66, 42],
+    [5, 54, 24, 7, 55, 25],
+    [11, 36, 12],
+    [5, 122, 98, 1, 123, 99],
+    [7, 73, 45, 3, 74, 46],
+    [15, 43, 19, 2, 44, 20],
+    [3, 45, 15, 13, 46, 16],
+    [1, 135, 107, 5, 136, 108],
+    [10, 74, 46, 1, 75, 47],
+    [1, 50, 22, 15, 51, 23],
+    [2, 42, 14, 17, 43, 15],
+    [5, 150, 120, 1, 151, 121],
+    [9, 69, 43, 4, 70, 44],
+    [17, 50, 22, 1, 51, 23],
+    [2, 42, 14, 19, 43, 15],
+    [3, 141, 113, 4, 142, 114],
+    [3, 70, 44, 11, 71, 45],
+    [17, 47, 21, 4, 48, 22],
+    [9, 39, 13, 16, 40, 14],
+    [3, 135, 107, 5, 136, 108],
+    [3, 67, 41, 13, 68, 42],
+    [15, 54, 24, 5, 55, 25],
+    [15, 43, 15, 10, 44, 16],
+    [4, 144, 116, 4, 145, 117],
+    [17, 68, 42],
+    [17, 50, 22, 6, 51, 23],
+    [19, 46, 16, 6, 47, 17],
+    [2, 139, 111, 7, 140, 112],
+    [17, 74, 46],
+    [7, 54, 24, 16, 55, 25],
+    [34, 37, 13],
+    [4, 151, 121, 5, 152, 122],
+    [4, 75, 47, 14, 76, 48],
+    [11, 54, 24, 14, 55, 25],
+    [16, 45, 15, 14, 46, 16],
+    [6, 147, 117, 4, 148, 118],
+    [6, 73, 45, 14, 74, 46],
+    [11, 54, 24, 16, 55, 25],
+    [30, 46, 16, 2, 47, 17],
+    [8, 132, 106, 4, 133, 107],
+    [8, 75, 47, 13, 76, 48],
+    [7, 54, 24, 22, 55, 25],
+    [22, 45, 15, 13, 46, 16],
+    [10, 142, 114, 2, 143, 115],
+    [19, 74, 46, 4, 75, 47],
+    [28, 50, 22, 6, 51, 23],
+    [33, 46, 16, 4, 47, 17],
+    [8, 152, 122, 4, 153, 123],
+    [22, 73, 45, 3, 74, 46],
+    [8, 53, 23, 26, 54, 24],
+    [12, 45, 15, 28, 46, 16],
+    [3, 147, 117, 10, 148, 118],
+    [3, 73, 45, 23, 74, 46],
+    [4, 54, 24, 31, 55, 25],
+    [11, 45, 15, 31, 46, 16],
+    [7, 146, 116, 7, 147, 117],
+    [21, 73, 45, 7, 74, 46],
+    [1, 53, 23, 37, 54, 24],
+    [19, 45, 15, 26, 46, 16],
+    [5, 145, 115, 10, 146, 116],
+    [19, 75, 47, 10, 76, 48],
+    [15, 54, 24, 25, 55, 25],
+    [23, 45, 15, 25, 46, 16],
+    [13, 145, 115, 3, 146, 116],
+    [2, 74, 46, 29, 75, 47],
+    [42, 54, 24, 1, 55, 25],
+    [23, 45, 15, 28, 46, 16],
+    [17, 145, 115],
+    [10, 74, 46, 23, 75, 47],
+    [10, 54, 24, 35, 55, 25],
+    [19, 45, 15, 35, 46, 16],
+    [17, 145, 115, 1, 146, 116],
+    [14, 74, 46, 21, 75, 47],
+    [29, 54, 24, 19, 55, 25],
+    [11, 45, 15, 46, 46, 16],
+    [13, 145, 115, 6, 146, 116],
+    [14, 74, 46, 23, 75, 47],
+    [44, 54, 24, 7, 55, 25],
+    [59, 46, 16, 1, 47, 17],
+    [12, 151, 121, 7, 152, 122],
+    [12, 75, 47, 26, 76, 48],
+    [39, 54, 24, 14, 55, 25],
+    [22, 45, 15, 41, 46, 16],
+    [6, 151, 121, 14, 152, 122],
+    [6, 75, 47, 34, 76, 48],
+    [46, 54, 24, 10, 55, 25],
+    [2, 45, 15, 64, 46, 16],
+    [17, 152, 122, 4, 153, 123],
+    [29, 74, 46, 14, 75, 47],
+    [49, 54, 24, 10, 55, 25],
+    [24, 45, 15, 46, 46, 16],
+    [4, 152, 122, 18, 153, 123],
+    [13, 74, 46, 32, 75, 47],
+    [48, 54, 24, 14, 55, 25],
+    [42, 45, 15, 32, 46, 16],
+    [20, 147, 117, 4, 148, 118],
+    [40, 75, 47, 7, 76, 48],
+    [43, 54, 24, 22, 55, 25],
+    [10, 45, 15, 67, 46, 16],
+    [19, 148, 118, 6, 149, 119],
+    [18, 75, 47, 31, 76, 48],
+    [34, 54, 24, 34, 55, 25],
+    [20, 45, 15, 61, 46, 16],
+  ]),
+  (QRRSBlock.getRSBlocks = function (t, e) {
+    var r = QRRSBlock.getRsBlockTable(t, e);
+    if (void 0 == r)
+      throw new Error(
+        "bad rs block @ typeNumber:" + t + "/errorCorrectLevel:" + e
+      );
+    for (var o = r.length / 3, n = new Array(), i = 0; i < o; i++)
+      for (
+        var a = r[3 * i + 0], s = r[3 * i + 1], u = r[3 * i + 2], l = 0;
+        l < a;
+        l++
+      )
+        n.push(new QRRSBlock(s, u));
+    return n;
+  }),
+  (QRRSBlock.getRsBlockTable = function (t, e) {
+    switch (e) {
+      case QRErrorCorrectLevel.L:
+        return QRRSBlock.RS_BLOCK_TABLE[4 * (t - 1) + 0];
+      case QRErrorCorrectLevel.M:
+        return QRRSBlock.RS_BLOCK_TABLE[4 * (t - 1) + 1];
+      case QRErrorCorrectLevel.Q:
+        return QRRSBlock.RS_BLOCK_TABLE[4 * (t - 1) + 2];
+      case QRErrorCorrectLevel.H:
+        return QRRSBlock.RS_BLOCK_TABLE[4 * (t - 1) + 3];
+      default:
+        return;
+    }
+  }),
+  (QRBitBuffer.prototype = {
+    get: function (t) {
+      var e = Math.floor(t / 8);
+      return 1 == ((this.buffer[e] >>> (7 - (t % 8))) & 1);
+    },
+    put: function (t, e) {
+      for (var r = 0; r < e; r++) this.putBit(1 == ((t >>> (e - r - 1)) & 1));
+    },
+    getLengthInBits: function () {
+      return this.length;
+    },
+    putBit: function (t) {
+      var e = Math.floor(this.length / 8);
+      this.buffer.length <= e && this.buffer.push(0),
+        t && (this.buffer[e] |= 128 >>> this.length % 8),
+        this.length++;
+    },
+  });
+export default drawQrcode;

+ 61 - 0
user_module/businessInfo/index.scss

@@ -0,0 +1,61 @@
+.businessInfo {
+  width: 100vw;
+  min-height: 100vh;
+  background-color: rgb(247, 247, 247);
+  box-sizing: border-box;
+  padding-top: 30rpx;
+  .info-continer {
+    .info-box {
+      width: 100%;
+      height: 94rpx;
+      padding: 0 32rpx;
+      box-sizing: border-box;
+      @include flex(space-between, null, null);
+      background-color: #ffffff;
+      .box-left {
+        font-size: 28rpx;
+        color: #333333;
+      }
+      .box-right {
+        @include flex(null, null, 10rpx);
+        text {
+          font-size: 28rpx;
+          color: #333333;
+          width: 280rpx;
+          text-align: right;
+          overflow: hidden;
+          text-overflow: ellipsis;
+          white-space: nowrap;
+        }
+        image {
+          width: 64rpx;
+          height: 64rpx;
+          display: block;
+          border-radius: 50%;
+        }
+      }
+    }
+    .top {
+      margin-top: 6rpx;
+    }
+    .top-more{
+        margin-top: 28rpx;
+    }
+  }
+  .login-state{
+    width: 100%;
+    .btn{
+        width: 100%;
+        height: 104rpx;
+        text-align: center;
+        line-height: 104rpx;
+        color: #333333;
+        font-size: 32rpx;
+        margin-top: 28rpx;
+        background-color: #FFFFFF;
+    }
+    .exit{
+        color: #DA4A4A;
+    }
+  }
+}

+ 122 - 0
user_module/businessInfo/index.vue

@@ -0,0 +1,122 @@
+<template>
+  <view class="businessInfo">
+    <view class="info-continer">
+      <view
+        class="info-box"
+        @click="navigateTo('/user_module/changeLogo/index')"
+      >
+        <view class="box-left">店铺LOGO</view>
+        <view class="box-right">
+          <image class="" :src="shopInfo.shopLogo" />
+          <view class="icon">
+            <tui-icon name="arrowright" color="#333333" :size="28"></tui-icon>
+          </view>
+        </view>
+      </view>
+      <view
+        class="info-box top"
+        v-for="(item, index) in infoData"
+        :key="index"
+        @click="goChangeInfo(item)"
+      >
+        <view class="box-left">{{ item.name }}</view>
+        <view class="box-right">
+          <text>{{ shopInfo[item.title] || "" }}</text>
+          <view class="icon">
+            <tui-icon name="arrowright" color="#333333" :size="28"></tui-icon>
+          </view>
+        </view>
+      </view>
+    </view>
+    <view class="login-state">
+      <!-- <view class="btn">切换账号</view> -->
+      <view class="btn exit" @click="exitLogin">退出登录</view>
+    </view>
+    <modal
+      :showModal="modal"
+      :promptList="promptList"
+      @closeModal="closeModal"
+      :showBtn="true"
+      showText="退出登录"
+      @btnClick="btnClick"
+    ></modal>
+  </view>
+</template>
+
+<script>
+export default {
+  onShow() {
+    //  获取本地存储的数据
+    this.shopInfo = uni.getStorageSync("shopInfo");
+    console.log(this.shopInfo);
+  },
+  data() {
+    return {
+      shopInfo: {},
+      infoData: [
+        {
+          name: "店铺名称",
+          title: "shopName",
+        },
+        // {
+        //   name:'店铺负责人',
+        //   title:'shopName'
+        // },
+        {
+          name: "手机号码",
+          title: "shopPhone",
+        },
+        {
+          name: "店铺地址",
+          title: "shopAdress",
+        },
+        {
+          name: "店铺简介",
+          title: "shopBrief",
+        },
+        {
+          name: "修改密码",
+          title: "changePassword",
+        },
+      ],
+      //  弹框
+      modal: false,
+      promptList: ['是否退出当前账号呢?'],
+    };
+  },
+  methods: {
+    goChangeInfo(item) {
+      if (item.title == "changePassword"){
+        this.$showToast("功能暂未开放")
+        return
+      };
+      //  这个方法混入在 mixin 中
+      this.navigateTo(
+        `/user_module/changeInfo/index?barTitle=${item.name}&title=${
+          item.title
+        }`
+      );
+    },
+    //  退出登录
+    exitLogin() {
+      this.modal = true;
+    },
+    //  确认退出登录
+    btnClick() {
+      //  清除本地缓存
+      uni.clearStorageSync();
+      //  跳转回登陆页面
+      uni.redirectTo({
+        url: "/pages/login/index",
+      });
+    },
+    closeModal() {
+      this.modal = false;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+@import "./index.scss";
+</style>

+ 120 - 0
user_module/changeInfo/index.vue

@@ -0,0 +1,120 @@
+<template>
+  <view class="changeInfo">
+    <view class="ipt-center">
+      <template v-if="title == 'shopBrief'">
+        <tui-textarea
+          v-model="shopInfo[title]"
+          height="240rpx"
+          min-height="40rpx"
+          :placeholder="placeholder"
+          :focus="true"
+          :adjustPosition="false"
+        ></tui-textarea>
+      </template>
+      <template v-else>
+        <tui-input
+          type="text"
+          :placeholder="placeholder"
+          v-model="shopInfo[title]"
+          :focus="true"
+        >
+          <template #right>
+            <tui-icon
+              @click="cleanVal"
+              name="close"
+              :size="18"
+              color="rgba(0, 0, 0, 0.9)"
+            ></tui-icon>
+          </template>
+        </tui-input>
+      </template>
+    </view>
+    <view class="complete">
+      <text :class="shopInfo[title] ? 'act' : ''" @click="changeInfo"
+        >完成</text
+      >
+    </view>
+    <modal :showModal="modal" :promptList="promptList" @closeModal="closeModal" :showBtn="true"></modal>
+  </view>
+</template>
+
+<script>
+import { updateShopInfo } from "@/config/index.js";
+
+export default {
+  onLoad(option) {
+    uni.setNavigationBarTitle({
+      title: option.barTitle,
+    });
+    this.placeholder = `请输入${option.barTitle}`;
+    this.title = option.title;
+    this.barTitle = option.barTitle;
+    //  获取本地存储的 shopInfo 数据
+    this.shopInfo = uni.getStorageSync("shopInfo");
+  },
+  data() {
+    return {
+      placeholder: "",
+      shopInfo: {},
+      barTitle: "",
+      title: "",
+    //   弹框
+    modal:false,
+    promptList:[]
+    };
+  },
+  methods: {
+    async changeInfo() {
+      //  判断是不是电话号码 电话号码的话就用正则判断
+      const phoneRule = /^1[3-9]\d{9}$/;
+      if (this.title == "shopPhone" && !phoneRule.test(this.shopInfo[this.title])) {
+        this.promptList = ['手机号码', '必须为1开头的11位数']
+        this.modal = true
+        return;
+      }
+      this.$loading.show("更新中");
+      try {
+        let res = await updateShopInfo(this.shopInfo);
+        if (res.code == "") {
+          this.$showToast(`${this.barTitle}修改成功`, "success");
+          //    对本地存储的数据进行更换
+          let uploadInfo = JSON.parse(res.json);
+          this.shopInfo.shopLogo = uploadInfo.shopLogo;
+          uni.setStorageSync("shopInfo", uploadInfo);
+        }
+      } finally {
+        this.$loading.hide();
+      }
+    },
+    //  关闭弹框
+    closeModal(){
+        this.modal = false
+    },
+    cleanVal() {
+      this.shopInfo[this.title] = "";
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.changeInfo {
+  width: 100vw;
+  min-height: 100vh;
+  background-color: rgb(247, 247, 247);
+  padding-top: 20rpx;
+  box-sizing: border-box;
+  .complete {
+    width: 100%;
+    padding-right: 32rpx;
+    box-sizing: border-box;
+    margin-top: 32rpx;
+    text-align: right;
+    color: #999999;
+    font-size: 28rpx;
+    .act {
+      color: #1db064;
+    }
+  }
+}
+</style>

+ 129 - 0
user_module/changeLogo/index.vue

@@ -0,0 +1,129 @@
+<template>
+  <view class="changeLogo">
+    <view class="changeLogo-center">
+      <!-- <image class="" src="https://img1.baidu.com/it/u=1845374591,668063497&fm=253&fmt=auto&app=138&f=JPEG?w=501&h=500"/> -->
+      <image class="" :src="shopInfo.shopLogo" />
+    </view>
+    <view class="changeLogo-btn">
+      <view class="btn" @click="photograph('camera')">
+        <image class="" src="@/static/image/user/logo_1.png" />
+        <text>拍照</text>
+      </view>
+      <view class="btn" @click="photograph('album')">
+        <image class="" src="@/static/image/user/logo_2.png" />
+        <text>打开相册</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+import { updateShopInfo } from "@/config/index.js";
+export default {
+  created() {
+    //  获取本地存储的数据
+    this.shopInfo = uni.getStorageSync("shopInfo");
+    console.log(this.shopInfo);
+  },
+  data() {
+    return {
+      shopInfo: {},
+    };
+  },
+  methods: {
+    photograph(str) {
+      uni.chooseImage({
+        count: 6, //默认9
+        sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
+        sourceType: [str], //从相册选择
+        success: (res) => {
+          this.getImage(res.tempFilePaths[0]);
+        },
+      });
+    },
+    //  图片上传接口
+    async getImage(file) {
+      //  加载状态
+      this.$loading.show("更新中");
+      uni.uploadFile({
+        url: "https://nsbusinessapi.tuanfengkeji.cn/file/upload", //仅为示例,非真实的接口地址
+        filePath: file,
+        header: {
+          "Content-Type": "application/json; charset=UTF-8",
+          "Authorization-Business": uni.getStorageSync("storage_key"),
+        },
+        name: "file",
+        formData: {
+          user: "test",
+        },
+        success: (uploadFileRes) => {
+          this.save(JSON.parse(uploadFileRes.data).data.url);
+        },
+      });
+    },
+
+    //  保存更新
+    async save(logo) {
+      let obj = { ...this.shopInfo };
+      obj.shopLogo = logo;
+      try {
+        let res = await updateShopInfo(obj);
+        if (res.code == "") {
+          this.$showToast("店铺LOGO修改成功", "success");
+          //    对本地存储的数据进行更换
+          let uploadInfo = JSON.parse(res.json);
+          this.shopInfo.shopLogo = uploadInfo.shopLogo;
+          uni.setStorageSync("shopInfo", uploadInfo);
+        }
+      } finally {
+        this.$loading.hide();
+      }
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.changeLogo {
+  width: 100vw;
+  min-height: 100vh;
+  background-color: #000;
+  position: relative;
+  .changeLogo-center {
+    width: 100%;
+    position: absolute;
+    top: 262rpx;
+    left: 0;
+    image {
+      width: 100%;
+      height: 750rpx;
+      display: block;
+    }
+  }
+  .changeLogo-btn {
+    width: 100%;
+    position: absolute;
+    bottom: 108rpx;
+    left: 0;
+    padding: 0 75rpx;
+    box-sizing: border-box;
+    @include flex(space-between);
+    .btn {
+      width: 276rpx;
+      height: 108rpx;
+      background-color: rgba(255, 255, 255, 0.4);
+      @include flex(center, null, 27rpx);
+      border-radius: 24rpx;
+      image {
+        width: 42rpx;
+        height: 32rpx;
+        display: block;
+      }
+      text {
+        font-size: 32rpx;
+        color: #e6e4e5;
+      }
+    }
+  }
+}
+</style>

+ 216 - 0
user_module/codeDetail/index.vue

@@ -0,0 +1,216 @@
+<template>
+  <view
+    class="codeDetail"
+    :style="{
+      background: colorList[idx].bgColor,
+      boxShadow: colorList[idx].shadow,
+    }"
+  >
+    <capsule :showBorder="true" bgColor="transparent">
+      <template v-slot:top>
+        <view class="shop-top">
+          <view class="back-icon" @click="backClick">
+            <tui-icon name="arrowleft" :size="36" color="#FFFFFF"></tui-icon>
+          </view>
+          <view class="shop-name">{{ title }}</view>
+        </view>
+      </template>
+    </capsule>
+    <view class="code-container">
+      <view class="top-img">
+        <image class="" :src="shopInfo.shopLogo" />
+      </view>
+      <view class="code-img">
+        <image class="" :src="payCode" :show-menu-by-longpress="true" />
+        <canvas canvas-id="code" id="code"></canvas>
+        <!-- <template v-if="idx == 1">
+         
+        </template>
+        <template v-else>
+          
+        </template> -->
+      </view>
+      <view class="code-text">长按保存二维码</view>
+    </view>
+  </view>
+</template>
+
+<script>
+import drawQrcode from "@/static/js/qrcode.js";
+export default {
+  created() {
+    //  获取本地info
+    this.shopInfo = uni.getStorageSync("shopInfo");
+  },
+  onLoad(option) {
+    this.idx = Number(option.type);
+    switch (this.idx) {
+      case 0:
+        this.title = "商家店铺码";
+        this.setCode(uni.getStorageSync("code"), "code");
+        break;
+      case 1:
+        this.title = "商家收款码";
+        this.payCode = uni.getStorageSync("code");
+        break;
+      case 2:
+        this.title = "兑换专区码";
+        this.setCode(uni.getStorageSync("code"), "code");
+        break;
+    }
+  },
+  data() {
+    return {
+      idx: 0,
+      title: "",
+      shopInfo: {},
+      colorList: [
+        {
+          bgColor: "linear-gradient(90deg, #24c4ef 0%, #46a8f7 100%)",
+          shadow: "0px 0px 10px 0px rgba(68, 169, 246, 0.5)",
+        },
+        {
+          bgColor: "linear-gradient(90deg, #FC8756 0%, #FE5427 100%)",
+          shadow: "0px 0px 10px 0px rgba(68, 169, 246, 0.5)",
+        },
+        {
+          bgColor: "linear-gradient(90deg, #7ADBCF 0%, #47CAA4 100%)",
+          shadow: "0px 0px 10px 0px rgba(68, 169, 246, 0.5)",
+        },
+      ],
+      payCode: "",
+    };
+  },
+  methods: {
+    // 生成二维码
+    async setCode(url, id) {
+      this.$loading.show("生成中...");
+      await drawQrcode({
+        width: 202,
+        height: 202,
+        canvasId: id,
+        text: url,
+        callback: (e) => {
+          uni.canvasToTempFilePath({
+            canvasId: "code",
+            success: (res) => {
+              console.log("成功", res);
+              this.getImage(res.tempFilePath);
+            },
+            fail: (res) => {
+              console.log("失败", res);
+            },
+          });
+        },
+      });
+    },
+    //  图片上传接口
+    async getImage(file) {
+      //  加载状态
+      uni.uploadFile({
+        url: "https://nsbusinessapi.tuanfengkeji.cn/file/upload", //仅为示例,非真实的接口地址
+        filePath: file,
+        header: {
+          "Content-Type": "application/json; charset=UTF-8",
+          "Authorization-Business": uni.getStorageSync("storage_key"),
+        },
+        name: "file",
+        formData: {
+          user: "code",
+        },
+        success: (uploadFileRes) => {
+          this.payCode = JSON.parse(uploadFileRes.data).data.url;
+          this.$loading.hide();
+        },
+      });
+    },
+    backClick() {
+      uni.navigateBack();
+    },
+  },
+  //    页面卸载清除缓存
+  onUnload() {
+    uni.removeStorageSync("code");
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.codeDetail {
+  width: 100vw;
+  height: 100vh;
+  position: relative;
+  .shop-top {
+    width: 100%;
+    height: 100%;
+    position: relative;
+    z-index: 999;
+    @include flex(center);
+
+    .back-icon {
+      position: absolute;
+      left: 0;
+      top: 50%;
+      transform: translateY(-50%);
+    }
+
+    .shop-name {
+      color: #ffffff;
+    }
+  }
+  .code-container {
+    margin: 0 auto;
+    margin-top: 186rpx;
+    border-radius: 32rpx;
+    width: 606rpx;
+    height: 724rpx;
+    background-color: #ffffff;
+    position: relative;
+    .top-img {
+      width: 144rpx;
+      height: 144rpx;
+      position: absolute;
+      left: 50%;
+      transform: translateX(-50%);
+      top: -72rpx;
+      image {
+        width: 100%;
+        height: 100%;
+        border-radius: 50%;
+        border: 10rpx solid #ffffff;
+      }
+    }
+    .code-img {
+      width: 404rpx;
+      height: 404rpx;
+      position: absolute;
+      top: 128rpx;
+      left: 52%;
+      transform: translateX(-50%);
+      image {
+        width: 100%;
+        height: 100%;
+        display: block;
+        position: relative;
+        z-index: 1;
+      }
+      canvas {
+        width: 100%;
+        height: 100%;
+        z-index: -2;
+        position: fixed;
+        top: 1000rpx;
+        left: 1000rpx;
+      }
+    }
+    .code-text {
+      color: #666666;
+      font-size: 28rpx;
+      position: absolute;
+      bottom: 32rpx;
+      left: 50%;
+      transform: translateX(-50%);
+    }
+  }
+}
+</style>

+ 168 - 0
user_module/merchantCode/index.vue

@@ -0,0 +1,168 @@
+<template>
+  <view class="merchantCode">
+    <view class="code-list">
+      <view class="code-item" @click="goCodeDetail(0)">
+        <view class="code-illustrate">
+          <image class="" :src="shopInfo.shopLogo" />
+          <text>商家店铺码</text>
+        </view>
+        <view class="code-img">
+          <canvas canvas-id="shopCode"></canvas>
+        </view>
+      </view>
+      <view class="code-item" @click="goCodeDetail(1)">
+        <view class="code-illustrate">
+          <image class="" :src="shopInfo.shopLogo" />
+          <text>商家收款码</text>
+        </view>
+        <view class="code-img">
+          <image class="" :src="payCode" />
+        </view>
+      </view>
+      <view class="code-item" @click="goCodeDetail(2)">
+        <view class="code-illustrate">
+          <image class="" :src="shopInfo.shopLogo" />
+          <text>兑换专区码</text>
+        </view>
+        <view class="code-img">
+          <canvas canvas-id="exchangeCode"></canvas>
+        </view>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+// 将 dist 目录下,weapp.qrcode.esm.js 复制到项目目录中
+import drawQrcode from "@/static/js/qrcode.js";
+import { getShopQrcode } from "@/config/index.js";
+export default {
+  created() {
+    this.getCode();
+  },
+  beforeMount() {
+    //  获取本地存储的数据
+    this.shopInfo = uni.getStorageSync("shopInfo");
+    const { shopId, shopName } = this.shopInfo;
+    //  生成店铺码
+    this.setCode(
+      `https://www.tuanfengkeji.cn/TFShop_Uni_H5/#/another-tf/another-user/shop/shop-detail?shopId=${shopId}`,
+      "shopCode"
+    );
+    //  生成兑换码
+    this.setCode(
+      `https://test.tuanfengkeji.cn/TFShop_Uni_H5/#/another-tf/another-user/exchange/index?shopId=${shopId}&shopName=${shopName}`,
+      "exchangeCode"
+    );
+  },
+  data() {
+    return {
+      shopInfo: {},
+      payCode: "",
+    };
+  },
+  methods: {
+    async getCode() {
+      //  获取收款二维码
+      let res = await getShopQrcode({ codeType: 1, state: 1 });
+      this.payCode = res.data.shopCode;
+    },
+    // 生成二维码
+    setCode(url, id) {
+      drawQrcode({
+        width: 100,
+        height: 100,
+        canvasId: id,
+        // ctx: wx.createCanvasContext('myQrcode'),
+        text: url,
+      });
+    },
+    goCodeDetail(type){
+        switch(type){
+            case 0:
+            uni.setStorageSync('code',`https://www.tuanfengkeji.cn/TFShop_Uni_H5/#/another-tf/another-user/shop/shop-detail?shopId=${this.shopInfo.shopId}`)
+            break;
+            case 1:
+            uni.setStorageSync('code',this.payCode)
+            break;
+            case 2:
+            uni.setStorageSync('code',`https://test.tuanfengkeji.cn/TFShop_Uni_H5/#/another-tf/another-user/exchange/index?shopId=${this.shopInfo.shopId}&shopName=${this.shopInfo.shopName}`)
+            break;
+        }
+        //  mixin 中的跳转
+        this.navigateTo(`/user_module/codeDetail/index?type=${type}`);
+    }
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.merchantCode {
+  width: 100vw;
+  min-height: 100vh;
+  background-color: rgb(247, 247, 247);
+  padding-top: 10rpx;
+  box-sizing: border-box;
+  .code-list {
+    width: 100%;
+    padding: 0 32rpx;
+    box-sizing: border-box;
+    .code-item {
+      width: 100%;
+      margin-top: 32rpx;
+      border-radius: 16rpx;
+      height: 250rpx;
+      position: relative;
+      .code-illustrate {
+        position: absolute;
+        top: 28rpx;
+        left: 28rpx;
+        @include flex(center, null, 22rpx);
+        image {
+          width: 72rpx;
+          height: 72rpx;
+          border-radius: 50%;
+          border: 4rpx solid #ffffff;
+        }
+        text {
+          color: #ffffff;
+          font-size: 28rpx;
+          font-weight: 700;
+        }
+      }
+      .code-img {
+        position: absolute;
+        top: 50%;
+        transform: translateY(-50%);
+        right: 58rpx;
+        /* border: 6rpx solid rgba(255, 255, 255, 0.3); */
+        image {
+          width: 200rpx;
+          height: 200rpx;
+        }
+        canvas {
+          width: 200rpx;
+          height: 200rpx;
+        }
+      }
+      &:nth-of-type(2) {
+        .code-img {
+          border: 0;
+        }
+      }
+      &:nth-of-type(1) {
+        background: linear-gradient(91deg, #24c4ef 0%, #46a8f7 99%);
+        box-shadow: 0px 0px 10px 0px rgba(68, 169, 246, 0.5);
+      }
+      &:nth-of-type(2) {
+        background: linear-gradient(91deg, #fc8857 0%, #fe5225 99%);
+        box-shadow: 0px 0px 10px 0px rgba(254, 83, 38, 0.5);
+      }
+      &:nth-of-type(3) {
+        background: linear-gradient(91deg, #7adbcf 0%, #46c9a3 99%);
+        box-shadow: 0px 0px 10px 0px rgba(71, 201, 164, 0.5);
+      }
+    }
+  }
+}
+</style>

+ 28 - 20
utils/request.js

@@ -1,13 +1,13 @@
 //  配置请求根路径
 const BASE_URL = process.env.UNI_BASE_URL;
-import { showToast } from '@/utils/index'
+import { showToast } from "@/utils/index";
 
 const request = (requesUrl, data, method = "GET") => {
   let url = `${BASE_URL}${requesUrl}`;
   return new Promise((resolve, reject) => {
     let header = {
       "Content-Type": "application/json; charset=UTF-8",
-      "Authorization-Business":uni.getStorageSync("storage_key")
+      "Authorization-Business": uni.getStorageSync("storage_key"),
     };
     uni.request({
       url: url,
@@ -15,26 +15,34 @@ const request = (requesUrl, data, method = "GET") => {
       method: method,
       header: header,
       success: (res) => {
-        if (res.statusCode == 200) {
-          if (res.data.code === "200" || res.data.code === "") {
-            resolve(res.data);
-          } else if (res.data.code === "20004" || res.data.code === "20005") {
-            uni.removeStorageSync("storage_key");
-            uni.navigateTo({
-              url: "/pages/login/index",
-            });
-          } else {
-            uni.showToast({
-              title: res.data.message,
-              icon: "none",
-            });
+        const { data } = res;
+        console.log(res);
+        if (data.code !== "") {
+          //  判断是不是 token 过期了
+          const tokenerr = [20003, "20003", 20004, "20004", 20005, "20005"];
+          if (tokenerr.includes(data.code)) {
+            //  清除本地缓存所有的数据
+            uni.clearStorageSync();
+            setTimeout(() => {
+              console.log("这里进来了");
+              //  跳转回登陆页面
+              uni.redirectTo({
+                url: "/pages/login/index"
+              });
+            }, 1000);
+
+            showToast("登陆超时,请重新登陆", "none", 1000);
+            return;
           }
-        } else {
-          reject(res);
+          // showToast(data.message || "系统突然出差了,请稍后再试","none",2000)
+          return resolve(data);
         }
+        return resolve(data);
       },
+
       fail: (res) => {
         reject(res);
+        showToast("系统突然出差了,请稍后再试", "none", 2000);
       },
     });
   });
@@ -62,11 +70,11 @@ const request1 = (requesUrl, data, method = "GET") => {
             setTimeout(() => {
               //  跳转回登陆页面
               uni.redirectTo({
-                url: "pages/login/index",
+                url: "/pages/login/index",
               });
             }, 1000);
 
-            showToast("登陆超时,请重新登陆","none",1000)
+            showToast("登陆超时,请重新登陆", "none", 1000);
             return;
           }
           // showToast(data.message || "系统突然出差了,请稍后再试","none",2000)
@@ -77,7 +85,7 @@ const request1 = (requesUrl, data, method = "GET") => {
 
       fail: (res) => {
         reject(res);
-        showToast("系统突然出差了,请稍后再试","none",2000)
+        showToast("系统突然出差了,请稍后再试", "none", 2000);
       },
     });
   });