| | |
| | | <view class="container"> |
| | | <view class="tab"> |
| | | <t-tabs |
| | | t-class="t-tabs" |
| | |
| | | <t-tab-panel label="电子样书" value="1" /> |
| | | </t-tabs> |
| | | </view> |
| | | <view class="content"> |
| | | <view class="bookListBox"> |
| | | <view class="tips"> |
| | | <rich-text space="emsp" nodes="{{description}}" class="content" /> |
| | | <rich-text space="emsp" nodes="{{description}}" /> |
| | | </view> |
| | | <view class="bookList"> |
| | | <view wx:if="{{bookList.length > 0}}"> |
| | |
| | | > |
| | | <button class="submit" bindtap="submit">提交</button> |
| | | </view> |
| | | </view> |
| | | </view> |
| | |
| | | page { |
| | | overflow-y: auto !important; |
| | | /* overflow-y: auto !important; */ |
| | | position: relative; |
| | | background-color: #F2F3F8 !important; |
| | | } |
| | | |
| | | .container { |
| | | width: 100vw; |
| | | height: 100vh; |
| | | } |
| | | |
| | | .content { |
| | | width: 100%; |
| | | height: 100%; |
| | | height: calc(100vh - env(safe-area-inset-bottom) - 100rpx); |
| | | box-sizing: border-box; |
| | | margin-top: 96rpx; |
| | | overflow-y: auto !important; |
| | | } |
| | | |
| | | |
| | |
| | | width: 100%; |
| | | } |
| | | |
| | | .content { |
| | | box-sizing: border-box; |
| | | height: calc(100vh - env(safe-area-inset-bottom) - 96rpx); |
| | | } |
| | | |
| | | .t-tabs__track { |
| | | display: none; |
| | | |
| | |
| | | position: fixed !important; |
| | | top: 0; |
| | | left: 0; |
| | | padding-top: 20rpx; |
| | | z-index: 10; |
| | | margin-top: 20rpx; |
| | | /* background-color: #F2F3F8 !important; */ |
| | | |
| | | } |
| | | |
| | | .tab-bg { |
| | | height: 20rpx; |
| | | background-color: #F2F3F8 !important; |
| | | } |
| | | |
| | | .t-tabs { |
| | | background: none !important; |
| | | width: 100%; |
| | | z-index: 1 |
| | | } |
| | | |
| | | .t-tabs__wrapper { |
| | |
| | | background: #fff; |
| | | min-height: 200rpx; |
| | | border-radius: 10rpx; |
| | | padding: 180rpx 40rpx 40rpx 40rpx; |
| | | padding: 40rpx; |
| | | } |
| | | |
| | | .tips { |
| | |
| | | success(res) { |
| | | console.log(res); |
| | | if (res.errMsg == "scanCode:ok" && res.path || res.result) { |
| | | if (res.path) { |
| | | let path = res.path || res.result |
| | | wx.redirectTo({ |
| | | url: '/' + path, |
| | | }) |
| | | } else { |
| | | wx.redirectTo({ |
| | | url: '/pages/index/scanResult/index?result=' + res.result, |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | }) |
New file |
| | |
| | | // pages/index/scanResult/index.js |
| | | const app = getApp() |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | textValue: "领取", |
| | | rules: null, |
| | | result: null, |
| | | productInfo: [], |
| | | couponList: [], |
| | | isOther: false, |
| | | activeCodeAndStoreChannelLinks: [], |
| | | activeInfo: null, |
| | | description: "" |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | try { |
| | | const result = JSON.parse(options.result) |
| | | if (result && result.type) { |
| | | this.setData({ |
| | | result, |
| | | textValue: result.type == "PromoteCode" ? '领取' : '激活' |
| | | }) |
| | | this.getRules(); |
| | | this.getProductByCode(); |
| | | } else { |
| | | this.setData({ |
| | | isOther: true |
| | | }) |
| | | } |
| | | } catch (error) { |
| | | this.setData({ |
| | | isOther: true |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | // 激活码规则 |
| | | getRules() { |
| | | let query = { |
| | | path: app.config.refCodes.learnPlatform.exchangeRules, |
| | | storeInfo: app.config.learnPlatformGoodsStore, |
| | | repositoryInfo: app.config.learnPlatformGoodsStore, |
| | | paging: { |
| | | start: 0, |
| | | size: 9999 |
| | | }, |
| | | fields: { |
| | | tourism_content: [] |
| | | }, |
| | | }; |
| | | app.MG.resource.getItem(query).then((res) => { |
| | | try { |
| | | // const ruleData = res.datas.find(e => e.refCode == 'tourism_exchangeRules') |
| | | this.setData({ |
| | | rules: this.data.result.type == "ActivationCode" ? res.datas.find(e => e.refCode == 'tourism_activationCodeCollectionRules') : res.datas.find(e => e.refCode == 'tourism_couponCollectionRules') |
| | | }) |
| | | } catch (error) { |
| | | console.log(error) |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 激活码激活 |
| | | useActiveCode() { |
| | | var that = this; |
| | | if (that.data.result && that.data.result.type == "ActivationCode") { |
| | | const activeInfo = that.data.activeInfo |
| | | const activeCodeAndStoreChannelLinks = that.data.activeCodeAndStoreChannelLinks |
| | | if ((!activeInfo || activeInfo.productIds.length == 0) && activeCodeAndStoreChannelLinks.length > 0) { |
| | | wx.showModal({ |
| | | title: '温馨提示', |
| | | content: '请选择足够数量的可选商品!', |
| | | showCancel: false |
| | | }) |
| | | return false |
| | | } |
| | | app.MG.store |
| | | .userActiveCode({ |
| | | code: that.data.result.code, |
| | | cardNum: that.data.result.cardNum, |
| | | apiActiveCodeSelectProductRequests: this.data.activeInfo ? [this.data.activeInfo] : [] |
| | | }) |
| | | .then(res => { |
| | | wx.showModal({ |
| | | title: '温馨提示', |
| | | content: res, |
| | | showCancel: false |
| | | }) |
| | | setTimeout(() => { |
| | | wx.navigateTo({ |
| | | url: '/pages/codeRecord/index', |
| | | }) |
| | | }, 2500); |
| | | }); |
| | | } else { |
| | | let that = this; |
| | | const data = { |
| | | refCodeOrGuids: [that.data.result.guid], |
| | | }; |
| | | app.MG.store.getPromoteCode(data).then(res => { |
| | | let message = ""; |
| | | let icon = "successe" |
| | | if (res == "-5") { |
| | | message = "领取失败,优惠券已过期!"; |
| | | icon = "fail" |
| | | } else if (res == "-7") { |
| | | message = "抱歉,优惠券已经领取完毕!"; |
| | | icon = "fail" |
| | | } else if (res == "-1") { |
| | | message = "领取失败,系统错误!"; |
| | | icon = "fail" |
| | | } else if (res == "-2") { |
| | | message = "抱歉,优惠券已经领取完毕!"; |
| | | icon = "fail" |
| | | } else if (res == "-3") { |
| | | message = "领取失败,优惠券无效!"; |
| | | icon = "fail" |
| | | } else if (res == "-4") { |
| | | message = "领取失败,优惠券无效!"; |
| | | icon = "fail" |
| | | } else if (res == "-6") { |
| | | message = "领取失败,领取状态异常!"; |
| | | icon = "fail" |
| | | } else if (res == "1") { |
| | | message = "领取成功!"; |
| | | } |
| | | wx.showModal({ |
| | | title: '温馨提示', |
| | | content: message, |
| | | showCancel: false, |
| | | success(res) { |
| | | if (res.confirm) { |
| | | setTimeout(() => { |
| | | wx.navigateBack() |
| | | }, 2500); |
| | | } |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 根据code获取商品信息 |
| | | getProductByCode() { |
| | | var that = this; |
| | | if (that.data.result && that.data.result.type == "ActivationCode") { |
| | | app.MG.store |
| | | .getActiveCode({ |
| | | code: that.data.result.code, |
| | | cardNum: that.data.result.cardNum, |
| | | }) |
| | | .then(res => { |
| | | try { |
| | | const list = JSON.parse(res.config); |
| | | if (this.data.result) { |
| | | this.getProductListById(list); |
| | | } |
| | | if (res?.activeCodeAndStoreChannelLinks) { |
| | | this.setData({ |
| | | description: res.description, |
| | | activeCodeAndStoreChannelLinks: res.activeCodeAndStoreChannelLinks |
| | | }) |
| | | } |
| | | } catch (error) { |
| | | this.setData({ |
| | | isOther: true |
| | | }) |
| | | } |
| | | }); |
| | | } else { |
| | | if (this.data.result != null) { |
| | | const data = { |
| | | refCodeOrGuids: [that.data.result.guid], |
| | | }; |
| | | app.MG.store.getPromoteCodeDetail(data).then(res => { |
| | | if (res && that.data.result) { |
| | | res.map(item => { |
| | | if (item.start) { |
| | | item.start ? item.start = item.start.split("T")[0] : new Date() |
| | | } |
| | | if (item.end) { |
| | | item.end ? item.end = item.end.split("T")[0] : new Date() |
| | | } |
| | | }) |
| | | this.setData({ |
| | | couponList: res |
| | | }) |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | //根据id进行夸库查询商品 |
| | | getProductListById(ids) { |
| | | let that = this; |
| | | app.MG.store |
| | | .getProductList({ |
| | | queryType: "*", |
| | | subAccess: [{ |
| | | StoreRefCode: app.config.learnPlatformGoodsStore, // 默认商品库 |
| | | Path: "", |
| | | Type: "*", |
| | | }, ], |
| | | sort: { |
| | | CreateDate: "Desc", |
| | | }, |
| | | fields: { |
| | | tourism_author: [], |
| | | tourism_paperPrice: [], |
| | | tourism_publicationDate: [], |
| | | tourism_ISBN: [], |
| | | "Id=": ids.map(item => item.id + ""), |
| | | }, |
| | | paging: { |
| | | start: 0, |
| | | size: 9999, |
| | | }, |
| | | coverSize: { |
| | | width: 215, |
| | | }, |
| | | }) |
| | | .then(res => { |
| | | res.datas.map(item => { |
| | | item.price ? item.price = (item.price).toFixed(2) : ""; |
| | | item.oldPrice ? item.oldPrice = (item.oldPrice).toFixed(2) : ""; |
| | | }) |
| | | that.setData({ |
| | | productInfo: res.datas |
| | | }) |
| | | }); |
| | | }, |
| | | |
| | | // 跳转到商品选择页面 |
| | | selectPage(e) { |
| | | const { |
| | | info |
| | | } = e.currentTarget.dataset |
| | | wx.navigateTo({ |
| | | url: '/pages/scanResult/selectPage/index?info=' + JSON.stringify(info) + '&result=' + JSON.stringify(this.data.result), |
| | | }) |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { |
| | | |
| | | }, |
| | | }) |
New file |
| | |
| | | { |
| | | "usingComponents": { |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-empty": "tdesign-miniprogram/empty/empty", |
| | | "t-cell": "tdesign-miniprogram/cell/cell" |
| | | } |
| | | } |
New file |
| | |
| | | <!--pages/index/scanResult/index.wxml--> |
| | | <view class="content" wx:if="{{!isOther}}"> |
| | | <view class="productWall" wx:if="{{productInfo.length > 0}}"> |
| | | <view class="product" wx:for="{{productInfo}}" wx:for-item="item" wx:for-index="index" wx:key="index"> |
| | | <view class="productImg"> |
| | | <image class="icon" src="{{item.icon}}" mode="aspectFit" /> |
| | | </view> |
| | | <view class="productInfo"> |
| | | <text wx:if="{{item.name}}" class="publicCss">{{ item.name }}</text> |
| | | <text wx:if="{{item.tourism_ISBN}}" class="publicCss">ISBN:{{ item.tourism_ISBN }}</text> |
| | | <text wx:if="{{item.tourism_author}}" class="publicCss">作者:{{ item.tourism_author }}</text> |
| | | <text wx:if="{{item.price}}" class="publicCss">价格:<text style="color:red">¥{{ item.price }}</text></text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="selectCard" wx:if="{{activeCodeAndStoreChannelLinks.length>0}}"> |
| | | <t-cell title="{{description?description:'选择激活商品'}}" bordered="{{false}}" bindtap="selectPage" description="{{activeInfo && activeInfo.productIds.length>0?'已选择'+ activeInfo.productIds.length +'件商品':''}}" data-info="{{activeCodeAndStoreChannelLinks}}" arrow /> |
| | | </view> |
| | | <view class="couponWall" wx:if="{{couponList.length > 0}}"> |
| | | <view class="coupon" wx:for="{{couponList}}" wx:for-item="item" wx:for-index="index" wx:key="index"> |
| | | <image class="couponIcon" src="/static/images/web/coupon.png" mode="aspectFit" /> |
| | | <view class="price">¥{{ item.value }}元</view> |
| | | <view class="couponInfo"> |
| | | <text>{{ item.name }}</text> |
| | | <text class="timer">{{ |
| | | item.isForAllProduct ? "全场可用" : "仅可购买指定商品" |
| | | }}</text> |
| | | <view class="timer"> |
| | | <text>{{ item.start }}</text> |
| | | <text>~</text> |
| | | <text>{{ item.end }}</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <view class="button-example" wx:if="{{productInfo.length > 0 || couponList.length > 0}}"> |
| | | <t-button theme="danger" bindtap="useActiveCode" size="large" block>{{textValue}}</t-button> |
| | | </view> |
| | | <view class="text"> |
| | | <rich-text space="emsp" nodes="{{rules.tourism_content}}" /> |
| | | </view> |
| | | </view> |
| | | <view wx:else class="empyt"> |
| | | <t-empty icon="error-circle" description="请扫描正确的二维码" /> |
| | | </view> |
New file |
| | |
| | | /* pages/index/scanResult/index.wxss */ |
| | | .content { |
| | | width: 100vw; |
| | | height: calc(100vh - env(safe-area-inset-bottom)); |
| | | overflow: auto; |
| | | } |
| | | |
| | | .empyt { |
| | | width: 100vw; |
| | | height: calc(100vh - env(safe-area-inset-bottom)); |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: flex-start; |
| | | padding-top: 200rpx; |
| | | margin: auto; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .text { |
| | | padding: 10rpx 20rpx; |
| | | box-sizing: border-box; |
| | | font-size: 28rpx; |
| | | line-height: 50rpx; |
| | | } |
| | | |
| | | .button-example { |
| | | width: 100%; |
| | | padding: 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .button-example:not(:last-child) { |
| | | margin-bottom: 32rpx; |
| | | } |
| | | |
| | | |
| | | |
| | | .coupon { |
| | | width: 650rpx; |
| | | height: 180rpx; |
| | | margin: auto; |
| | | display: flex; |
| | | justify-content: flex-start; |
| | | align-items: center; |
| | | background-color: #f0434304; |
| | | margin-bottom: 20px; |
| | | position: relative; |
| | | } |
| | | |
| | | .couponIcon { |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | width: 650rpx; |
| | | height: 180rpx; |
| | | } |
| | | |
| | | .price { |
| | | width: 40%; |
| | | height: 100%; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | font-size: 36rpx; |
| | | color: #f04343; |
| | | border-right: 1px dashed #e95c5cc7; |
| | | padding-left: 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .timer { |
| | | font-size: 26rpx; |
| | | } |
| | | |
| | | .couponInfo { |
| | | width: 60%; |
| | | height: 80%; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: space-around; |
| | | align-items: flex-start; |
| | | padding-left: 20rpx; |
| | | box-sizing: border-box; |
| | | font-size: 30rpx; |
| | | color: #f04343; |
| | | } |
| | | |
| | | .couponIcon { |
| | | max-width: 100%; |
| | | height: 100%; |
| | | } |
| | | |
| | | .productWall, |
| | | .couponWall { |
| | | max-height: 600rpx; |
| | | overflow-y: auto; |
| | | padding: 0 12rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .productWall { |
| | | height: 400rpx; |
| | | } |
| | | |
| | | .selectCard { |
| | | border-top: 1rpx solid #eee; |
| | | border-bottom: 1rpx solid #eee; |
| | | } |
| | | |
| | | .product { |
| | | display: flex; |
| | | justify-content: flex-start; |
| | | align-items: center; |
| | | padding: 20rpx; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .icon { |
| | | width: 250rpx; |
| | | height: 200rpx; |
| | | border: 1rpx solid #eee; |
| | | } |
| | | |
| | | .productInfo { |
| | | min-height: 200rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | justify-content: flex-start; |
| | | align-items: flex-start; |
| | | margin-left: 20rpx; |
| | | } |
| | | |
| | | .publicCss { |
| | | font-size: 28rpx; |
| | | padding: 10rpx 0; |
| | | } |
New file |
| | |
| | | // pages/index/scanResult/selectPage/index.js |
| | | const app = getApp() |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | options: { |
| | | styleIsolation: 'apply-shared', |
| | | }, |
| | | value: [], |
| | | optionsData: [], |
| | | currentPath: "", |
| | | currentResult: null, |
| | | selectNum: 0, |
| | | allowSelectNum: 0, |
| | | storeId: "", |
| | | storeChannelId: "", |
| | | productIds: [], |
| | | // 加载参数 |
| | | triggered: false, |
| | | bottomLoading: false, |
| | | skeletonLoding: true, |
| | | isNoData: false, |
| | | |
| | | // 返回顶部 |
| | | isBackTop: false, |
| | | setScrollValue: 0, |
| | | |
| | | //分页 |
| | | pageSize: 1, |
| | | pageLimit: 10, |
| | | pageTotalCount: 0, |
| | | isMoreData: false |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | if (options && options.info && options.result) { |
| | | const info = JSON.parse(options.info) |
| | | if (info && info.length > 0) { |
| | | const { |
| | | store, |
| | | storeChannel, |
| | | allowSelectProductCount |
| | | } = info[0] |
| | | this.setData({ |
| | | currentPath: store.refCode + "\\" + storeChannel.refCode, |
| | | storeId: store.id, |
| | | storeChannelId: storeChannel.id, |
| | | allowSelectNum: allowSelectProductCount, |
| | | currentResult: options.result |
| | | }) |
| | | this.getProductList() |
| | | } |
| | | } |
| | | }, |
| | | |
| | | onChange(e) { |
| | | const { |
| | | value |
| | | } = e.detail |
| | | const arr = [] |
| | | if (value.length > this.data.allowSelectNum) { |
| | | return false |
| | | } |
| | | if (value && value.length) { |
| | | for (let index = 0; index < value.length; index++) { |
| | | const item = value[index]; |
| | | arr.push(this.data.optionsData[item]?.id) |
| | | } |
| | | } |
| | | this.setData({ |
| | | productIds: arr, |
| | | selectNum: arr.length, |
| | | value: value |
| | | }); |
| | | }, |
| | | |
| | | activeCode() { |
| | | const activeInfo = { |
| | | storeId: this.data.storeId, |
| | | storeChannelId: this.data.storeChannelId, |
| | | productIds: this.data.productIds |
| | | } |
| | | if (this.data.productIds.length < this.data.allowSelectNum) { |
| | | wx.showModal({ |
| | | title: '温馨提示', |
| | | content: '请选择足够数量的可选商品!', |
| | | showCancel: false |
| | | }) |
| | | return false |
| | | } |
| | | let pages = getCurrentPages(); |
| | | let prevPage = pages[pages.length - 2]; |
| | | prevPage.setData({ |
| | | activeInfo |
| | | }) |
| | | wx.navigateBack({ |
| | | delta: 1 |
| | | }) |
| | | }, |
| | | |
| | | // 获取列表 |
| | | getProductList(isReachBottom) { |
| | | app.MG.store |
| | | .getProductList({ |
| | | storeInfo: app.config.learnPlatformGoodsStore, |
| | | path: this.data.currentPath, |
| | | paging: { |
| | | start: (this.data.pageSize - 1) * this.data.pageLimit, |
| | | size: this.data.pageLimit, |
| | | }, |
| | | fields: { |
| | | tourism_paperPrice: [], |
| | | tourism_productDescription: [], |
| | | tourism_content: [] |
| | | }, |
| | | coverSize: { |
| | | height: 400 |
| | | } |
| | | }) |
| | | .then(res => { |
| | | try { |
| | | res.datas.map(item => { |
| | | item.price ? item.price = (item.price).toFixed(2) : ""; |
| | | item.oldPrice ? item.oldPrice = (item.oldPrice).toFixed(2) : ""; |
| | | item.tourism_paperPrice ? item.tourism_paperPrice = (item.tourism_paperPrice).toFixed(2) : ""; |
| | | }) |
| | | let list = res.datas; |
| | | //触底加载新数据并保留老数据 |
| | | if (isReachBottom) { |
| | | list = [...this.data.optionsData, ...list] //将新数据加入老数据中 |
| | | } |
| | | this.setData({ |
| | | optionsData: list, |
| | | pageTotalCount: res.total, |
| | | skeletonLoding: false |
| | | }) |
| | | } catch (error) { |
| | | console.log(error) |
| | | } |
| | | }); |
| | | }, |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | this.setData({ |
| | | pageSize: 1, |
| | | bottomLoading: false, |
| | | isMoreData: false, |
| | | isNoData: true |
| | | }) |
| | | if (this._freshing) return |
| | | this._freshing = true; |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | triggered: false, |
| | | isNoData: false |
| | | }) |
| | | this._freshing = false |
| | | this.getProductList(); |
| | | }, 500) |
| | | }, |
| | | |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { |
| | | if (this.data.pageTotalCount > this.data.optionsData.length) { |
| | | this.setData({ |
| | | pageSize: this.data.pageSize + 1, |
| | | bottomLoading: true, |
| | | isMoreData: false |
| | | }) |
| | | } else { |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | bottomLoading: false, |
| | | isMoreData: true |
| | | }) |
| | | }, 500) |
| | | return false; |
| | | } |
| | | this.getProductList(true); |
| | | }, |
| | | |
| | | // 监听滚动距离 |
| | | onPageScroll(e) { |
| | | if (e.detail.scrollTop >= 1000) { |
| | | this.setData({ |
| | | isBackTop: true |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | isBackTop: false |
| | | }) |
| | | } |
| | | }, |
| | | |
| | | // 返回顶部 |
| | | onToTop() { |
| | | this.setData({ |
| | | setScrollValue: 0 |
| | | }) |
| | | }, |
| | | |
| | | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | } |
| | | }) |
New file |
| | |
| | | { |
| | | "usingComponents": { |
| | | "t-checkbox": "tdesign-miniprogram/checkbox/checkbox", |
| | | "t-checkbox-group": "tdesign-miniprogram/checkbox-group/checkbox-group", |
| | | "t-icon": "tdesign-miniprogram/icon/icon", |
| | | "t-loading": "tdesign-miniprogram/loading/loading", |
| | | "t-back-top": "tdesign-miniprogram/back-top/back-top", |
| | | "t-empty": "tdesign-miniprogram/empty/empty" |
| | | } |
| | | } |
New file |
| | |
| | | <!-- <view class="container" wx:if="{{!skeletonLoding}}"> --> |
| | | <view class="container"> |
| | | <scroll-view scroll-y class="content" style="{{allChecked || isMoreDel?'padding-top: 4vh':''}}" refresher-enabled="{{true}}" refresher-threshold="{{80}}" refresher-default-style="none" refresher-triggered="{{triggered}}" bind:scroll="onPageScroll" model:scroll-top="{{setScrollValue}}" bindrefresherpulling="{{refresh.onPulling}}" bindrefresherrefresh="onPullDownRefresh" bindscrolltolower="onReachBottom"> |
| | | <view slot="refresher" class="refresh-container"> |
| | | <view class="loading"> |
| | | <t-loading theme="circular" size="40rpx" text="正在刷新..." class="wrapper" /> |
| | | </view> |
| | | </view> |
| | | <view class="pageInfo"> |
| | | <t-checkbox-group value="{{value}}" bind:change="onChange"> |
| | | <view wx:for="{{optionsData}}" wx:key="index" class="card {{_.contain(value, index) ? 'card--active' : value.indexOf(index)}}"> |
| | | <image class="iconStyle" src="{{item.icon}}" mode="aspectFill" /> |
| | | <t-icon wx:if="{{_.contain(value, index)}}" name="check" t-class="card__icon" ariaHidden="{{true}}" /> |
| | | <t-checkbox value="{{index}}" label="{{item.name}}" content="{{item.description}}" borderless /> |
| | | </view> |
| | | </t-checkbox-group> |
| | | <view wx:if="{{!isNodata && cartList.length == 0}}" class="empyt"> |
| | | <t-empty icon="folder-open" description="暂无数据" /> |
| | | </view> |
| | | <view class="bottom-loading" wx:if="{{bottomLoading}}"> |
| | | <t-loading theme="circular" size="40rpx" text="加载中..." class="wrapper" /> |
| | | </view> |
| | | <view class="bottom-loading" style="color: #ccc;font-size: 28rpx;" wx:if="{{isMoreData}}"> |
| | | <text>没有更多了</text> |
| | | </view> |
| | | </view> |
| | | </scroll-view> |
| | | <t-back-top theme="round" wx:if="{{isBackTop}}" class="backTop" text="顶部" bind:to-top="onToTop"></t-back-top> |
| | | <view class="select_tabbar"> |
| | | <view class="cssPublic"> |
| | | <view class="tabItams"> |
| | | <text>最多可选 : </text> |
| | | <text><text style="color: red;">{{allowSelectNum}}</text> 件</text> |
| | | </view> |
| | | <view class="tabItams"> |
| | | <text>已选 : </text> |
| | | <text><text style="color: #0052d9;">{{selectNum}} </text>件</text> |
| | | </view> |
| | | </view> |
| | | <view class="activeCode" bindtap="activeCode"> |
| | | <text>前往激活</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 骨架屏 --> |
| | | <!-- <import src="./index.skeleton.wxml" /> |
| | | <template is="skeleton" wx:if="{{skeletonLoding}}"></template> --> |
| | | |
| | | |
| | | <wxs module="refresh"> |
| | | module.exports = { |
| | | onPulling: function (evt, instance) { |
| | | var p = Math.min(evt.detail.dy / 80, 1) |
| | | var view = instance.selectComponent('.refresh-container') |
| | | view.setStyle({ |
| | | opacity: p, |
| | | transform: "scale(" + p + ")" |
| | | }) |
| | | }, |
| | | wxsFunction: function (event, ownerInstance) { |
| | | var img = instance.selectComponent('#image') |
| | | return img; |
| | | }, |
| | | } |
| | | |
| | | </wxs> |
| | | <wxs module="_"> |
| | | module.exports.contain = function (arr, key) { if (arr && arr.length > 0) return arr.indexOf(key) > -1 } |
| | | </wxs> |
New file |
| | |
| | | /* pages/index/scanResult/selectPage/index.wxss */ |
| | | .container { |
| | | width: 100vw; |
| | | height: 100%; |
| | | position: relative; |
| | | } |
| | | |
| | | |
| | | .refresh-container { |
| | | display: block; |
| | | width: 100vw; |
| | | } |
| | | |
| | | .loading { |
| | | display: block; |
| | | width: 100%; |
| | | height: 180rpx; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | |
| | | .bottom-loading { |
| | | width: 100vw; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | height: 100rpx; |
| | | } |
| | | |
| | | .content { |
| | | height: calc(100vh - env(safe-area-inset-bottom) - 100rpx); |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .empyt { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | padding: 20rpx; |
| | | margin: auto; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .oldPrice { |
| | | text-decoration: line-through; |
| | | font-size: 20rpx; |
| | | color: #999; |
| | | } |
| | | |
| | | .price { |
| | | color: red !important; |
| | | } |
| | | |
| | | .freePrice { |
| | | color: rgb(49, 231, 43) !important; |
| | | font-size: 26rpx; |
| | | } |
| | | |
| | | .card { |
| | | position: relative; |
| | | margin: 32rpx; |
| | | border-radius: 12rpx; |
| | | overflow: hidden; |
| | | box-sizing: border-box; |
| | | border: 3rpx solid #eee; |
| | | } |
| | | |
| | | .card--active { |
| | | border-color: #0052d9; |
| | | } |
| | | |
| | | .card--active::after { |
| | | content: ''; |
| | | display: block; |
| | | position: absolute; |
| | | left: 0; |
| | | top: 0; |
| | | width: 0; |
| | | border: 14px solid #0052d9; |
| | | border-bottom-color: transparent; |
| | | border-right-color: transparent; |
| | | } |
| | | |
| | | .card__icon { |
| | | color: #fff; |
| | | position: absolute; |
| | | left: 1.5px; |
| | | top: 1.5px; |
| | | z-index: 1; |
| | | } |
| | | |
| | | .iconStyle { |
| | | width: 100%; |
| | | } |
| | | |
| | | .select_tabbar { |
| | | width: 100vw; |
| | | height: 100rpx; |
| | | background-color: #fff; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | font-size: 24rpx; |
| | | position: fixed; |
| | | left: 0; |
| | | bottom: 0; |
| | | padding-bottom: env(safe-area-inset-bottom); |
| | | border-top: 1rpx solid #eee; |
| | | } |
| | | |
| | | .select_tabbar .cssPublic { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | .select_tabbar .tabItams { |
| | | font-size: 28rpx; |
| | | margin-left: 30rpx; |
| | | } |
| | | |
| | | .select_tabbar .activeCode { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | width: 200rpx; |
| | | height: 100rpx; |
| | | background-color: #d54941; |
| | | color: #fff; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .t-back-top--fixed { |
| | | bottom: 15vh !important; |
| | | } |