no message
Showing
17 changed files
with
592 additions
and
68 deletions
| ... | @@ -25,6 +25,7 @@ App({ | ... | @@ -25,6 +25,7 @@ App({ |
| 25 | userInfo: null, | 25 | userInfo: null, |
| 26 | wxcode: store.getItem("wxcode"), | 26 | wxcode: store.getItem("wxcode"), |
| 27 | tlMemberCode: "", | 27 | tlMemberCode: "", |
| 28 | giftInfo: null, // 来自 gift-shop | ||
| 28 | }, | 29 | }, |
| 29 | //重写分享方法 | 30 | //重写分享方法 |
| 30 | share: function () { | 31 | share: function () { |
| ... | @@ -57,22 +58,13 @@ App({ | ... | @@ -57,22 +58,13 @@ App({ |
| 57 | }) { | 58 | }) { |
| 58 | return new Promise((resolve, reject) => { | 59 | return new Promise((resolve, reject) => { |
| 59 | this.post({ | 60 | this.post({ |
| 60 | url: this.api.index, | 61 | url: this.api.member, |
| 61 | data: {}, | 62 | data: {}, |
| 62 | loading: true, | 63 | loading: true, |
| 63 | }).then((result) => { | 64 | }).then((result) => { |
| 64 | this.globalData.indexInfo = result; | 65 | this.globalData.indexInfo = result; |
| 65 | this.globalData.userInfo = result.userInfo; | 66 | // this.globalData.userInfo = result.userInfo; |
| 66 | if (result.isNeedAuth == 1 && auth == true) { | ||
| 67 | //需要授权 | ||
| 68 | this.router.push({ | ||
| 69 | path: "authorize" | ||
| 70 | }) | ||
| 71 | reject(); | ||
| 72 | // resolve(); | ||
| 73 | } else { | ||
| 74 | resolve(result) | 67 | resolve(result) |
| 75 | } | ||
| 76 | }).catch((err) => { | 68 | }).catch((err) => { |
| 77 | reject(); | 69 | reject(); |
| 78 | }); | 70 | }); | ... | ... |
| 1 | { | 1 | { |
| 2 | "pages": [ | 2 | "pages": [ |
| 3 | "pages/user-center/user-center", | ||
| 4 | "pages/gift-shop/gift-shop", | 3 | "pages/gift-shop/gift-shop", |
| 4 | "pages/index/index", | ||
| 5 | "pages/user-center/user-center", | ||
| 5 | "pages/gift-detail/gift-detail", | 6 | "pages/gift-detail/gift-detail", |
| 6 | "pages/scan-result/scan-result", | 7 | "pages/scan-result/scan-result", |
| 7 | "pages/contact/contact", | 8 | "pages/contact/contact", |
| 8 | "pages/contact-table/contact-table", | 9 | "pages/contact-table/contact-table", |
| 9 | "pages/index/index", | ||
| 10 | "pages/authorize/authorize", | 10 | "pages/authorize/authorize", |
| 11 | "pages/register/register", | 11 | "pages/register/register", |
| 12 | "pages/integral-detail/integral-detail", | 12 | "pages/integral-detail/integral-detail", | ... | ... |
| 1 | import { | ||
| 2 | getBindtapData, | ||
| 3 | getObjByListKeyValue, | ||
| 4 | checkMobile | ||
| 5 | } from '../../utils/util'; | ||
| 6 | |||
| 1 | let app = getApp(); | 7 | let app = getApp(); |
| 2 | Page({ | 8 | Page({ |
| 3 | data: { | 9 | data: { |
| 4 | authorizeVisible: false, | 10 | authorizeVisible: false, |
| 5 | value: "", | 11 | value: "", |
| 6 | checked: true, | 12 | checked: false, |
| 13 | addressEditInfo: { | ||
| 14 | receiverCode: "", | ||
| 15 | receiverName: "", | ||
| 16 | receiverPhone: "", | ||
| 17 | receiverAddress: "", | ||
| 18 | defaultAddress: 1, | ||
| 19 | } | ||
| 7 | }, | 20 | }, |
| 8 | onShareAppMessage() {}, | 21 | onShareAppMessage() {}, |
| 9 | showAuth() { | 22 | showAuth() { |
| ... | @@ -11,11 +24,130 @@ Page({ | ... | @@ -11,11 +24,130 @@ Page({ |
| 11 | authorizeVisible: true | 24 | authorizeVisible: true |
| 12 | }) | 25 | }) |
| 13 | }, | 26 | }, |
| 14 | onLoad(options) {}, | 27 | onLoad(options) { |
| 28 | // this.setData({ | ||
| 29 | // options: app.globalData.addressEditInfo | ||
| 30 | // }) | ||
| 31 | this.initData(); | ||
| 32 | }, | ||
| 33 | initData() { | ||
| 34 | let addressEditInfo = app.globalData.addressEditInfo; | ||
| 35 | this.setData({ | ||
| 36 | addressEditInfo | ||
| 37 | }) | ||
| 38 | }, | ||
| 39 | |||
| 40 | /** | ||
| 41 | * 显示提示 | ||
| 42 | */ | ||
| 43 | showTips(tips) { | ||
| 44 | wx.showToast({ | ||
| 45 | title: tips, | ||
| 46 | icon: "none" | ||
| 47 | }) | ||
| 48 | }, | ||
| 49 | |||
| 50 | /** | ||
| 51 | * 检查提交 | ||
| 52 | */ | ||
| 53 | checkSubmit() { | ||
| 54 | return new Promise((resolve, reject) => { | ||
| 55 | let addressEditInfo = this.data.addressEditInfo; | ||
| 56 | if (!addressEditInfo.receiverName) { | ||
| 57 | this.showTips("请输入收货人姓名") | ||
| 58 | reject(); | ||
| 59 | } else if (!addressEditInfo.receiverPhone) { | ||
| 60 | this.showTips("请输入收货电话") | ||
| 61 | reject(); | ||
| 62 | } else if (!checkMobile(addressEditInfo.receiverPhone)) { | ||
| 63 | this.showTips("请输入正确收货电话") | ||
| 64 | reject(); | ||
| 65 | } else if (!addressEditInfo.receiverAddress) { | ||
| 66 | this.showTips("请输入收货地址") | ||
| 67 | reject(); | ||
| 68 | } else { | ||
| 69 | resolve() | ||
| 70 | } | ||
| 71 | }); | ||
| 72 | }, | ||
| 73 | |||
| 74 | /** | ||
| 75 | * 表单提交 | ||
| 76 | * @param {*} evt | ||
| 77 | */ | ||
| 78 | onSubmitHandler(evt) { | ||
| 79 | this.checkSubmit().then((result) => { | ||
| 80 | let { | ||
| 81 | addressEditInfo, | ||
| 82 | checked | ||
| 83 | } = this.data; | ||
| 84 | addressEditInfo.defaultAddress = checked ? 1 : 0; | ||
| 85 | app.post({ | ||
| 86 | url: app.api.receiverSave, | ||
| 87 | data: addressEditInfo | ||
| 88 | }).then((result2) => { | ||
| 89 | wx.showModal({ | ||
| 90 | content: '操作成功', | ||
| 91 | showCancel: false, | ||
| 92 | success(res) { | ||
| 93 | wx.navigateBack({ | ||
| 94 | delta: 1 | ||
| 95 | }); | ||
| 96 | } | ||
| 97 | }) | ||
| 98 | }) | ||
| 99 | }); | ||
| 100 | }, | ||
| 101 | |||
| 102 | /** | ||
| 103 | * 删除表单 | ||
| 104 | * @param {*} evt | ||
| 105 | */ | ||
| 106 | onDeleteHandler(evt) { | ||
| 107 | let { | ||
| 108 | addressEditInfo, | ||
| 109 | } = this.data; | ||
| 110 | app.post({ | ||
| 111 | url: app.api.receiverDelete, | ||
| 112 | data: { | ||
| 113 | receiverCode: addressEditInfo.receiverCode | ||
| 114 | } | ||
| 115 | }).then((result) => { | ||
| 116 | wx.showModal({ | ||
| 117 | content: '删除成功', | ||
| 118 | showCancel: false, | ||
| 119 | success(res) { | ||
| 120 | wx.navigateBack({ | ||
| 121 | delta: 1 | ||
| 122 | }); | ||
| 123 | } | ||
| 124 | }) | ||
| 125 | }) | ||
| 126 | }, | ||
| 127 | |||
| 128 | bindReceiverNameInput(e) { | ||
| 129 | this.setData({ | ||
| 130 | "addressEditInfo.receiverName": e.detail.value | ||
| 131 | }); | ||
| 132 | }, | ||
| 133 | bindReceiverPhoneInput(e) { | ||
| 134 | this.setData({ | ||
| 135 | "addressEditInfo.receiverPhone": e.detail.value | ||
| 136 | }); | ||
| 137 | }, | ||
| 138 | bindReceiverAddressInput(e) { | ||
| 139 | this.setData({ | ||
| 140 | "addressEditInfo.receiverAddress": e.detail.value | ||
| 141 | }); | ||
| 142 | }, | ||
| 143 | |||
| 15 | onChange(event) { | 144 | onChange(event) { |
| 145 | let checked = event.detail | ||
| 16 | this.setData({ | 146 | this.setData({ |
| 17 | checked: event.detail | 147 | checked: event.detail, |
| 18 | }); | 148 | }); |
| 19 | } | 149 | } |
| 20 | 150 | ||
| 151 | |||
| 152 | |||
| 21 | }) | 153 | }) | ... | ... |
| ... | @@ -8,15 +8,15 @@ | ... | @@ -8,15 +8,15 @@ |
| 8 | <view class="form"> | 8 | <view class="form"> |
| 9 | <view class="form-item"> | 9 | <view class="form-item"> |
| 10 | <view class="label">收货人姓名</view> | 10 | <view class="label">收货人姓名</view> |
| 11 | <input class="cont" placeholder="请输入" /> | 11 | <input value="{{addressEditInfo.receiverName}}" bindinput="bindReceiverNameInput" class="cont" placeholder="请输入" /> |
| 12 | </view> | 12 | </view> |
| 13 | <view class="form-item"> | 13 | <view class="form-item"> |
| 14 | <view class="label">手机号码</view> | 14 | <view class="label">手机号码</view> |
| 15 | <input class="cont" placeholder="请输入" /> | 15 | <input value="{{addressEditInfo.receiverPhone}}" bindinput="bindReceiverPhoneInput" class="cont" placeholder="请输入" /> |
| 16 | </view> | 16 | </view> |
| 17 | <view class="form-item form-item-textarea"> | 17 | <view class="form-item form-item-textarea"> |
| 18 | <view class="label">收货地址</view> | 18 | <view class="label">收货地址</view> |
| 19 | <textarea class="cont" placeholder="请输入"></textarea> | 19 | <textarea value="{{addressEditInfo.receiverAddress}}" bindinput="bindReceiverAddressInput" class="cont" placeholder="请输入"></textarea> |
| 20 | </view> | 20 | </view> |
| 21 | </view> | 21 | </view> |
| 22 | <!-- 设置为默认地址 --> | 22 | <!-- 设置为默认地址 --> |
| ... | @@ -26,12 +26,14 @@ | ... | @@ -26,12 +26,14 @@ |
| 26 | </view> | 26 | </view> |
| 27 | <view class="bottom"> | 27 | <view class="bottom"> |
| 28 | <view class="btn-wrap"> | 28 | <view class="btn-wrap"> |
| 29 | <view class="btn">保存</view> | 29 | <view bindtap="onSubmitHandler" class="btn">保存</view> |
| 30 | <view class="btn btn-red">删除</view> | 30 | <view wx:if="{{addressEditInfo.receiverCode}}" bindtap="onDeleteHandler" class="btn btn-red"> |
| 31 | 删除 | ||
| 32 | </view> | ||
| 31 | </view> | 33 | </view> |
| 32 | </view> | 34 | </view> |
| 33 | </view> | 35 | </view> |
| 34 | </view> | 36 | </view> |
| 35 | <van-popup show="{{ authorizeVisible }}" > | 37 | <van-popup show="{{ authorizeVisible }}"> |
| 36 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> | 38 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> |
| 37 | </van-popup> | 39 | </van-popup> | ... | ... |
| 1 | import { | ||
| 2 | getBindtapData, | ||
| 3 | getObjByListKeyValue | ||
| 4 | } from '../../utils/util'; | ||
| 5 | |||
| 1 | let app = getApp(); | 6 | let app = getApp(); |
| 2 | Page({ | 7 | Page({ |
| 3 | data: { | 8 | data: { |
| 4 | authorizeVisible: false, | 9 | authorizeVisible: false, |
| 10 | receiverList: [], // 收货地址 | ||
| 11 | defaultReceiver: null, // 默认收货地址 | ||
| 5 | }, | 12 | }, |
| 6 | onShareAppMessage() {}, | 13 | onShareAppMessage() {}, |
| 7 | showAuth() { | 14 | showAuth() { |
| ... | @@ -10,16 +17,76 @@ Page({ | ... | @@ -10,16 +17,76 @@ Page({ |
| 10 | }) | 17 | }) |
| 11 | }, | 18 | }, |
| 12 | onLoad(options) {}, | 19 | onLoad(options) {}, |
| 20 | onShow() { | ||
| 21 | this.initData(); | ||
| 22 | }, | ||
| 23 | initData() { | ||
| 24 | app.queryIndex().then((result) => { | ||
| 25 | this.queryReceiver(); | ||
| 26 | }) | ||
| 27 | }, | ||
| 28 | queryReceiver() { | ||
| 29 | return new Promise((resolve, reject) => { | ||
| 30 | app.post({ | ||
| 31 | url: app.api.receiver, | ||
| 32 | data: {} | ||
| 33 | }).then((result2) => { | ||
| 34 | let defaultReceiver = getObjByListKeyValue(1, "defaultAddress", result2); | ||
| 35 | this.setData({ | ||
| 36 | indexInfo: app.globalData.indexInfo, | ||
| 37 | receiverList: result2, | ||
| 38 | defaultReceiver: defaultReceiver | ||
| 39 | }) | ||
| 40 | resolve(); | ||
| 41 | }) | ||
| 42 | }); | ||
| 43 | }, | ||
| 44 | |||
| 13 | // 编辑收货地址 | 45 | // 编辑收货地址 |
| 14 | onAddressEditHandler() { | 46 | onAddressEditHandler(evt) { |
| 47 | console.log("edit"); | ||
| 48 | let curData = getBindtapData(evt); | ||
| 49 | app.globalData.addressEditInfo = curData; | ||
| 15 | app.router.push({ | 50 | app.router.push({ |
| 16 | path: "addressEdit" | 51 | path: "addressEdit" |
| 17 | }) | 52 | }) |
| 18 | }, | 53 | }, |
| 19 | // 添加收货地址 | 54 | // 添加收货地址 |
| 20 | onAddressAddHandler() { | 55 | onAddressAddHandler(evt) { |
| 56 | app.globalData.addressEditInfo = null; | ||
| 21 | app.router.push({ | 57 | app.router.push({ |
| 22 | path: "addressEdit" | 58 | path: "addressEdit" |
| 23 | }) | 59 | }) |
| 60 | }, | ||
| 61 | /** | ||
| 62 | * 设置为默认地址 | ||
| 63 | */ | ||
| 64 | onSetDefaultHandler(evt) { | ||
| 65 | let _this = this; | ||
| 66 | let curData = getBindtapData(evt); | ||
| 67 | wx.showModal({ | ||
| 68 | title: '提示', | ||
| 69 | content: '设置为默认地址?', | ||
| 70 | success(res) { | ||
| 71 | if (res.confirm) { | ||
| 72 | curData.defaultAddress = 1; | ||
| 73 | app.post({ | ||
| 74 | url: app.api.receiverSave, | ||
| 75 | data: curData | ||
| 76 | }).then((result) => { | ||
| 77 | _this.queryReceiver().then((result) => { | ||
| 78 | wx.showModal({ | ||
| 79 | content: '操作成功', | ||
| 80 | showCancel: false, | ||
| 81 | success(res) {} | ||
| 82 | }) | ||
| 83 | }) | ||
| 84 | }) | ||
| 85 | } | ||
| 86 | } | ||
| 87 | }) | ||
| 88 | |||
| 89 | // app.globalData.addressEditInfo = curData; | ||
| 90 | // console.log("def:", curData); | ||
| 24 | } | 91 | } |
| 25 | }) | 92 | }) | ... | ... |
| ... | @@ -32,9 +32,21 @@ $contentWidth:690px; | ... | @@ -32,9 +32,21 @@ $contentWidth:690px; |
| 32 | 32 | ||
| 33 | // 表单 | 33 | // 表单 |
| 34 | .form { | 34 | .form { |
| 35 | position: relative; | ||
| 35 | padding: 30px 30px; | 36 | padding: 30px 30px; |
| 37 | @extend .bb; | ||
| 38 | |||
| 39 | .ebg { | ||
| 40 | position: absolute; | ||
| 41 | top: 0; | ||
| 42 | left: 0; | ||
| 43 | z-index: 1; | ||
| 44 | width: 100%; | ||
| 45 | height: 100%; | ||
| 46 | } | ||
| 36 | 47 | ||
| 37 | &-tit { | 48 | &-tit { |
| 49 | position: relative; | ||
| 38 | margin-bottom: 28px; | 50 | margin-bottom: 28px; |
| 39 | display: flex; | 51 | display: flex; |
| 40 | justify-content: space-between; | 52 | justify-content: space-between; |
| ... | @@ -48,9 +60,11 @@ $contentWidth:690px; | ... | @@ -48,9 +60,11 @@ $contentWidth:690px; |
| 48 | height: 36px; | 60 | height: 36px; |
| 49 | 61 | ||
| 50 | .address { | 62 | .address { |
| 63 | position: relative; | ||
| 51 | font-size: 32px; | 64 | font-size: 32px; |
| 52 | margin-right: 20px; | 65 | margin-right: 20px; |
| 53 | vertical-align: middle; | 66 | vertical-align: middle; |
| 67 | |||
| 54 | } | 68 | } |
| 55 | 69 | ||
| 56 | .used { | 70 | .used { |
| ... | @@ -66,10 +80,12 @@ $contentWidth:690px; | ... | @@ -66,10 +80,12 @@ $contentWidth:690px; |
| 66 | .address-edit { | 80 | .address-edit { |
| 67 | color: #3680EB; | 81 | color: #3680EB; |
| 68 | font-size: 28px; | 82 | font-size: 28px; |
| 83 | z-index: 11; | ||
| 69 | } | 84 | } |
| 70 | } | 85 | } |
| 71 | 86 | ||
| 72 | &-item { | 87 | &-item { |
| 88 | position: relative; | ||
| 73 | margin-bottom: 20px; | 89 | margin-bottom: 20px; |
| 74 | font-size: 28px; | 90 | font-size: 28px; |
| 75 | display: flex; | 91 | display: flex; | ... | ... |
| ... | @@ -6,28 +6,32 @@ | ... | @@ -6,28 +6,32 @@ |
| 6 | <view class="content"> | 6 | <view class="content"> |
| 7 | <!-- 地址 item --> | 7 | <!-- 地址 item --> |
| 8 | <view class="manage-wrap"> | 8 | <view class="manage-wrap"> |
| 9 | <view class="cont-wrap form"> | 9 | <view wx:for="{{receiverList}}" wx:key="{{index}}" class="cont-wrap form"> |
| 10 | <view bindtap="onSetDefaultHandler" data-data="{{item}}" class="ebg"></view> | ||
| 10 | <view class="form-tit"> | 11 | <view class="form-tit"> |
| 11 | <view class="address-message"> | 12 | <view class="address-message"> |
| 12 | <view class="address">地址一:默认地址</view> | 13 | <view class="address"> |
| 13 | <view class="used">当前使用</view> | 14 | 地址{{index+1}} |
| 15 | <block wx:if="{{item.defaultAddress == 1}}">:默认地址</block> | ||
| 14 | </view> | 16 | </view> |
| 15 | <view bindtap="onAddressEditHandler" class="address-edit">编辑</view> | 17 | <view wx:if="{{item.defaultAddress == 1}}" class="used">当前使用</view> |
| 18 | </view> | ||
| 19 | <view bindtap="onAddressEditHandler" data-data="{{item}}" class="address-edit">编辑</view> | ||
| 16 | </view> | 20 | </view> |
| 17 | <view class="form-item"> | 21 | <view class="form-item"> |
| 18 | <view class="label">收货人</view> | 22 | <view class="label">收货人</view> |
| 19 | <view class="cont">郑亮亮</view> | 23 | <view class="cont">{{item.receiverName}}</view> |
| 20 | </view> | 24 | </view> |
| 21 | <view class="form-item"> | 25 | <view class="form-item"> |
| 22 | <view class="label">收货电话</view> | 26 | <view class="label">收货电话</view> |
| 23 | <view class="cont">13800000000</view> | 27 | <view class="cont">{{item.receiverPhone}}</view> |
| 24 | </view> | 28 | </view> |
| 25 | <view class="form-item"> | 29 | <view class="form-item"> |
| 26 | <view class="label">收货地址</view> | 30 | <view class="label">收货地址</view> |
| 27 | <view class="cont">深圳市龙岗区XXX路</view> | 31 | <view class="cont">{{item.receiverAddress}}</view> |
| 28 | </view> | 32 | </view> |
| 29 | </view> | 33 | </view> |
| 30 | <view class="cont-wrap form"> | 34 | <!-- <view class="cont-wrap form"> |
| 31 | <view class="form-tit"> | 35 | <view class="form-tit"> |
| 32 | <view class="address-message"> | 36 | <view class="address-message"> |
| 33 | <view class="address">地址一:默认地址</view> | 37 | <view class="address">地址一:默认地址</view> |
| ... | @@ -47,13 +51,13 @@ | ... | @@ -47,13 +51,13 @@ |
| 47 | <view class="label">收货地址</view> | 51 | <view class="label">收货地址</view> |
| 48 | <view class="cont">深圳市龙岗区XXX路</view> | 52 | <view class="cont">深圳市龙岗区XXX路</view> |
| 49 | </view> | 53 | </view> |
| 50 | </view> | 54 | </view> --> |
| 51 | </view> | 55 | </view> |
| 52 | <!-- 添加地址 --> | 56 | <!-- 添加地址 --> |
| 53 | <view bindtap="onAddressAddHandler" class="manage-add">+添加地址</view> | 57 | <view bindtap="onAddressAddHandler" class="manage-add">+添加地址</view> |
| 54 | </view> | 58 | </view> |
| 55 | </view> | 59 | </view> |
| 56 | </view> | 60 | </view> |
| 57 | <van-popup show="{{ authorizeVisible }}" > | 61 | <van-popup show="{{ authorizeVisible }}"> |
| 58 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> | 62 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> |
| 59 | </van-popup> | 63 | </van-popup> | ... | ... |
| 1 | import { | ||
| 2 | getBindtapData, | ||
| 3 | getObjByListKeyValue | ||
| 4 | } from '../../utils/util'; | ||
| 5 | |||
| 1 | let app = getApp(); | 6 | let app = getApp(); |
| 2 | Page({ | 7 | Page({ |
| 3 | data: { | 8 | data: { |
| 4 | authorizeVisible: false, | 9 | authorizeVisible: false, |
| 5 | commonTipsCompVisible: true, | 10 | commonTipsCompVisible: false, |
| 11 | orderSubmitSuccessCompVisible: true, | ||
| 12 | cid: "1", // 1积分不足 2.账号未审核 | ||
| 13 | innerTitle: "", | ||
| 14 | innerText: "", | ||
| 15 | innerButton: "", | ||
| 16 | indexInfo: {}, | ||
| 17 | item: {}, | ||
| 18 | remark: "", | ||
| 19 | receiverList: [], // 收货地址 | ||
| 20 | defaultReceiver: null, // 默认收货地址 | ||
| 6 | }, | 21 | }, |
| 7 | onShareAppMessage() {}, | 22 | onShareAppMessage() {}, |
| 8 | showAuth() { | 23 | showAuth() { |
| ... | @@ -10,12 +25,112 @@ Page({ | ... | @@ -10,12 +25,112 @@ Page({ |
| 10 | authorizeVisible: true | 25 | authorizeVisible: true |
| 11 | }) | 26 | }) |
| 12 | }, | 27 | }, |
| 13 | onLoad(options) {}, | 28 | onLoad(options) { |
| 29 | |||
| 30 | }, | ||
| 31 | onShow() { | ||
| 32 | this.initData(); | ||
| 33 | }, | ||
| 34 | initData() { | ||
| 35 | app.queryIndex().then((result) => { | ||
| 36 | app.post({ | ||
| 37 | url: app.api.receiver, | ||
| 38 | data: {} | ||
| 39 | }).then((result2) => { | ||
| 40 | let defaultReceiver = getObjByListKeyValue(1, "defaultAddress", result2); | ||
| 41 | this.setData({ | ||
| 42 | indexInfo: app.globalData.indexInfo, | ||
| 43 | receiverList: result2, | ||
| 44 | defaultReceiver: defaultReceiver, | ||
| 45 | item: app.globalData.giftInfo, | ||
| 46 | }) | ||
| 47 | }) | ||
| 48 | }) | ||
| 49 | }, | ||
| 50 | |||
| 51 | showTips(tips) { | ||
| 52 | wx.showToast({ | ||
| 53 | title: tips, | ||
| 54 | icon: "none" | ||
| 55 | }) | ||
| 56 | }, | ||
| 57 | |||
| 58 | /** | ||
| 59 | * 检查提交 | ||
| 60 | */ | ||
| 61 | checkSubmit() { | ||
| 62 | return new Promise((resolve, reject) => { | ||
| 63 | let { | ||
| 64 | item, | ||
| 65 | defaultReceiver, | ||
| 66 | indexInfo | ||
| 67 | } = this.data; | ||
| 68 | console.log("indexInfo:", indexInfo); | ||
| 69 | console.log("item:", item); | ||
| 70 | if (indexInfo.memberPoints < item.commodityPrice) { | ||
| 71 | // 积分不足 | ||
| 72 | this.setData({ | ||
| 73 | commonTipsCompVisible: true, | ||
| 74 | cid: "1", | ||
| 75 | innerTitle: "积分不足", | ||
| 76 | innerText: "使用推广、签到功能\n可获取更多积分!", | ||
| 77 | innerButton: "我知道了", | ||
| 78 | }); | ||
| 79 | reject(); | ||
| 80 | return; | ||
| 81 | } else if (indexInfo.auditStatus != "authorization") { | ||
| 82 | // 未验证 | ||
| 83 | this.setData({ | ||
| 84 | commonTipsCompVisible: true, | ||
| 85 | cid: "2", | ||
| 86 | innerTitle: "账号未审核", | ||
| 87 | innerText: "通过认证的用户才能兑换礼品哦,快去提交资", | ||
| 88 | innerButton: "马上去验证", | ||
| 89 | }); | ||
| 90 | reject(); | ||
| 91 | return; | ||
| 92 | } else if (!defaultReceiver && item.commodityType == "object") { | ||
| 93 | // 实物奖品必须添加地址 | ||
| 94 | this.showTips("请先添加地址") | ||
| 95 | reject(); | ||
| 96 | return; | ||
| 97 | } else { | ||
| 98 | resolve(); | ||
| 99 | } | ||
| 100 | |||
| 101 | }); | ||
| 102 | }, | ||
| 103 | |||
| 104 | |||
| 14 | /** | 105 | /** |
| 15 | * 确认兑换 / 提交订单 | 106 | * 确认兑换 / 提交订单 |
| 16 | */ | 107 | */ |
| 17 | onSubmitHandler() { | 108 | onSubmitHandler(evt) { |
| 109 | let _this = this; | ||
| 110 | this.checkSubmit().then((result) => { | ||
| 111 | let { | ||
| 112 | item, | ||
| 113 | defaultReceiver | ||
| 114 | } = this.data; | ||
| 115 | wx.showModal({ | ||
| 116 | title: '兑换确认', | ||
| 117 | content: `将花费${item.commodityPrice}兑换${commodityTitle}一份`, | ||
| 118 | success(res) { | ||
| 119 | if (res.confirm) { | ||
| 120 | app.post({ | ||
| 121 | url: app.api.commodityExchange, | ||
| 122 | data: { | ||
| 123 | commodityCode: item.commodityCode, | ||
| 124 | receiverCode: defaultReceiver.receiverCode, | ||
| 125 | remark: this.data.remark | ||
| 126 | } | ||
| 127 | }).then((result) => { | ||
| 18 | 128 | ||
| 129 | }) | ||
| 130 | } | ||
| 131 | } | ||
| 132 | }) | ||
| 133 | }) | ||
| 19 | }, | 134 | }, |
| 20 | /** | 135 | /** |
| 21 | * 收获地址管理 | 136 | * 收获地址管理 |
| ... | @@ -25,11 +140,29 @@ Page({ | ... | @@ -25,11 +140,29 @@ Page({ |
| 25 | path: "addressManagement" | 140 | path: "addressManagement" |
| 26 | }) | 141 | }) |
| 27 | }, | 142 | }, |
| 143 | |||
| 144 | /** | ||
| 145 | * 添加收货地址 | ||
| 146 | * 同地址管理 | ||
| 147 | */ | ||
| 148 | onAddressAddHandler() { | ||
| 149 | app.router.push({ | ||
| 150 | path: "addressManagement" | ||
| 151 | }) | ||
| 152 | }, | ||
| 153 | |||
| 154 | bindRemarkInput(e) { | ||
| 155 | this.setData({ | ||
| 156 | remark: e.detail.value | ||
| 157 | }) | ||
| 158 | }, | ||
| 159 | |||
| 28 | // 隐藏蒙层 | 160 | // 隐藏蒙层 |
| 29 | hideMask() { | 161 | hideMask() { |
| 30 | this.setData({ | 162 | this.setData({ |
| 31 | authorizeVisible: false, | 163 | authorizeVisible: false, |
| 32 | commonTipsCompVisible: false, | 164 | commonTipsCompVisible: false, |
| 165 | orderSubmitSuccessCompVisible: false, | ||
| 33 | }) | 166 | }) |
| 34 | }, | 167 | }, |
| 35 | // 子组件事件 | 168 | // 子组件事件 |
| ... | @@ -43,6 +176,23 @@ Page({ | ... | @@ -43,6 +176,23 @@ Page({ |
| 43 | // 隐藏弹窗 | 176 | // 隐藏弹窗 |
| 44 | case "_evt_common_comp_button": | 177 | case "_evt_common_comp_button": |
| 45 | this.hideMask(); | 178 | this.hideMask(); |
| 179 | switch (data.cid) { | ||
| 180 | // 积分不足 | ||
| 181 | case "1": | ||
| 182 | this.hideMask(); | ||
| 183 | break; | ||
| 184 | |||
| 185 | // 未验证 | ||
| 186 | case "2": | ||
| 187 | app.router.push({ | ||
| 188 | path: "vipLogin" | ||
| 189 | }) | ||
| 190 | break; | ||
| 191 | |||
| 192 | default: | ||
| 193 | break; | ||
| 194 | } | ||
| 195 | |||
| 46 | break; | 196 | break; |
| 47 | 197 | ||
| 48 | default: | 198 | default: | ... | ... |
| ... | @@ -4,6 +4,8 @@ | ... | @@ -4,6 +4,8 @@ |
| 4 | $contentWidth:690px; | 4 | $contentWidth:690px; |
| 5 | 5 | ||
| 6 | .page { | 6 | .page { |
| 7 | padding-bottom: $pageBottom; | ||
| 8 | |||
| 7 | .bgc { | 9 | .bgc { |
| 8 | background: #F8F8F8; | 10 | background: #F8F8F8; |
| 9 | } | 11 | } |
| ... | @@ -47,8 +49,14 @@ $contentWidth:690px; | ... | @@ -47,8 +49,14 @@ $contentWidth:690px; |
| 47 | .image-wrap { | 49 | .image-wrap { |
| 48 | width: 200px; | 50 | width: 200px; |
| 49 | height: 200px; | 51 | height: 200px; |
| 52 | border: solid 1px #f0f0f0; | ||
| 53 | border-radius: 8px; | ||
| 54 | @extend .fcc; | ||
| 50 | 55 | ||
| 51 | .img {} | 56 | .image { |
| 57 | width: 180px; | ||
| 58 | height: 180px; | ||
| 59 | } | ||
| 52 | } | 60 | } |
| 53 | 61 | ||
| 54 | .cont { | 62 | .cont { |
| ... | @@ -61,12 +69,14 @@ $contentWidth:690px; | ... | @@ -61,12 +69,14 @@ $contentWidth:690px; |
| 61 | align-content: center; | 69 | align-content: center; |
| 62 | 70 | ||
| 63 | .name { | 71 | .name { |
| 72 | width: 100%; | ||
| 64 | font-size: 36px; | 73 | font-size: 36px; |
| 65 | color: #333333; | 74 | color: #333333; |
| 66 | @include ellipsis(2); | 75 | @include ellipsis(2); |
| 67 | } | 76 | } |
| 68 | 77 | ||
| 69 | .integral { | 78 | .integral { |
| 79 | width: 100%; | ||
| 70 | margin-top: 16px; | 80 | margin-top: 16px; |
| 71 | font-size: 28px; | 81 | font-size: 28px; |
| 72 | color: #FF7900; | 82 | color: #FF7900; |
| ... | @@ -85,6 +95,18 @@ $contentWidth:690px; | ... | @@ -85,6 +95,18 @@ $contentWidth:690px; |
| 85 | line-height: 48px; | 95 | line-height: 48px; |
| 86 | } | 96 | } |
| 87 | 97 | ||
| 98 | // 添加地址 | ||
| 99 | .manage-add { | ||
| 100 | width: $contentWidth; | ||
| 101 | margin: 20px auto; | ||
| 102 | @extend .bb; | ||
| 103 | background: #fff; | ||
| 104 | padding: 38px 30px; | ||
| 105 | font-size: 32px; | ||
| 106 | color: #3680EB; | ||
| 107 | @extend .shadow; | ||
| 108 | } | ||
| 109 | |||
| 88 | // 表单 | 110 | // 表单 |
| 89 | .form { | 111 | .form { |
| 90 | padding: 30px 30px 40px; | 112 | padding: 30px 30px 40px; | ... | ... |
| ... | @@ -7,50 +7,52 @@ | ... | @@ -7,50 +7,52 @@ |
| 7 | <view class="product"> | 7 | <view class="product"> |
| 8 | <view class="product-item"> | 8 | <view class="product-item"> |
| 9 | <view class="image-wrap"> | 9 | <view class="image-wrap"> |
| 10 | <!-- <image /> --> | 10 | <image class="image" mode="aspectFit" src="{{item.commodityImages[0]}}" /> |
| 11 | </view> | 11 | </view> |
| 12 | <view class="cont"> | 12 | <view class="cont"> |
| 13 | <view class="name">某东购物卡200元某东购物卡200元</view> | 13 | <view class="name">{{item.commodityTitle || '-'}}</view> |
| 14 | <view class="integral">消耗积分:3000分</view> | 14 | <view class="integral">消耗积分:{{item.commodityPrice}}分</view> |
| 15 | </view> | 15 | </view> |
| 16 | </view> | 16 | </view> |
| 17 | </view> | 17 | </view> |
| 18 | <block wx:if="{{1<0}}"> | 18 | <!-- 使用规则 --> |
| 19 | <!-- 使用规则 (京东卡) --> | ||
| 20 | <view class="cont-wrap use-rule"> | 19 | <view class="cont-wrap use-rule"> |
| 21 | 京东E卡可在京东商城 | 20 | <!-- 京东E卡可在京东商城 |
| 22 | <span class="link">www.jd.com</span> | 21 | <span class="link">www.jd.com</span> |
| 23 | 上购买自营商品(“自营商品”指在商品详情页明确标识为自营的商品),用户可在订单结算时输入E卡密码并使用。 | 22 | 上购买自营商品(“自营商品”指在商品详情页明确标识为自营的商品),用户可在订单结算时输入E卡密码并使用。 --> |
| 23 | {{item.commodityInfo}} | ||
| 24 | </view> | 24 | </view> |
| 25 | </block> | ||
| 26 | <block wx:else> | ||
| 27 | <!-- 表单提交 (实物) --> | 25 | <!-- 表单提交 (实物) --> |
| 28 | <view class="cont-wrap form"> | 26 | <block wx:if="{{item.commodityType == 'object'}}"> |
| 27 | <!-- 表单 --> | ||
| 28 | <view wx:if="{{defaultReceiver}}" class="cont-wrap form"> | ||
| 29 | <view class="form-tit"> | 29 | <view class="form-tit"> |
| 30 | <view class="address-message">收货信息</view> | 30 | <view class="address-message">收货信息</view> |
| 31 | <view bindtap="onAddressManagementHandler" class="address-edit">更改地址</view> | 31 | <view bindtap="onAddressManagementHandler" class="address-edit">更改地址</view> |
| 32 | </view> | 32 | </view> |
| 33 | <view class="form-item"> | 33 | <view class="form-item"> |
| 34 | <view class="label">收货人</view> | 34 | <view class="label">收货人</view> |
| 35 | <view class="cont">郑亮亮</view> | 35 | <view class="cont">{{defaultReceiver.receiverName}}</view> |
| 36 | </view> | 36 | </view> |
| 37 | <view class="form-item"> | 37 | <view class="form-item"> |
| 38 | <view class="label">收货电话</view> | 38 | <view class="label">收货电话</view> |
| 39 | <view class="cont">13800000000</view> | 39 | <view class="cont">{{defaultReceiver.receiverPhone}}</view> |
| 40 | </view> | 40 | </view> |
| 41 | <view class="form-item"> | 41 | <view class="form-item"> |
| 42 | <view class="label">收货地址</view> | 42 | <view class="label">收货地址</view> |
| 43 | <view class="cont">深圳市龙岗区XXX路</view> | 43 | <view class="cont">{{defaultReceiver.receiverAddress}}</view> |
| 44 | </view> | 44 | </view> |
| 45 | <textarea placeholder="备注您的其他要求" class="form-remark"></textarea> | 45 | <textarea value="{{remark}}" bindinput="bindRemarkInput" placeholder="备注您的其他要求" class="form-remark"></textarea> |
| 46 | </view> | 46 | </view> |
| 47 | <!-- 添加地址按钮 --> | ||
| 48 | <view wx:else bindtap="onAddressAddHandler" class="manage-add">我的收货地址</view> | ||
| 47 | </block> | 49 | </block> |
| 48 | </view> | 50 | </view> |
| 49 | <view class="bottom"> | 51 | <view class="bottom"> |
| 50 | <view class="submit-bar"> | 52 | <view class="submit-bar"> |
| 51 | <view class="submit-bar-cont"> | 53 | <view class="submit-bar-cont"> |
| 52 | 现有积分 | 54 | 现有积分 |
| 53 | <span class="integral">350</span> | 55 | <span class="integral">{{indexInfo.memberPoints}}</span> |
| 54 | 分 | 56 | 分 |
| 55 | </view> | 57 | </view> |
| 56 | <view bindtap="onSubmitHandler" class="submit-bar-btn">确认兑换</view> | 58 | <view bindtap="onSubmitHandler" class="submit-bar-btn">确认兑换</view> |
| ... | @@ -58,9 +60,13 @@ | ... | @@ -58,9 +60,13 @@ |
| 58 | </view> | 60 | </view> |
| 59 | </view> | 61 | </view> |
| 60 | </view> | 62 | </view> |
| 61 | <van-popup show="{{ authorizeVisible }}" > | 63 | <van-popup show="{{ authorizeVisible }}"> |
| 62 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> | 64 | <authorize-comp bind:evtcomp="evtcomp"></authorize-comp> |
| 63 | </van-popup> | 65 | </van-popup> |
| 64 | <van-popup show="{{ commonTipsCompVisible }}"> | 66 | <van-popup show="{{ commonTipsCompVisible }}"> |
| 65 | <common-tips-comp bind:evtcomp="evtcomp" inner-title="积分不足" inner-text="使用推广、签到功能\n可获取更多积分!" inner-button="我知道了"></common-tips-comp> | 67 | <common-tips-comp bind:evtcomp="evtcomp" cid="{{cid}}" inner-title="{{innerTitle}}" inner-text="{{innerText}}" inner-button="{{innerButton}}"></common-tips-comp> |
| 68 | </van-popup> | ||
| 69 | <!-- 兑换成功提示 --> | ||
| 70 | <van-popup show="{{ orderSubmitSuccessCompVisible }}"> | ||
| 71 | <order-submit-success-tips-comp bind:evtcomp="evtcomp" item="{{item}}"></order-submit-success-tips-comp> | ||
| 66 | </van-popup> | 72 | </van-popup> | ... | ... |
| 1 | import { | ||
| 2 | getBindtapData | ||
| 3 | } from '../../utils/util'; | ||
| 4 | |||
| 1 | let app = getApp(); | 5 | let app = getApp(); |
| 2 | Page({ | 6 | Page({ |
| 3 | data: { | 7 | data: { |
| 4 | authorizeVisible: false, | 8 | authorizeVisible: false, |
| 5 | orderSubmitSuccessTipsCompVisible: true, | 9 | orderSubmitSuccessTipsCompVisible: false, |
| 6 | productList: ["", "", ""] | 10 | total: 0, |
| 11 | page: 1, | ||
| 12 | size: 10, | ||
| 13 | keyWords: "", | ||
| 14 | orderSort: 0, | ||
| 15 | productList: [], | ||
| 7 | }, | 16 | }, |
| 8 | onShareAppMessage() {}, | 17 | onShareAppMessage() {}, |
| 9 | showAuth() { | 18 | showAuth() { |
| ... | @@ -11,15 +20,96 @@ Page({ | ... | @@ -11,15 +20,96 @@ Page({ |
| 11 | authorizeVisible: true | 20 | authorizeVisible: true |
| 12 | }) | 21 | }) |
| 13 | }, | 22 | }, |
| 14 | onLoad(options) {}, | 23 | onLoad(options) { |
| 24 | this.queryProduct(); | ||
| 25 | }, | ||
| 26 | // 到达底部 | ||
| 27 | onReachBottom() { | ||
| 28 | if (this.data.productList.length < this.data.total) { | ||
| 29 | this.setData({ | ||
| 30 | page: this.data.page + 1 | ||
| 31 | }); | ||
| 32 | this.queryProduct(); | ||
| 33 | } | ||
| 34 | }, | ||
| 35 | // 重置页面列表 点击搜索条件时需要 | ||
| 36 | resetPage() { | ||
| 37 | this.setData({ | ||
| 38 | page: 1, | ||
| 39 | productList: [] | ||
| 40 | }) | ||
| 41 | }, | ||
| 42 | /** | ||
| 43 | * 请求产品 | ||
| 44 | */ | ||
| 45 | queryProduct() { | ||
| 46 | return new Promise((resolve, reject) => { | ||
| 47 | app.post({ | ||
| 48 | sid: false, | ||
| 49 | url: app.api.commodityList, | ||
| 50 | data: { | ||
| 51 | page: this.data.page, | ||
| 52 | size: this.data.size, | ||
| 53 | orderSort: this.data.orderSort, | ||
| 54 | key: this.data.keyWords, | ||
| 55 | // min:0, | ||
| 56 | // max:0, | ||
| 57 | }, | ||
| 58 | }).then((result) => { | ||
| 59 | let productList = result.list; | ||
| 60 | console.log("productList:", productList); | ||
| 61 | productList = this.data.productList.concat(productList); | ||
| 62 | this.setData({ | ||
| 63 | productList: productList, | ||
| 64 | total: result.total | ||
| 65 | }) | ||
| 66 | resolve(); | ||
| 67 | }) | ||
| 68 | }); | ||
| 69 | }, | ||
| 70 | |||
| 15 | /** | 71 | /** |
| 16 | * 显示礼物详情 | 72 | * 显示礼物详情 |
| 17 | */ | 73 | */ |
| 18 | onShowGiftDetailHandler() { | 74 | onShowGiftDetailHandler(evt) { |
| 75 | let curData = getBindtapData(evt); | ||
| 76 | app.globalData.giftInfo = curData; | ||
| 19 | app.router.push({ | 77 | app.router.push({ |
| 20 | path: "giftDetail" | 78 | path: "giftDetail" |
| 21 | }); | 79 | }); |
| 22 | }, | 80 | }, |
| 81 | |||
| 82 | /** | ||
| 83 | * 更换排序 | ||
| 84 | */ | ||
| 85 | onChangeFitterHandler(e) { | ||
| 86 | let orderSort = this.data.orderSort; | ||
| 87 | if (orderSort == 0) { | ||
| 88 | orderSort = 1; | ||
| 89 | } else { | ||
| 90 | orderSort = 0; | ||
| 91 | } | ||
| 92 | this.setData({ | ||
| 93 | orderSort | ||
| 94 | }) | ||
| 95 | this.queryProduct(); | ||
| 96 | }, | ||
| 97 | |||
| 98 | /** | ||
| 99 | * 手动查找产品 | ||
| 100 | */ | ||
| 101 | onSearchHandler(e) { | ||
| 102 | this.resetPage(); | ||
| 103 | this.queryProduct(); | ||
| 104 | }, | ||
| 105 | |||
| 106 | bindKeyWordsInput(e) { | ||
| 107 | this.setData({ | ||
| 108 | keyWords: e.detail.value | ||
| 109 | }) | ||
| 110 | this.onSearchHandler(); | ||
| 111 | }, | ||
| 112 | |||
| 23 | // 隐藏蒙层 | 113 | // 隐藏蒙层 |
| 24 | hideMask() { | 114 | hideMask() { |
| 25 | this.setData({ | 115 | this.setData({ | ... | ... |
| ... | @@ -93,14 +93,21 @@ $contentWidth:690px; | ... | @@ -93,14 +93,21 @@ $contentWidth:690px; |
| 93 | .image-wrap { | 93 | .image-wrap { |
| 94 | width: 200px; | 94 | width: 200px; |
| 95 | height: 200px; | 95 | height: 200px; |
| 96 | .img {} | 96 | border: solid 1px #f0f0f0; |
| 97 | border-radius: 8px; | ||
| 98 | @extend .fcc; | ||
| 99 | |||
| 100 | .image { | ||
| 101 | width: 180px; | ||
| 102 | height: 180px; | ||
| 103 | } | ||
| 97 | } | 104 | } |
| 98 | 105 | ||
| 99 | .cont { | 106 | .cont { |
| 100 | position: relative; | 107 | position: relative; |
| 101 | flex: 1; | 108 | flex: 1; |
| 102 | @extend .bb; | 109 | @extend .bb; |
| 103 | padding-left: 20px; | 110 | margin-left: 20px; |
| 104 | 111 | ||
| 105 | .name { | 112 | .name { |
| 106 | font-size: 32px; | 113 | font-size: 32px; | ... | ... |
| ... | @@ -5,12 +5,12 @@ | ... | @@ -5,12 +5,12 @@ |
| 5 | <view class="top"> | 5 | <view class="top"> |
| 6 | <div class="top-wrap"> | 6 | <div class="top-wrap"> |
| 7 | <view class="search"> | 7 | <view class="search"> |
| 8 | <input class="ipt" placeholder="输入关键字搜索" /> | 8 | <input class="ipt" value="{{keyWords}}" bindinput="bindKeyWordsInput" placeholder="输入关键字搜索" /> |
| 9 | <image class="icon" mode="aspectFit" src="../../image/icon/icon-search.png" /> | 9 | <image class="icon" mode="aspectFit" src="../../image/icon/icon-search.png" /> |
| 10 | </view> | 10 | </view> |
| 11 | <view class="filter"> | 11 | <view class="filter" bindtap="onChangeFitterHandler"> |
| 12 | 积分排序 | 12 | 积分排序 |
| 13 | <view wx:if="{{1>0}}" class="icon-wrap"> | 13 | <view wx:if="{{orderSort == 0}}" class="icon-wrap"> |
| 14 | <image class="icon up" src="../../image/icon/icon-filter-up-on.png" mode="widthFix" /> | 14 | <image class="icon up" src="../../image/icon/icon-filter-up-on.png" mode="widthFix" /> |
| 15 | <image class="icon down" src="../../image/icon/icon-filter-down.png" mode="widthFix" /> | 15 | <image class="icon down" src="../../image/icon/icon-filter-down.png" mode="widthFix" /> |
| 16 | </view> | 16 | </view> |
| ... | @@ -26,12 +26,12 @@ | ... | @@ -26,12 +26,12 @@ |
| 26 | <view class="product"> | 26 | <view class="product"> |
| 27 | <view class="product-item" wx:for="{{productList}}" wx:key="{{index}}"> | 27 | <view class="product-item" wx:for="{{productList}}" wx:key="{{index}}"> |
| 28 | <view class="image-wrap"> | 28 | <view class="image-wrap"> |
| 29 | <!-- <image /> --> | 29 | <image class="image" mode="aspectFit" src="{{item.commodityImages[0]}}" /> |
| 30 | </view> | 30 | </view> |
| 31 | <view class="cont"> | 31 | <view class="cont"> |
| 32 | <view class="name">某东购物卡200元</view> | 32 | <view class="name">{{item.commodityTitle}}</view> |
| 33 | <view class="desc">可在xx超市使用,可够买xxx可在xx超市使用,可够买xxx可在xx超市使用,可够买xxx</view> | 33 | <view class="desc">{{item.commodityBrief}}</view> |
| 34 | <view class="integral">消耗积分:3000分</view> | 34 | <view class="integral">消耗积分:{{item.commodityPrice}}分</view> |
| 35 | <view bindtap="onShowGiftDetailHandler" data-data="{{item}}" class="btn">查看</view> | 35 | <view bindtap="onShowGiftDetailHandler" data-data="{{item}}" class="btn">查看</view> |
| 36 | </view> | 36 | </view> |
| 37 | </view> | 37 | </view> | ... | ... |
| ... | @@ -100,6 +100,18 @@ Page({ | ... | @@ -100,6 +100,18 @@ Page({ |
| 100 | success(res) { | 100 | success(res) { |
| 101 | // 扫码结果 | 101 | // 扫码结果 |
| 102 | let result = res.result; | 102 | let result = res.result; |
| 103 | console.log("res:", res); | ||
| 104 | wx.showToast({ | ||
| 105 | title: "res:" + res.result, | ||
| 106 | icon: "none" | ||
| 107 | }) | ||
| 108 | }, | ||
| 109 | fail(err) { | ||
| 110 | console.log("err:", err); | ||
| 111 | wx.showToast({ | ||
| 112 | title: "err:" + res.result, | ||
| 113 | icon: "none" | ||
| 114 | }) | ||
| 103 | } | 115 | } |
| 104 | }) | 116 | }) |
| 105 | }, | 117 | }, | ... | ... |
| ... | @@ -133,6 +133,22 @@ function getBindtapData(evt, key = "data") { | ... | @@ -133,6 +133,22 @@ function getBindtapData(evt, key = "data") { |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | /** | 135 | /** |
| 136 | * 从数组中获取 key未value的对象 | ||
| 137 | * @param {*} value | ||
| 138 | * @param {*} key | ||
| 139 | * @param {*} list | ||
| 140 | */ | ||
| 141 | function getObjByListKeyValue(value, key, list) { | ||
| 142 | let result = null; | ||
| 143 | list.forEach(element => { | ||
| 144 | if (element[key + ""] == value) { | ||
| 145 | result = element; | ||
| 146 | } | ||
| 147 | }); | ||
| 148 | return result; | ||
| 149 | } | ||
| 150 | |||
| 151 | /** | ||
| 136 | * 获取小程序码 | 152 | * 获取小程序码 |
| 137 | * path = "/pages/index/index?pa=1" | 153 | * path = "/pages/index/index?pa=1" |
| 138 | * @param {*} path | 154 | * @param {*} path |
| ... | @@ -142,6 +158,7 @@ function wxacodeGet(path) { | ... | @@ -142,6 +158,7 @@ function wxacodeGet(path) { |
| 142 | } | 158 | } |
| 143 | 159 | ||
| 144 | 160 | ||
| 161 | |||
| 145 | /** | 162 | /** |
| 146 | * @desc 函数防抖 | 163 | * @desc 函数防抖 |
| 147 | * @param func 函数 | 164 | * @param func 函数 |
| ... | @@ -215,4 +232,5 @@ module.exports = { | ... | @@ -215,4 +232,5 @@ module.exports = { |
| 215 | formatWeek: formatWeek, | 232 | formatWeek: formatWeek, |
| 216 | getBindtapData: getBindtapData, | 233 | getBindtapData: getBindtapData, |
| 217 | wxacodeGet: wxacodeGet, | 234 | wxacodeGet: wxacodeGet, |
| 235 | getObjByListKeyValue: getObjByListKeyValue | ||
| 218 | } | 236 | } | ... | ... |
-
Please register or sign in to post a comment