版本提交
Showing
17 changed files
with
326 additions
and
52 deletions
| ... | @@ -17,7 +17,8 @@ App({ | ... | @@ -17,7 +17,8 @@ App({ |
| 17 | config: config, | 17 | config: config, |
| 18 | router: router, | 18 | router: router, |
| 19 | store: store, | 19 | store: store, |
| 20 | onLaunch: function () { | 20 | onLaunch(options) { |
| 21 | console.log("options:", options); | ||
| 21 | this.share() | 22 | this.share() |
| 22 | }, | 23 | }, |
| 23 | globalData: { | 24 | globalData: { |
| ... | @@ -45,7 +46,7 @@ App({ | ... | @@ -45,7 +46,7 @@ App({ |
| 45 | view.onShareAppMessage = function (res) { | 46 | view.onShareAppMessage = function (res) { |
| 46 | //分享配置 | 47 | //分享配置 |
| 47 | return { | 48 | return { |
| 48 | title: '志亮·深士照明', | 49 | title: '深士照明', |
| 49 | path: 'pages/index/index' | 50 | path: 'pages/index/index' |
| 50 | }; | 51 | }; |
| 51 | }; | 52 | }; | ... | ... |
| 1 | { | 1 | { |
| 2 | "pages": [ | 2 | "pages": [ |
| 3 | "pages/index/index", | 3 | "pages/index/index", |
| 4 | "pages/scan-result/scan-result", | ||
| 4 | "pages/user-center/user-center", | 5 | "pages/user-center/user-center", |
| 5 | "pages/gift-shop/gift-shop", | 6 | "pages/gift-shop/gift-shop", |
| 6 | "pages/gift-detail/gift-detail", | 7 | "pages/gift-detail/gift-detail", |
| 7 | "pages/scan-result/scan-result", | ||
| 8 | "pages/contact/contact", | 8 | "pages/contact/contact", |
| 9 | "pages/contact-table/contact-table", | 9 | "pages/contact-table/contact-table", |
| 10 | "pages/authorize/authorize", | 10 | "pages/authorize/authorize", | ... | ... |
| ... | @@ -4,6 +4,7 @@ module.exports = { | ... | @@ -4,6 +4,7 @@ module.exports = { |
| 4 | product: '/product', // post 首页商品概览 | 4 | product: '/product', // post 首页商品概览 |
| 5 | bannerList: '/banner/list', // post 轮播图列表 | 5 | bannerList: '/banner/list', // post 轮播图列表 |
| 6 | pointsOverview: '/points/overview', // post 查看积分概览 | 6 | pointsOverview: '/points/overview', // post 查看积分概览 |
| 7 | points: '/points', // post 类型积分值 | ||
| 7 | commodityList: '/commodity/list', // post 积分商城浏览 商品列表 | 8 | commodityList: '/commodity/list', // post 积分商城浏览 商品列表 |
| 8 | commodityVeridcation: '/commodity/veridcation', // post 兑换礼物 红包和实物兑换礼物接口 , 实物会返回地址信息,红包校验通过会直接兑换 | 9 | commodityVeridcation: '/commodity/veridcation', // post 兑换礼物 红包和实物兑换礼物接口 , 实物会返回地址信息,红包校验通过会直接兑换 |
| 9 | commodityExchange: '/commodity/exchange', // post 兑换礼物2 实物兑换,需要带上地址的唯一标识uuid | 10 | commodityExchange: '/commodity/exchange', // post 兑换礼物2 实物兑换,需要带上地址的唯一标识uuid | ... | ... |
| ... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
| 6 | <view class="top-space"></view> | 6 | <view class="top-space"></view> |
| 7 | <view class="login"> | 7 | <view class="login"> |
| 8 | <image class="login-logo" src="../../image/logo.png" mode="aspectFit" /> | 8 | <image class="login-logo" src="../../image/logo.png" mode="aspectFit" /> |
| 9 | <view class="login-name">志亮·深士照明</view> | 9 | <view class="login-name">深士照明</view> |
| 10 | <view class="login-line"></view> | 10 | <view class="login-line"></view> |
| 11 | <view class="login-title">完整体验小程序功能,需要您的微信授权</view> | 11 | <view class="login-title">完整体验小程序功能,需要您的微信授权</view> |
| 12 | <view class="login-tips">· 获取您的公开信息(昵称、头像等)</view> | 12 | <view class="login-tips">· 获取您的公开信息(昵称、头像等)</view> | ... | ... |
| ... | @@ -12,7 +12,10 @@ Page({ | ... | @@ -12,7 +12,10 @@ Page({ |
| 12 | page: 1, | 12 | page: 1, |
| 13 | size: 10, | 13 | size: 10, |
| 14 | productList: [], // 产品列表 | 14 | productList: [], // 产品列表 |
| 15 | curProductDetail: {} // 选中的产品详情 | 15 | curProductDetail: {}, // 选中的产品详情 |
| 16 | qrCodeCode: "", | ||
| 17 | userInfo: {}, //用户信息 | ||
| 18 | code: "", // 手输入码 | ||
| 16 | }, | 19 | }, |
| 17 | onShareAppMessage() {}, | 20 | onShareAppMessage() {}, |
| 18 | showAuth() { | 21 | showAuth() { |
| ... | @@ -21,9 +24,33 @@ Page({ | ... | @@ -21,9 +24,33 @@ Page({ |
| 21 | }) | 24 | }) |
| 22 | }, | 25 | }, |
| 23 | onLoad(options) { | 26 | onLoad(options) { |
| 27 | |||
| 24 | this.queryProduct(); | 28 | this.queryProduct(); |
| 25 | this.queryBanner(); | 29 | this.queryBanner(); |
| 30 | |||
| 31 | let scene = decodeURIComponent(options.scene) || ""; | ||
| 32 | // scene = "ab4cbd54dcf04d29a6c23d00a900b332" | ||
| 33 | if (scene) { | ||
| 34 | this.setData({ | ||
| 35 | scene | ||
| 36 | }) | ||
| 37 | } | ||
| 38 | this.initData(); | ||
| 39 | }, | ||
| 40 | |||
| 41 | initData() { | ||
| 42 | let { | ||
| 43 | scene | ||
| 44 | } = this.data; | ||
| 45 | if (scene) { | ||
| 46 | // 可能要拉授权 | ||
| 47 | this.queryMember().then((result) => { | ||
| 48 | this.queryScanPersonQrcode().then((result) => {}).catch((err) => {}); | ||
| 49 | }); | ||
| 50 | } | ||
| 26 | }, | 51 | }, |
| 52 | |||
| 53 | |||
| 27 | // 到达底部 | 54 | // 到达底部 |
| 28 | onReachBottom() { | 55 | onReachBottom() { |
| 29 | if (this.data.productList.length < this.data.total) { | 56 | if (this.data.productList.length < this.data.total) { |
| ... | @@ -82,6 +109,47 @@ Page({ | ... | @@ -82,6 +109,47 @@ Page({ |
| 82 | }, | 109 | }, |
| 83 | 110 | ||
| 84 | /** | 111 | /** |
| 112 | * 获取会员信息 | ||
| 113 | */ | ||
| 114 | queryMember() { | ||
| 115 | return new Promise((resolve, reject) => { | ||
| 116 | app.post({ | ||
| 117 | url: app.api.member, | ||
| 118 | data: {} | ||
| 119 | }).then((result) => { | ||
| 120 | this.setData({ | ||
| 121 | userInfo: result | ||
| 122 | }) | ||
| 123 | resolve(); | ||
| 124 | }) | ||
| 125 | }); | ||
| 126 | }, | ||
| 127 | |||
| 128 | /** | ||
| 129 | * 扫个人码 | ||
| 130 | */ | ||
| 131 | queryScanPersonQrcode() { | ||
| 132 | return new Promise((resolve, reject) => { | ||
| 133 | let { | ||
| 134 | scene | ||
| 135 | } = this.data; | ||
| 136 | if (scene) { | ||
| 137 | app.post({ | ||
| 138 | toast: false, | ||
| 139 | url: app.api.scanPersonQrcode, | ||
| 140 | data: { | ||
| 141 | memberCode: scene | ||
| 142 | } | ||
| 143 | }).then((result) => { | ||
| 144 | this.setData({ | ||
| 145 | prizeInfo: result | ||
| 146 | }) | ||
| 147 | }) | ||
| 148 | } | ||
| 149 | }); | ||
| 150 | }, | ||
| 151 | |||
| 152 | /** | ||
| 85 | * 点击详情 | 153 | * 点击详情 |
| 86 | */ | 154 | */ |
| 87 | onProductItemHandler(evt) { | 155 | onProductItemHandler(evt) { |
| ... | @@ -104,10 +172,6 @@ Page({ | ... | @@ -104,10 +172,6 @@ Page({ |
| 104 | qrCodeCode, | 172 | qrCodeCode, |
| 105 | memberCode | 173 | memberCode |
| 106 | } = result; | 174 | } = result; |
| 107 | // wx.showToast({ | ||
| 108 | // title: "res:" + res.result, | ||
| 109 | // icon: "none" | ||
| 110 | // }) | ||
| 111 | }, | 175 | }, |
| 112 | fail(err) { | 176 | fail(err) { |
| 113 | console.log("err:", err); | 177 | console.log("err:", err); |
| ... | @@ -115,12 +179,32 @@ Page({ | ... | @@ -115,12 +179,32 @@ Page({ |
| 115 | }) | 179 | }) |
| 116 | }, | 180 | }, |
| 117 | 181 | ||
| 118 | // | 182 | /** |
| 183 | * 点击搜索 | ||
| 184 | */ | ||
| 185 | onSearchHandler() { | ||
| 186 | app.router.push({ | ||
| 187 | path: "scanResult", | ||
| 188 | query: { | ||
| 189 | code: this.data.code | ||
| 190 | } | ||
| 191 | }) | ||
| 192 | }, | ||
| 119 | 193 | ||
| 194 | /** | ||
| 195 | * 绑定手输code | ||
| 196 | * @param {*} e | ||
| 197 | */ | ||
| 198 | bindCodeInput(e) { | ||
| 199 | this.setData({ | ||
| 200 | code: e.detail.value | ||
| 201 | }) | ||
| 202 | }, | ||
| 120 | 203 | ||
| 121 | hideMask() { | 204 | hideMask() { |
| 122 | this.setData({ | 205 | this.setData({ |
| 123 | productDetailVisible: false | 206 | productDetailVisible: false, |
| 207 | authorizeVisible: false, | ||
| 124 | }) | 208 | }) |
| 125 | }, | 209 | }, |
| 126 | // 子组件事件 | 210 | // 子组件事件 |
| ... | @@ -135,6 +219,12 @@ Page({ | ... | @@ -135,6 +219,12 @@ Page({ |
| 135 | this.hideMask(); | 219 | this.hideMask(); |
| 136 | break; | 220 | break; |
| 137 | 221 | ||
| 222 | // 授权完毕 | ||
| 223 | case "_evt_auth_complete": | ||
| 224 | this.initData(); | ||
| 225 | this.hideMask(); | ||
| 226 | break; | ||
| 227 | |||
| 138 | default: | 228 | default: |
| 139 | break; | 229 | break; |
| 140 | } | 230 | } | ... | ... |
| 1 | { | 1 | { |
| 2 | "navigationBarTitleText": "志亮照明", | 2 | "navigationBarTitleText": "深士照明", |
| 3 | "usingComponents": { | 3 | "usingComponents": { |
| 4 | "product-detail-comp": "../../component/product-detail-comp/product-detail-comp", | 4 | "product-detail-comp": "../../component/product-detail-comp/product-detail-comp", |
| 5 | "van-popup": "../../ui/vant-weapp/popup/index" | 5 | "van-popup": "../../ui/vant-weapp/popup/index" | ... | ... |
| ... | @@ -8,15 +8,16 @@ | ... | @@ -8,15 +8,16 @@ |
| 8 | <view class="space1"></view> | 8 | <view class="space1"></view> |
| 9 | <view class="search"> | 9 | <view class="search"> |
| 10 | <view class="search-ipt-wrap"> | 10 | <view class="search-ipt-wrap"> |
| 11 | <input class="ipt" placeholder="请输入串码" /> | 11 | <input value="{{code}}" bindinput="bindCodeInput" class="ipt" placeholder="请输入串码" /> |
| 12 | </view> | 12 | </view> |
| 13 | <view class="search-scan"> | 13 | <view bindtap="onSearchHandler" class="search-scan"> |
| 14 | <image class="icon" mode="aspectFit" src="../../image/icon/icon-search.png" /> | 14 | <image class="icon" mode="aspectFit" src="../../image/icon/icon-search.png" /> |
| 15 | </view> | 15 | </view> |
| 16 | <view class="search-line"></view> | 16 | <!-- 隐藏扫描二维码 --> |
| 17 | <!-- <view class="search-line"></view> | ||
| 17 | <view bindtap="onScanHandler" class="search-scan"> | 18 | <view bindtap="onScanHandler" class="search-scan"> |
| 18 | <image class="icon" mode="aspectFit" src="../../image/icon/icon-scan.png" /> | 19 | <image class="icon" mode="aspectFit" src="../../image/icon/icon-scan.png" /> |
| 19 | </view> | 20 | </view> --> |
| 20 | </view> | 21 | </view> |
| 21 | </view> | 22 | </view> |
| 22 | <view class="top-space"></view> | 23 | <view class="top-space"></view> | ... | ... |
| 1 | import { | 1 | import { |
| 2 | getBindtapData | 2 | getBindtapData, |
| 3 | getObjByListKeyValue | ||
| 3 | } from '../../utils/util'; | 4 | } from '../../utils/util'; |
| 4 | let Date = require('../../utils/date.js'); | 5 | let Date = require('../../utils/date.js'); |
| 5 | 6 | ||
| ... | @@ -21,31 +22,43 @@ Page({ | ... | @@ -21,31 +22,43 @@ Page({ |
| 21 | t1: "全部", | 22 | t1: "全部", |
| 22 | t2: "", | 23 | t2: "", |
| 23 | index: "0", | 24 | index: "0", |
| 25 | pointsType: "", | ||
| 26 | type: "", | ||
| 24 | }, | 27 | }, |
| 25 | { | 28 | { |
| 26 | t1: "300", | 29 | t1: "", |
| 27 | t2: "购买积分", | 30 | t2: "购买积分", |
| 28 | index: "1", | 31 | index: "1", |
| 32 | pointsType: "buy", | ||
| 33 | type: "buyNum", | ||
| 29 | }, | 34 | }, |
| 30 | { | 35 | { |
| 31 | t1: "200", | 36 | t1: "", |
| 32 | t2: "推广积分", | 37 | t2: "推广积分", |
| 33 | index: "2", | 38 | index: "2", |
| 39 | pointsType: "promotion", | ||
| 40 | type: "promotionNum", | ||
| 34 | }, | 41 | }, |
| 35 | { | 42 | { |
| 36 | t1: "50", | 43 | t1: "", |
| 37 | t2: "签到积分", | 44 | t2: "签到积分", |
| 38 | index: "3", | 45 | index: "3", |
| 46 | pointsType: "sign", | ||
| 47 | type: "signNum", | ||
| 39 | }, | 48 | }, |
| 40 | { | 49 | { |
| 41 | t1: "300", | 50 | t1: "", |
| 42 | t2: "奖励积分", | 51 | t2: "奖励积分", |
| 43 | index: "4", | 52 | index: "4", |
| 53 | pointsType: "award", | ||
| 54 | type: "awardNum", | ||
| 44 | }, | 55 | }, |
| 45 | { | 56 | { |
| 46 | t1: "300", | 57 | t1: "", |
| 47 | t2: "兑换积分", | 58 | t2: "兑换积分", |
| 48 | index: "5", | 59 | index: "5", |
| 60 | pointsType: "exchange", | ||
| 61 | type: "exchangeNum", | ||
| 49 | }, | 62 | }, |
| 50 | ], | 63 | ], |
| 51 | }, | 64 | }, |
| ... | @@ -64,7 +77,10 @@ Page({ | ... | @@ -64,7 +77,10 @@ Page({ |
| 64 | dateEnd, | 77 | dateEnd, |
| 65 | dateStr | 78 | dateStr |
| 66 | }) | 79 | }) |
| 67 | this.refreshStatus(); | 80 | this.queryPoints().then((result) => { |
| 81 | this.refreshStatus(); | ||
| 82 | }); | ||
| 83 | |||
| 68 | this.initData(); | 84 | this.initData(); |
| 69 | }, | 85 | }, |
| 70 | 86 | ||
| ... | @@ -78,7 +94,7 @@ Page({ | ... | @@ -78,7 +94,7 @@ Page({ |
| 78 | this.setData({ | 94 | this.setData({ |
| 79 | page: this.data.page + 1 | 95 | page: this.data.page + 1 |
| 80 | }); | 96 | }); |
| 81 | this.queryOrder(); | 97 | this.queryPointsOverview(); |
| 82 | } | 98 | } |
| 83 | }, | 99 | }, |
| 84 | 100 | ||
| ... | @@ -108,6 +124,34 @@ Page({ | ... | @@ -108,6 +124,34 @@ Page({ |
| 108 | }, | 124 | }, |
| 109 | 125 | ||
| 110 | /** | 126 | /** |
| 127 | * 积分值类型 | ||
| 128 | */ | ||
| 129 | queryPoints() { | ||
| 130 | return new Promise((resolve, reject) => { | ||
| 131 | app.post({ | ||
| 132 | url: app.api.points, | ||
| 133 | data: {} | ||
| 134 | }).then((result) => { | ||
| 135 | console.log("queryPoints result:", result); | ||
| 136 | |||
| 137 | let navList = this.data.navList; | ||
| 138 | navList.forEach((element, index) => { | ||
| 139 | if (index == 0) { | ||
| 140 | element.t1 = "全部" | ||
| 141 | } else { | ||
| 142 | element.t1 = result[element.type] + "" | ||
| 143 | } | ||
| 144 | }); | ||
| 145 | this.setData({ | ||
| 146 | navList: navList | ||
| 147 | }) | ||
| 148 | |||
| 149 | resolve(); | ||
| 150 | }) | ||
| 151 | }); | ||
| 152 | }, | ||
| 153 | |||
| 154 | /** | ||
| 111 | * 积分概览 | 155 | * 积分概览 |
| 112 | */ | 156 | */ |
| 113 | queryPointsOverview() { | 157 | queryPointsOverview() { |
| ... | @@ -124,11 +168,12 @@ Page({ | ... | @@ -124,11 +168,12 @@ Page({ |
| 124 | month: month, | 168 | month: month, |
| 125 | } | 169 | } |
| 126 | }).then((result) => { | 170 | }).then((result) => { |
| 127 | console.log("result:", result); | 171 | let navList = this.data.navList; |
| 128 | let dataList = result.list; | 172 | let dataList = result.list; |
| 129 | dataList = this.data.dataList.concat(dataList); | 173 | dataList = this.data.dataList.concat(dataList); |
| 130 | dataList.forEach(element => { | 174 | dataList.forEach(element => { |
| 131 | element.time = new Date(element.createTime).toString("yyyy.MM.dd") | 175 | element.time = new Date(element.createTime).toString("yyyy.MM.dd"); |
| 176 | element.words = getObjByListKeyValue(element.pointsType, "pointsType", navList).t2; | ||
| 132 | }); | 177 | }); |
| 133 | this.setData({ | 178 | this.setData({ |
| 134 | dataList: dataList, | 179 | dataList: dataList, | ... | ... |
| ... | @@ -36,7 +36,7 @@ $contentWidth:690px; | ... | @@ -36,7 +36,7 @@ $contentWidth:690px; |
| 36 | color: #333333; | 36 | color: #333333; |
| 37 | 37 | ||
| 38 | .t1 { | 38 | .t1 { |
| 39 | font-size: 72px; | 39 | font-size: 64px; |
| 40 | color: #3680EB; | 40 | color: #3680EB; |
| 41 | } | 41 | } |
| 42 | } | 42 | } |
| ... | @@ -56,7 +56,7 @@ $contentWidth:690px; | ... | @@ -56,7 +56,7 @@ $contentWidth:690px; |
| 56 | margin: 8px; | 56 | margin: 8px; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | .d1{ | 59 | .d1 { |
| 60 | margin-left: 8px; | 60 | margin-left: 8px; |
| 61 | } | 61 | } |
| 62 | } | 62 | } |
| ... | @@ -139,11 +139,15 @@ $contentWidth:690px; | ... | @@ -139,11 +139,15 @@ $contentWidth:690px; |
| 139 | 139 | ||
| 140 | .t1 { | 140 | .t1 { |
| 141 | font-size: 28px; | 141 | font-size: 28px; |
| 142 | width: 100%; | ||
| 143 | text-align: center; | ||
| 142 | } | 144 | } |
| 143 | 145 | ||
| 144 | .t2 { | 146 | .t2 { |
| 145 | font-size: 20px; | 147 | font-size: 20px; |
| 146 | margin-top: -32px; | 148 | margin-top: -32px; |
| 149 | width: 100%; | ||
| 150 | text-align: center; | ||
| 147 | } | 151 | } |
| 148 | } | 152 | } |
| 149 | 153 | ... | ... |
| ... | @@ -57,7 +57,7 @@ | ... | @@ -57,7 +57,7 @@ |
| 57 | <!-- 标题 --> | 57 | <!-- 标题 --> |
| 58 | <view class="tit"> | 58 | <view class="tit"> |
| 59 | <view class="tt t1">时间</view> | 59 | <view class="tt t1">时间</view> |
| 60 | <view class="tt t2">获取方式</view> | 60 | <view class="tt t2">积分类型</view> |
| 61 | <view class="tt t3">名称</view> | 61 | <view class="tt t3">名称</view> |
| 62 | <view class="tt t4 minus">积分</view> | 62 | <view class="tt t4 minus">积分</view> |
| 63 | </view> | 63 | </view> |
| ... | @@ -65,8 +65,8 @@ | ... | @@ -65,8 +65,8 @@ |
| 65 | <view class="integral"> | 65 | <view class="integral"> |
| 66 | <view wx:for="{{dataList}}" wx:key="{{item}}" class="integral-item"> | 66 | <view wx:for="{{dataList}}" wx:key="{{item}}" class="integral-item"> |
| 67 | <view class="tt t1">{{item.time}}</view> | 67 | <view class="tt t1">{{item.time}}</view> |
| 68 | <view class="tt t2">{{item.subTitle}}</view> | 68 | <view class="tt t2">{{item.words}}</view> |
| 69 | <view class="tt t3">产品名称</view> | 69 | <view class="tt t3">{{item.subTitle}}</view> |
| 70 | <view class="tt t4 {{item.pointsIp == 0 ? 'minus':''}}"> | 70 | <view class="tt t4 {{item.pointsIp == 0 ? 'minus':''}}"> |
| 71 | {{item.pointsIp == 1 ? '+':'-'}} {{item.pointsNum}} | 71 | {{item.pointsIp == 1 ? '+':'-'}} {{item.pointsNum}} |
| 72 | </view> | 72 | </view> | ... | ... |
| ... | @@ -32,14 +32,15 @@ Page({ | ... | @@ -32,14 +32,15 @@ Page({ |
| 32 | }).then((result) => { | 32 | }).then((result) => { |
| 33 | let userInfo = result | 33 | let userInfo = result |
| 34 | this.setData({ | 34 | this.setData({ |
| 35 | userInfo | 35 | userInfo: userInfo, |
| 36 | qrImagePath: userInfo.memberUrl, | ||
| 36 | }) | 37 | }) |
| 37 | 38 | ||
| 38 | let tlMemberCode = userInfo.memberCode; | 39 | // 生成个人二维码 |
| 39 | // 设置二维码 | 40 | // let tlMemberCode = userInfo.memberCode; |
| 40 | let qrSize = this.setCanvasSize(440); | 41 | // let qrSize = this.setCanvasSize(440); |
| 41 | let codeContent = `tlMemberCode=${tlMemberCode}` | 42 | // let codeContent = `tlMemberCode=${tlMemberCode}` |
| 42 | this.createQrCode(codeContent, 'qrcanvas', qrSize.w, qrSize.h); | 43 | // this.createQrCode(codeContent, 'qrcanvas', qrSize.w, qrSize.h); |
| 43 | 44 | ||
| 44 | resolve(); | 45 | resolve(); |
| 45 | }) | 46 | }) | ... | ... |
| ... | @@ -7,9 +7,9 @@ | ... | @@ -7,9 +7,9 @@ |
| 7 | <view class="card"> | 7 | <view class="card"> |
| 8 | <image class="avatar" mode="widthFix" src="{{userInfo.avatar}}" /> | 8 | <image class="avatar" mode="widthFix" src="{{userInfo.avatar}}" /> |
| 9 | <view class="nickname">{{userInfo.nickname}}</view> | 9 | <view class="nickname">{{userInfo.nickname}}</view> |
| 10 | <!-- <image class="qrcode" mode="widthFix" src="../../image/icon/icon-default-qrcode.png" /> --> | 10 | <image class="qrcode" mode="widthFix" src="{{qrImagePath}}" /> |
| 11 | <image wx:if="{{qrImagePath}}" class="qrcode" mode="widthFix" src="{{qrImagePath}}" /> | 11 | <!-- <image wx:if="{{qrImagePath}}" class="qrcode" mode="widthFix" src="{{qrImagePath}}" /> |
| 12 | <canvas wx:else class="qrcode" style="visibility: hidden;" canvas-id="qrcanvas" /> | 12 | <canvas wx:else class="qrcode" style="visibility: hidden;" canvas-id="qrcanvas" /> --> |
| 13 | <view class="t1">深士照明</view> | 13 | <view class="t1">深士照明</view> |
| 14 | <view class="t1 t2">扫码即获专属积分,兑换超值奖品</view> | 14 | <view class="t1 t2">扫码即获专属积分,兑换超值奖品</view> |
| 15 | </view> | 15 | </view> | ... | ... |
| ... | @@ -2,6 +2,9 @@ let app = getApp(); | ... | @@ -2,6 +2,9 @@ let app = getApp(); |
| 2 | Page({ | 2 | Page({ |
| 3 | data: { | 3 | data: { |
| 4 | authorizeVisible: false, | 4 | authorizeVisible: false, |
| 5 | qrCodeCode: "", | ||
| 6 | prizeInfo: null, //扫码结果 | ||
| 7 | userInfo: {}, //用户信息 | ||
| 5 | }, | 8 | }, |
| 6 | onShareAppMessage() {}, | 9 | onShareAppMessage() {}, |
| 7 | showAuth() { | 10 | showAuth() { |
| ... | @@ -9,5 +12,127 @@ Page({ | ... | @@ -9,5 +12,127 @@ Page({ |
| 9 | authorizeVisible: true | 12 | authorizeVisible: true |
| 10 | }) | 13 | }) |
| 11 | }, | 14 | }, |
| 12 | onLoad(options) {} | 15 | onLoad(options) { |
| 16 | |||
| 17 | // 扫小程序码进入 | ||
| 18 | let scene = decodeURIComponent(options.scene) || ""; | ||
| 19 | // scene = "02llmPvYl1CFN2bc" | ||
| 20 | if (scene) { | ||
| 21 | this.setData({ | ||
| 22 | scene | ||
| 23 | }) | ||
| 24 | } | ||
| 25 | |||
| 26 | // 手输码 | ||
| 27 | let code = options.code || ""; | ||
| 28 | console.log("code:", code); | ||
| 29 | if (code) { | ||
| 30 | this.setData({ | ||
| 31 | scene: code | ||
| 32 | }) | ||
| 33 | } | ||
| 34 | |||
| 35 | this.initData(); | ||
| 36 | }, | ||
| 37 | |||
| 38 | initData() { | ||
| 39 | // 可能要拉授权 | ||
| 40 | this.queryMember().then((result) => { | ||
| 41 | this.queryScanIntegralQrcode().then((result) => {}).catch((err) => {}); | ||
| 42 | }); | ||
| 43 | }, | ||
| 44 | |||
| 45 | /** | ||
| 46 | * 获取会员信息 | ||
| 47 | */ | ||
| 48 | queryMember() { | ||
| 49 | return new Promise((resolve, reject) => { | ||
| 50 | app.post({ | ||
| 51 | url: app.api.member, | ||
| 52 | data: {} | ||
| 53 | }).then((result) => { | ||
| 54 | this.setData({ | ||
| 55 | userInfo: result | ||
| 56 | }) | ||
| 57 | resolve(); | ||
| 58 | }) | ||
| 59 | }); | ||
| 60 | }, | ||
| 61 | |||
| 62 | /** | ||
| 63 | * 扫积分码功能 扫积分码 | ||
| 64 | */ | ||
| 65 | queryScanIntegralQrcode() { | ||
| 66 | return new Promise((resolve, reject) => { | ||
| 67 | let { | ||
| 68 | scene | ||
| 69 | } = this.data; | ||
| 70 | if (scene) { | ||
| 71 | app.post({ | ||
| 72 | url: app.api.scanIntegralQrcode, | ||
| 73 | data: { | ||
| 74 | qrCodeCode: scene | ||
| 75 | } | ||
| 76 | }).then((result) => { | ||
| 77 | this.setData({ | ||
| 78 | prizeInfo: result | ||
| 79 | }) | ||
| 80 | if (result.qrCodeStatus != 1) { | ||
| 81 | wx.setNavigationBarTitle({ | ||
| 82 | title: '积分获取失败' | ||
| 83 | }) | ||
| 84 | } | ||
| 85 | }).catch((err) => { | ||
| 86 | this.setData({ | ||
| 87 | prizeInfo: {} | ||
| 88 | }) | ||
| 89 | wx.setNavigationBarTitle({ | ||
| 90 | title: '积分获取失败' | ||
| 91 | }) | ||
| 92 | }); | ||
| 93 | } else { | ||
| 94 | this.setData({ | ||
| 95 | prizeInfo: {} | ||
| 96 | }) | ||
| 97 | wx.setNavigationBarTitle({ | ||
| 98 | title: '积分获取失败' | ||
| 99 | }) | ||
| 100 | } | ||
| 101 | }); | ||
| 102 | }, | ||
| 103 | |||
| 104 | /** | ||
| 105 | * 查看我的积分 | ||
| 106 | */ | ||
| 107 | onMyIntegralHandler(evt) { | ||
| 108 | app.router.push({ | ||
| 109 | openType: "reLaunch", | ||
| 110 | path: "userCenter" | ||
| 111 | }) | ||
| 112 | }, | ||
| 113 | |||
| 114 | // 隐藏蒙层 | ||
| 115 | hideMask() { | ||
| 116 | this.setData({ | ||
| 117 | authorizeVisible: false, | ||
| 118 | }) | ||
| 119 | }, | ||
| 120 | // 子组件事件 | ||
| 121 | evtcomp(evt) { | ||
| 122 | let { | ||
| 123 | name, | ||
| 124 | data | ||
| 125 | } = evt.detail; | ||
| 126 | switch (name) { | ||
| 127 | |||
| 128 | // 授权完毕 | ||
| 129 | case "_evt_auth_complete": | ||
| 130 | this.initData(); | ||
| 131 | this.hideMask(); | ||
| 132 | break; | ||
| 133 | |||
| 134 | default: | ||
| 135 | break; | ||
| 136 | } | ||
| 137 | }, | ||
| 13 | }) | 138 | }) | ... | ... |
| ... | @@ -4,24 +4,30 @@ | ... | @@ -4,24 +4,30 @@ |
| 4 | <view class="app__content main"> | 4 | <view class="app__content main"> |
| 5 | <view class="top-space"></view> | 5 | <view class="top-space"></view> |
| 6 | <view class="content"> | 6 | <view class="content"> |
| 7 | <view class="border scan"> | 7 | <view wx:if="{{prizeInfo}}" class="border scan"> |
| 8 | <view wx:if="{{1>0}}" class="result success"> | 8 | <view wx:if="{{prizeInfo.qrCodeStatus == 1}}" class="result success"> |
| 9 | <text class="tips tips1">恭喜获得10积分!</text> | 9 | <text class="tips tips1">恭喜获得{{prizeInfo.pointNum}}积分!</text> |
| 10 | <view class="tips tips2"> | 10 | <view class="tips tips2"> |
| 11 | 账户共有 | 11 | 账户共有 |
| 12 | <span class="t1">350</span> | 12 | <span class="t1">{{prizeInfo.memberPoints}}</span> |
| 13 | 积分 | 13 | 积分 |
| 14 | </view> | 14 | </view> |
| 15 | <view class="btn-wrap"> | 15 | <view class="btn-wrap"> |
| 16 | <view class="btn">再扫一次</view> | 16 | <!-- <view class="btn">再扫一次</view> --> |
| 17 | <view class="btn btn2">查看我的积分</view> | 17 | <view bindtap="onMyIntegralHandler" class="btn btn2">查看我的积分</view> |
| 18 | </view> | 18 | </view> |
| 19 | </view> | 19 | </view> |
| 20 | <view wx:else class="result fail"> | 20 | <view wx:else class="result fail"> |
| 21 | <text class="tips tips1">此产品码已被扫过!\n若有异常,请联系客服</text> | 21 | <!-- 码已经被使用 --> |
| 22 | <text wx:if="{{prizeInfo.qrCodeStatus == 2}}" class="tips tips1"> | ||
| 23 | 此产品码已被扫过!\n若有异常,请联系客服 | ||
| 24 | </text> | ||
| 25 | <!-- 其他异常 --> | ||
| 26 | <text wx:else class="tips tips1">此产品码已被扫过!\n若有异常,请联系客服</text> | ||
| 22 | <view class="btn-wrap"> | 27 | <view class="btn-wrap"> |
| 23 | <view class="btn">再扫一次</view> | 28 | <!-- <view class="btn">再扫一次</view> --> |
| 24 | <view class="btn btn2">联系客服</view> | 29 | <view bindtap="onMyIntegralHandler" class="btn btn2">查看我的积分</view> |
| 30 | <!-- <view class="btn btn2">联系客服</view> --> | ||
| 25 | </view> | 31 | </view> |
| 26 | </view> | 32 | </view> |
| 27 | </view> | 33 | </view> | ... | ... |
| ... | @@ -27,7 +27,7 @@ | ... | @@ -27,7 +27,7 @@ |
| 27 | <view class="t2">我的积分</view> | 27 | <view class="t2">我的积分</view> |
| 28 | </view> | 28 | </view> |
| 29 | <view class="line"></view> | 29 | <view class="line"></view> |
| 30 | <view class="wrap"> | 30 | <view bindtap="onIntegralDetailHandler" class="wrap"> |
| 31 | <view class="t1">{{userInfo.promotionNum}}</view> | 31 | <view class="t1">{{userInfo.promotionNum}}</view> |
| 32 | <view class="t2">推广数据</view> | 32 | <view class="t2">推广数据</view> |
| 33 | </view> | 33 | </view> | ... | ... |
-
Please register or sign in to post a comment