From 5182d76aa05649ec678157f0951cf580bff7a79c Mon Sep 17 00:00:00 2001 From: gooking Date: Sat, 9 Jan 2021 21:47:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=88=E6=88=90=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 1 + config.js | 4 +- images/notice.png | Bin 4874 -> 0 bytes miniprogram_npm/apifm-wxapi/index.js | 4 +- pages/coupons/merge.js | 99 +++++++++++++++++++++++++++ pages/coupons/merge.json | 4 ++ pages/coupons/merge.wxml | 15 ++++ pages/coupons/merge.wxss | 1 + pages/index/index.js | 6 ++ pages/index/index.json | 5 +- pages/index/index.wxml | 31 ++++----- pages/index/index.wxss | 58 ++-------------- pages/my/index.wxml | 3 +- pages/search/index.json | 2 +- project.config.json | 2 +- 15 files changed, 159 insertions(+), 76 deletions(-) delete mode 100644 images/notice.png create mode 100644 pages/coupons/merge.js create mode 100644 pages/coupons/merge.json create mode 100644 pages/coupons/merge.wxml create mode 100644 pages/coupons/merge.wxss diff --git a/app.json b/app.json index 1a8d3f51..7d96b837 100644 --- a/app.json +++ b/app.json @@ -32,6 +32,7 @@ "pages/fx/members", "pages/fx/commisionLog", "pages/coupons/index", + "pages/coupons/merge", "pages/invoice/list", "pages/invoice/apply", "pages/deposit/pay", diff --git a/config.js b/config.js index 5d4ec533..2058adcc 100644 --- a/config.js +++ b/config.js @@ -1,6 +1,6 @@ module.exports = { - version: '9.14.1', - note: '增加商品浏览足迹', // 这个为版本描述,无需修改 + version: '9.15.0', + note: '增加合成优惠券功能', // 这个为版本描述,无需修改 subDomain: 'tz', // 此处改成你自己的专属域名。什么是专属域名?请看教程 https://www.it120.cc/help/qr6l4m.html sdkAppID: 1400450467, // 腾讯实时音视频应用编号,请看教程 https://www.it120.cc/help/nxoqsl.html } \ No newline at end of file diff --git a/images/notice.png b/images/notice.png deleted file mode 100644 index 2cd80c92e6e58fb0d67b61d042618847849519ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4874 zcmeHL_ct4G*H0oTQdKne3N>QaUZpXMsuio$-ip?YEn=s3wN;8n&Df(xZKbHTv{tEA zK~)iI?hHtu>YNo-qn|Z#;92OA+U0u^{4JjZ#o;p&HE{C4GZk#CxzpvK-+CQwxj8ScU zCd{oZ+FXpEF#ZCAdy`@%2m=;Zfpp-}Z_H5Y8$YE@G$2(=bGaRT3I-eYY?@}WMd`~2 z9F${xFq4J3uQfR;r+&WSXz5+op!xYolHFxw*J0QK>GY`MRbC$Bb{fYhhzTx01DF?0=M8h0Z!%#2qaRe&)q;e9|Y#h_xZd|2cgnQVEN+l z5rx6@jio%`ECc}m(7jds5)7qF4}LFMp#g)#IUQw6Sq*_8219w*z(f$ZNF#YwhA4zY zF8%pfNo$P31SEcY?RuLm>h@gr1P_^$Rx)QSxfB3QDrIj_(gcFO^Jx3$?2twMkCb2) zelim%;jz4@WanFjoTLc-X#Bf;c5m;k1()K#20rVXa9zTXRk@JSLeq-pe%m3=ULM2F z#I3`9qkmz~?9mEe4i8+nY>=%SLC1xAN=vHpu>b9ne~8uf2lr{JtO`_jXZ^J$Dzngk zv%$=|%V3sH6^Fd7Ey`~*H`4->DmZo-Q1Bl@Mc-r#Q)wh3!f}#COQ*p*ZtS~)24}q5 za#T7T6WLCcm|r_W>qkzY(S z2bhmwpPW{LyaA;QGYx2&Flr~DCLaH;c(;%^se(=~3zbxj1x+IB-dI4su9g~fsYPzb z{Gmf-U;jlfg0o7tF^xVZqP7*|2Jf5e6<;7bl_cqlvFtGN z(|dh3xe|Br60lMopEVUaKNR|{g901YyH|v3yJ|+NzE$_ziAo3dP6;t7jDQ*9*49E0 zOf%$2ayNEWnE>D#6gkbG|N4x^DI&0Wjxs-ln8xBU&K;iSM@J)%7cvWW+71v!d<1r$ z%;|FV5jA|_O7E{EQhY`}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z>J$Y$gIPD0?D_XESx0zpps2Zu`jqRvDygp)acqc6r)<694vV^g-^1$;wDgMH znbZEajdS#+<&Gw7pMNBRT5lgH5ElG6&Mis5k^~*6+{gM_+pzBq%?@yjRu!fAlg{vW zOef`A_Trq^b>O|rO&8Y+|J{PuNK0AnM;f17kv}@k$?J_C|5~|G!fGxB&ue9BWl15| z?`FKjyhc6p8=MnB@}f&~&}|q>&PBVnjIc$VXP^{LNQ9^9xFD6ZfnBpjMhfjJ3Pont zgj#5C#$ZH^Ds4G_P-i^WWb|zfHq*x~QX>q6pB#j@m*sy^w2A7fHVN@*W!pR>1$7q| zj97SbClhW0Tak6-_NLKEykj3ei(8CET!bF1G@$JQ_uOlDE7!XG2d3wYj=iZSn?392 z#!}9nUssV~47?5Uqwim@4x``*XUB>ZLfPbP&AJ|xP1avb$F*z@e99H|>9FmahS(eC z4BU#|B2|p5a+T_W>JvSC4n<1Nw=}BGcrz(B{!|515?Q9V6v=H*{-oPSZI}MMnNN

e&QG}W~O6IE)qsvF5fdFrPzw7?`@ae13djEsek8r z&G^NvGaHyMHq;;8vR8q5$jN&JwKgZwBFim3h!@|z*~tv!;n!8Abrfw=ScCRp!q6L zi1q8tb>h`HUsBrAvXr0-8KLN%ky}6%&XEqx$g{_sUw7HkCC7x}LCVyH@Go;qaUhul z#4B#$Sl@Li?E89u@E6qhAp!Y>r_%~DaBlZnmp-Z09`Eu&1!Xf?0*2yg8AwI diff --git a/miniprogram_npm/apifm-wxapi/index.js b/miniprogram_npm/apifm-wxapi/index.js index 9bde205d..45ca77c0 100644 --- a/miniprogram_npm/apifm-wxapi/index.js +++ b/miniprogram_npm/apifm-wxapi/index.js @@ -94,8 +94,8 @@ module.exports = /* eslint-disable */ // 小程序开发api接口工具包,https://github.com/gooking/wxapi -var API_BASE_URL = 'https://api.it120.cc'; -// var API_BASE_URL = 'http://127.0.0.1:8081'; +// var API_BASE_URL = 'https://api.it120.cc'; +var API_BASE_URL = 'http://127.0.0.1:8081'; var subDomain = '-'; var request = function request(url, needSubDomain, method, data) { diff --git a/pages/coupons/merge.js b/pages/coupons/merge.js new file mode 100644 index 00000000..efd8252a --- /dev/null +++ b/pages/coupons/merge.js @@ -0,0 +1,99 @@ +const WXAPI = require('apifm-wxapi') +const AUTH = require('../../utils/auth') +Page({ + data: { + + }, + onLoad: function (options) { + this.mergeCouponsRules(); + }, + onShow: function () { + + }, + async mergeCouponsRules() { + const res = await WXAPI.mergeCouponsRules() + if (res.code == 0) { + this.setData({ + mergeCouponsRules: res.data + }) + } + }, + onPullDownRefresh() { + this.mergeCouponsRules() + wx.stopPullDownRefresh() + }, + async merge(e) { + const idx = e.currentTarget.dataset.idx + const mergeCouponsRule = this.data.mergeCouponsRules[idx] + this.setData({loading: true}) + let res = await WXAPI.myCoupons({ + token: wx.getStorageSync('token'), + status: 0 + }) + if (res.code == 700) { + wx.showToast({ + title: '您暂无可用的优惠券', + icon: 'none' + }) + this.setData({loading: false}) + return + } + if (res.code != 0) { + wx.showToast({ + title: res.msg, + icon: 'none' + }) + this.setData({loading: false}) + return + } + const myCoupons = res.data.reverse() + const couponIds = [] // 用来合成的优惠券id + let ok = true + let msg = '' + mergeCouponsRule.rules.filter(rule => { + return rule.type == 0 + }).forEach(rule => { + for (let i = 0; i < rule.number; i++) { + const couponIndex = myCoupons.findIndex(ele => { return ele.pid == rule.couponId}) + if (couponIndex == -1) { + ok = false + msg = rule.couponName + return + } + const coupon = myCoupons[couponIndex] + couponIds.push(coupon.id) + myCoupons.splice(couponIndex, 1) + } + }) + if (!ok) { + wx.showToast({ + title: '缺少优惠券:' + msg, + icon: 'none' + }) + this.setData({loading: false}) + return + } + res = await WXAPI.mergeCoupons({ + token: wx.getStorageSync('token'), + mergeId: mergeCouponsRule.id, + couponIds: couponIds.join() + }) + if (res.code != 0) { + wx.showToast({ + title: res.msg, + icon: 'none' + }) + this.setData({loading: false}) + return + } + wx.showToast({ + title: '兑换成功' + }) + this.setData({loading: false}) + setTimeout(() => { + wx.navigateBack({ + delta: 0, + }) + }, 1000); + } +}) \ No newline at end of file diff --git a/pages/coupons/merge.json b/pages/coupons/merge.json new file mode 100644 index 00000000..df602533 --- /dev/null +++ b/pages/coupons/merge.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "优惠券合成", + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/pages/coupons/merge.wxml b/pages/coupons/merge.wxml new file mode 100644 index 00000000..ceeececb --- /dev/null +++ b/pages/coupons/merge.wxml @@ -0,0 +1,15 @@ + + + + + 立即合成 + + \ No newline at end of file diff --git a/pages/coupons/merge.wxss b/pages/coupons/merge.wxss new file mode 100644 index 00000000..32d983ef --- /dev/null +++ b/pages/coupons/merge.wxss @@ -0,0 +1 @@ +/* pages/coupons/merge.wxss */ \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 01e68464..00ffacf5 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -306,5 +306,11 @@ Page({ wx.navigateTo({ url: '/pages/search/index' }) + }, + goNotice(e) { + const id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/pages/notice/show?id=' + id, + }) } }) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json index 5458fbe6..1310df0f 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,3 +1,6 @@ { - "enablePullDownRefresh": true + "enablePullDownRefresh": true, + "navigationBarBackgroundColor": "#e64340", + "navigationBarTextStyle": "white", + "backgroundColor": "#e64340" } diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 6de6901c..e1c70714 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -10,16 +10,13 @@ + - + - - - - @@ -34,17 +31,19 @@ - - - - - - {{item.title}} - - - - - 更多 > + + + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index fd45e92d..3ac59812 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -27,40 +27,12 @@ width: 40rpx; height: 40rpx; } - -.search { - position: absolute; - top: 32rpx; - left: 25rpx; - width: 700rpx; - height: 66rpx; - display: block; - box-sizing: border-box; -} -.search input { - display: block; - box-sizing: border-box; - background: rgba(255, 255, 255, 0.8); - border: 1rpx solid #e3e3e3; - width: 700rpx; - height: 66rpx; - border-radius: 30rpx; - padding-left: 32rpx; -} -.search image { - width: 35rpx; - height: 35rpx; - position: absolute; - top: 16rpx; - right: 32rpx; - z-index: 99; -} .goodsDynamic { position: absolute; - top: 110rpx; - left: 25rpx; + bottom: 64rpx; + left: 16rpx; width: 650rpx; - background: rgba(0, 0, 0, 0.6); + background: rgba(0, 0, 0, 0.4); color: #fff; padding: 8rpx 16rpx; border-radius: 32rpx; @@ -88,30 +60,14 @@ overflow: hidden; } .notice-box { - display: flex; - box-sizing: border-box; width: 100vw; height: 88rpx; line-height: 88rpx; - justify-content: space-between; - align-items: center; - padding-right: 32rpx; border-bottom: 1rpx solid #efeff4; } -.notice{ - display: flex; - justify-content: space-between; - align-items: center; - width: 600rpx; -} -.notice_icon { - margin-left:20rpx; - width:30rpx; - height:30rpx; -} .notice_swiper{ height: 88rpx; - width: 600rpx; + width: 100%; } .notice_itemr { padding-left: 16rpx; @@ -119,10 +75,6 @@ overflow: hidden; color: #e64340; } -.notice-box .more { - color: #666; - font-size: 24rpx; -} .container { background-color: #fff; @@ -169,6 +121,8 @@ .swiper-container .swiper1 image { width: 750rpx; height: 375rpx; + /* margin: 8rpx 15rpx; */ + /* border-radius: 16rpx; */ } ::-webkit-scrollbar { width: 0; diff --git a/pages/my/index.wxml b/pages/my/index.wxml index b429356e..c58a4ac8 100755 --- a/pages/my/index.wxml +++ b/pages/my/index.wxml @@ -91,7 +91,8 @@ - + + diff --git a/pages/search/index.json b/pages/search/index.json index 386ec660..9ac68608 100644 --- a/pages/search/index.json +++ b/pages/search/index.json @@ -1,3 +1,3 @@ { - "navigationBarTitleText": "搜索一下" + "navigationBarTitleText": "搜一搜" } \ No newline at end of file diff --git a/project.config.json b/project.config.json index 93f13aaa..bcdf3d44 100644 --- a/project.config.json +++ b/project.config.json @@ -35,7 +35,7 @@ "minifyWXSS": true }, "compileType": "miniprogram", - "libVersion": "2.14.1", + "libVersion": "2.14.3", "appid": "wxa46b09d413fbcaff", "projectname": "%E5%A4%A9%E4%BD%BF%E7%AB%A5%E8%A3%85", "scripts": {},