commit 9eecb9b988a33184a5e952225287fa0de642881a Author: chenshengle <954534408@qq.com> Date: Wed Mar 23 15:04:56 2022 +0800 【抖音代码提交】 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..323a8d0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "bytedanceMiniappIDE.previewScene": "default" +} \ No newline at end of file diff --git a/app.js b/app.js new file mode 100644 index 0000000..6d98e79 --- /dev/null +++ b/app.js @@ -0,0 +1,93 @@ +const Http = require("./utils/HttpBasics.js") +const config = require("./config/config.js"); +App({ + data:{}, + globalData:{ + token: null, + imgHttps: 'https://formall.oss-accelerate.aliyuncs.com/douyin/drawable-xhdpi/', + platform:null,//手机型号 + systemInfo:"", + curHtml:"", + marketName:"", + mouldType:1, + appId:"ttef6599d8705b49b101", + selected:0, + }, + onLaunch: function () { + let that = this + + try { + var res = tt.getSystemInfoSync(); + that.statusBarHeight = res.statusBarHeight + console.log(`手机型号为 ${res.platform}`); + this.globalData.platform = res.platform + } catch (error) { + console.log(`获取系统信息失败`); + } + tt.getSystemInfo({ + success(res) { + that.globalData.systemInfo = res + that.logn(); + }, + fail(res) { + console.log(`getSystemInfo 调用失败`); + }, + }); + + }, + statusBarHeight: 0, + logn(){ + let that = this; + tt.login({ + success:(res=>{ + let {code} = res + Http.post({ + url:config.api.login, + data:{ + code:code, + appId:'ttef6599d8705b49b101', + systemInfo:JSON.stringify(this.globalData.systemInfo) + } + }).then(res=>{ + // debugger + if (res.data.mall){ + that.globalData.marketName = res.data.mall.name ? res.data.mall.name : "" + } + that.globalData.mouldType = res.data.mouldType ? res.data.mouldType:0; + if (res.data.subMalls) { + const squareList = JSON.parse(res.data.subMalls) + tt.setStorageSync("squareList", squareList) + if (res.data.mall){ + tt.setStorageSync("selectedMall", res.data.mall.tenantId) + } + + } + Http.setToken(res.data.token); + that.globalData.token = res.data.token + if (that.tokenCallback) { + that.tokenCallback(res.data.token); + } + }).catch(err=>{ + console.log(err); + tt.showModal({ + title: '提示', + showCancel: false, + content: '登录失败,请重新尝试', + success: (res) => { + if (res.cancel) { + //点击取消,默认隐藏弹框 + } else { + //点击确定 + tt.reLaunch({ + url: '/pages/index/index', + }) + } + } + }); + }) + + }), + + }); + } +}) diff --git a/app.json b/app.json new file mode 100644 index 0000000..359100d --- /dev/null +++ b/app.json @@ -0,0 +1,42 @@ +{ + "pages": [ + "index/index", + "index/searchbar", + "pages/index/index", + "index/user", + "pages/mainOrder/mainOrder", + "pages/detailOrder/detailOrder", + "pages/ticket/ticket", + "pages/ticketDetail/ticketDetail", + "pages/coupon/detail/index", + "pages/editUser/editUser", + "pages/specialcourtesy/specialcourtesy", + "pages/complaint/complaint", + "pages/mallInfo/mallInfo", + "pages/getuserinfo/getuserinfo", + "pages/bannerdetail/bannerdetail", + "pages/topicDetail/index", + "pages/main/index", + "pages/integralmall/index", + "pages/integralmall/integraHistory/index", + "pages/order/detail/index", + "pages/order/index/index", + "pages/orderquanma/index", + "pages/edit/edit", + "pages/questionnaire/questionnaire", + "pages/questionnaire/questionnaireLsit/questionnaireLsit", + "pages/searchbar/searchbar", + "pages/index/searchbar/detail/index", + "pages/integralmall/payIntegcoupondetail/index", + "pages/integralmall/payIntegcouponStatus/index", + "pages/getPhone/getPhone" + ], + "window": { + "backgroundTextStyle": "light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "Mini Program", + "navigationBarTextStyle": "black", + "navigationStyle": "custom" + } + +} \ No newline at end of file diff --git a/app.ttss b/app.ttss new file mode 100644 index 0000000..38e1ba9 --- /dev/null +++ b/app.ttss @@ -0,0 +1,141 @@ +.BoxBg{ + background-color: #f6f6f6; + min-height: 100vh; +} +view, text { + font-family: PingFangSC-Regular; + +} +@font-face { + font-family: "iconfont"; /* project id 777313 */ + src: url("//at.alicdn.com/t/font_777313_jq7td4d3uab.eot"); + src: url("//at.alicdn.com/t/font_777313_jq7td4d3uab.eot?#iefix") + format("embedded-opentype"), + url("//at.alicdn.com/t/font_777313_jq7td4d3uab.woff") format("woff"), + url("//at.alicdn.com/t/font_777313_jq7td4d3uab.ttf") format("truetype"), + url("//at.alicdn.com/t/font_777313_jq7td4d3uab.svg#iconfont") format("svg"); + } + + .iconfont { + font-family: "iconfont" !important; + font-size: 36rpx; + font-style: normal; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0.2rpx; + -moz-osx-font-smoothing: grayscale; + } + .clearfix:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; + } + /* 定位 */ + .icon-dingweib:before { + content: "\e652"; + } + /* 三角 */ + .icon-choose:before { + content: "\e601"; + } + /* 右箭头 */ + .icon-right:before { + content: "\e612"; + } + + /* 边框 */ + + .app-border-top, + .app-border-bottom { + position: relative; + width: 100%; + } + + .app-border-top::after, + .app-border-bottom::after { + content: ""; + position: absolute; + background-color: #ddd; + display: block !important; + z-index: 1; + top: auto; + right: auto; + width: 100%; + height: 1rpx; + transform-origin: 50% 100%; + transform: scaleY(0.5); + } + + .app-border-top:last-child:after, + .app-border-bottom:last-child::after { + display: none !important; + } + + .app-border-top::after { + top: 0; + } + + .app-border-bottom::after { + bottom: 0; + } + + .app-border-left, + .app-border-right { + position: relative; + height: 100%; + } + + .app-border-left::before, + .app-border-right::before { + content: ""; + position: absolute; + background-color: #ddd; + display: block; + z-index: 1; + top: 0; + bottom: 0; + height: 100%; + width: 1rpx; + transform-origin: 50% 100%; + transform: scaleX(0.5); + } + + .app-border-left::before { + left: 0; + } + + .app-border-right::before { + right: 0; + } + view, + text { + font-family: PingFangSC-Regular; + } + page { + width: 100%; + min-height: 100vh; + font-weight: 400; + padding-bottom: 160rpx; + background: #F4F5F9; + } + .fl{ + float: left; + } + .fr{ + float: right; + } + .canWrap{ + position: fixed; + bottom: -20000rpx; + left: -2000rpx; + width: 100%; + height: 100%; + overflow: visible; + } + .canWrap canvas{ + width: 690rpx; + height: 450rpx; + } + + \ No newline at end of file diff --git a/assets/images/aptitude.png b/assets/images/aptitude.png new file mode 100644 index 0000000..94808b2 Binary files /dev/null and b/assets/images/aptitude.png differ diff --git a/assets/images/dindan.png b/assets/images/dindan.png new file mode 100644 index 0000000..d373ec4 Binary files /dev/null and b/assets/images/dindan.png differ diff --git a/assets/images/dindan_a.png b/assets/images/dindan_a.png new file mode 100644 index 0000000..3c28d81 Binary files /dev/null and b/assets/images/dindan_a.png differ diff --git a/assets/images/home.png b/assets/images/home.png new file mode 100644 index 0000000..694cda8 Binary files /dev/null and b/assets/images/home.png differ diff --git a/assets/images/home_a.png b/assets/images/home_a.png new file mode 100644 index 0000000..65454e3 Binary files /dev/null and b/assets/images/home_a.png differ diff --git a/assets/images/main.png b/assets/images/main.png new file mode 100644 index 0000000..1d21209 Binary files /dev/null and b/assets/images/main.png differ diff --git a/assets/images/order.png b/assets/images/order.png new file mode 100644 index 0000000..5d10d60 Binary files /dev/null and b/assets/images/order.png differ diff --git a/assets/images/order_a.png b/assets/images/order_a.png new file mode 100644 index 0000000..2aba05b Binary files /dev/null and b/assets/images/order_a.png differ diff --git a/assets/images/portal.png b/assets/images/portal.png new file mode 100644 index 0000000..d818f88 Binary files /dev/null and b/assets/images/portal.png differ diff --git a/assets/images/portal_a.png b/assets/images/portal_a.png new file mode 100644 index 0000000..f87971d Binary files /dev/null and b/assets/images/portal_a.png differ diff --git a/assets/images/quan.png b/assets/images/quan.png new file mode 100644 index 0000000..968018c Binary files /dev/null and b/assets/images/quan.png differ diff --git a/assets/images/questionnaire.png b/assets/images/questionnaire.png new file mode 100644 index 0000000..fa5e7d9 Binary files /dev/null and b/assets/images/questionnaire.png differ diff --git a/assets/images/service.png b/assets/images/service.png new file mode 100644 index 0000000..766533d Binary files /dev/null and b/assets/images/service.png differ diff --git a/assets/images/store.png b/assets/images/store.png new file mode 100644 index 0000000..77f45c3 Binary files /dev/null and b/assets/images/store.png differ diff --git a/assets/images/tousu.png b/assets/images/tousu.png new file mode 100644 index 0000000..58ca6d4 Binary files /dev/null and b/assets/images/tousu.png differ diff --git a/assets/images/user.png b/assets/images/user.png new file mode 100644 index 0000000..d53795b Binary files /dev/null and b/assets/images/user.png differ diff --git a/assets/images/userInfo.png b/assets/images/userInfo.png new file mode 100644 index 0000000..33559df Binary files /dev/null and b/assets/images/userInfo.png differ diff --git a/assets/images/user_a.png b/assets/images/user_a.png new file mode 100644 index 0000000..86fd0de Binary files /dev/null and b/assets/images/user_a.png differ diff --git a/assets/itemImg/chevron.png b/assets/itemImg/chevron.png new file mode 100644 index 0000000..2b89cd5 Binary files /dev/null and b/assets/itemImg/chevron.png differ diff --git a/assets/itemImg/loading.gif b/assets/itemImg/loading.gif new file mode 100644 index 0000000..9a046e8 Binary files /dev/null and b/assets/itemImg/loading.gif differ diff --git a/assets/itemImg/noOrders.png b/assets/itemImg/noOrders.png new file mode 100644 index 0000000..fb0cf25 Binary files /dev/null and b/assets/itemImg/noOrders.png differ diff --git a/assets/itemImg/phDel.png b/assets/itemImg/phDel.png new file mode 100644 index 0000000..78a51fd Binary files /dev/null and b/assets/itemImg/phDel.png differ diff --git a/assets/itemImg/spcode.png b/assets/itemImg/spcode.png new file mode 100644 index 0000000..087c10f Binary files /dev/null and b/assets/itemImg/spcode.png differ diff --git a/assets/itemImg/succ.png b/assets/itemImg/succ.png new file mode 100644 index 0000000..c497750 Binary files /dev/null and b/assets/itemImg/succ.png differ diff --git a/assets/itemImg/tel1.jpg b/assets/itemImg/tel1.jpg new file mode 100644 index 0000000..8bbcbd4 Binary files /dev/null and b/assets/itemImg/tel1.jpg differ diff --git a/assets/itemImg/topLine.png b/assets/itemImg/topLine.png new file mode 100644 index 0000000..41a6042 Binary files /dev/null and b/assets/itemImg/topLine.png differ diff --git a/assets/itemImg/upDataRqF.png b/assets/itemImg/upDataRqF.png new file mode 100644 index 0000000..a4f13b8 Binary files /dev/null and b/assets/itemImg/upDataRqF.png differ diff --git a/assets/itemImg/updateRq.png b/assets/itemImg/updateRq.png new file mode 100644 index 0000000..9cc3bb8 Binary files /dev/null and b/assets/itemImg/updateRq.png differ diff --git a/assets/itemImg/wm01.jpg b/assets/itemImg/wm01.jpg new file mode 100644 index 0000000..d3a2369 Binary files /dev/null and b/assets/itemImg/wm01.jpg differ diff --git a/assets/itemImg/wm02.jpg b/assets/itemImg/wm02.jpg new file mode 100644 index 0000000..7dddd5d Binary files /dev/null and b/assets/itemImg/wm02.jpg differ diff --git a/assets/itemImg/wm03.jpg b/assets/itemImg/wm03.jpg new file mode 100644 index 0000000..50ecc7a Binary files /dev/null and b/assets/itemImg/wm03.jpg differ diff --git a/assets/itemImg/wm04.jpg b/assets/itemImg/wm04.jpg new file mode 100644 index 0000000..159c2f4 Binary files /dev/null and b/assets/itemImg/wm04.jpg differ diff --git a/components/advertisement/advertisement.js b/components/advertisement/advertisement.js new file mode 100644 index 0000000..910aa20 --- /dev/null +++ b/components/advertisement/advertisement.js @@ -0,0 +1,38 @@ +// components/advertisement.js +const Http = require("../../utils/HttpBasics"); +var config = require("../../config/config.js"); +Component({ + properties: { + ggdata: { + type: Object, + value: {} + } + }, + data: { + flag: false, + alphaData1: null, + }, + methods: { + gotoGg: function (e) { + console.log(this.data.ggdata) + let that = this; + + tt.navigateTo({ + url: `/${that.data.ggdata.pagePath}&g=1`, + }) + }, + a: function () { + this.setData({ flag: false }) + }, + closeGg: function () { + let that = this; + var animation = tt.createAnimation({}) + // animation.opacity(0).step({ duration: 1000 }) + setTimeout(function () { + that.setData({ flag: true }) + }, 500) + animation.rotateZ(180).scale(0).opacity(0.5).step({ duration: 1000 }) + that.setData({ alphaData1: animation.export() }); + }, + }, +}); diff --git a/components/advertisement/advertisement.json b/components/advertisement/advertisement.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/advertisement/advertisement.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/advertisement/advertisement.ttml b/components/advertisement/advertisement.ttml new file mode 100644 index 0000000..8bc06aa --- /dev/null +++ b/components/advertisement/advertisement.ttml @@ -0,0 +1,12 @@ + + diff --git a/components/advertisement/advertisement.ttss b/components/advertisement/advertisement.ttss new file mode 100644 index 0000000..d6b68a9 --- /dev/null +++ b/components/advertisement/advertisement.ttss @@ -0,0 +1,47 @@ +/* components/advertisement.wxss */ +.b1{ + position:fixed; + width:100%; + height:100%; + top:0px; + background:rgba(0,0,0,0.8); + overflow: hidden; + z-index: 1000; +} +.b3{ + /* margin:0 auto; */ + width:100%; + height:100%; + position:relative; +} +.t_w{ + width: 100%; + position: absolute; + top: 50%; + left: 50%; + margin-top: -50%; + margin-left: -50%; +} +.b2{ + overflow: hidden; + border-radius: 10rpx; +} +.t_image{ + width: 70%; + border-radius: 16rpx; + display: block; + margin: 0 auto; +} +.cancel_icon{ + position: absolute; + right: 65rpx; + top: -40rpx; +} +.line{ + width:2rpx; + height: 75rpx; + background: #fff; + position: absolute; + right: 370rpx; + bottom: -125rpx; +} \ No newline at end of file diff --git a/components/banner/index.js b/components/banner/index.js new file mode 100644 index 0000000..c1e9a06 --- /dev/null +++ b/components/banner/index.js @@ -0,0 +1,91 @@ +// pages/index/sw/index.js +const imgurl = require("../../utils/imgurl"); +const app = getApp() + +Component({ + /** + * 组件的属性列表 + */ + properties: { + list: { + value: [], + type: Array + } + }, + + /** + * 组件的初始数据 + */ + data: { + bannerUrl: imgurl.banner.url, + currentIndex: 0, + mouldType:0, + }, + + /** + * 组件的方法列表 + */ + methods: { + gotobannerdetail: function(e) { + console.log(this.data.list) + if (e.currentTarget.dataset.data.type == 3) { + // 小程序路径 + let indexOf = (e.currentTarget.dataset.data.pagePath).indexOf("="); + console.log(indexOf, "123") + let id = (e.currentTarget.dataset.data.pagePath).substring(indexOf); + let type = (e.currentTarget.dataset.data.pagePath).substr(indexOf + 1, 2)// 2020/7/22 变量获取pagePath中的type + console.log(indexOf, id, type); + console.log(e.currentTarget.dataset.data.pagePath) + if(type == 'cd' || type == 'sd'){ + tt.navigateTo({ + url: `/${e.currentTarget.dataset.data.pagePath}`, + }) + }else if(type == "wj"){ + tt.navigateTo({ + url: `/pages/questionnaire/questionnaire?id=${id}`, + }) + }else if (type == 'ra'){ + tt.navigateTo({ + url: `/pages/radetail/index?id=${id}`, + }) + } + }else if(e.currentTarget.dataset.data.type==2){ + // 自由图文 + tt.navigateTo({ + url: `/pages/freeBannerDetail/index?id=${e.currentTarget.dataset.id}` + }); + }else if(e.currentTarget.dataset.data.type==4){ + tt.navigateToMiniProgram({ + appId: e.currentTarget.dataset.data.goAppid, + // path: 'page/index/index?id=123', + // extraData: { + // foo: 'bar' + // }, + // envVersion: 'develop', + success(res) { + // 打开成功 + } + }) + } + else{ + // 固定格式 + tt.navigateTo({ + url: `/pages/bannerdetail/bannerdetail?id=${e.currentTarget.dataset.id}` + }); + } + }, + handleChange: function (e) { + this.setData({ + currentIndex: e.detail.current + }) + }, + }, + attached: function () { + // 在组件实例进入页面节点树时执行 + if (app.globalData.mouldType){ + this.setData({ + mouldType: app.globalData.mouldType + }) + } + }, +}); diff --git a/components/banner/index.json b/components/banner/index.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/banner/index.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/banner/index.ttml b/components/banner/index.ttml new file mode 100644 index 0000000..e17e103 --- /dev/null +++ b/components/banner/index.ttml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/components/banner/index.ttss b/components/banner/index.ttss new file mode 100644 index 0000000..0f3add7 --- /dev/null +++ b/components/banner/index.ttss @@ -0,0 +1,81 @@ +.imageContainer { + width: 100%; + height: 304rpx; + } + + .itemImg { + position: absolute; + width: 640rpx; + height: 227rpx; + border-radius: 15rpx; + overflow: hidden; + z-index: 5; + opacity: 0.7; + top: 20%; + margin: 0 20rpx; + } + + .active { + opacity: 1; + z-index: 10; + width: 640rpx; + height: 270rpx; + top: 11%; + transition: all 0.2s ease-in 0s; + } + + .item { + width: 100%; + height: 304rpx; + overflow: hidden; + border-radius: 16rpx; + } + + .index-slide-view { + margin-top: -30rpx; + } + .index-slide-view1 { + margin-top: -40rpx; + } + + .imageContainer1 { + width: 100%; + height: 400rpx; + } + + .itemImg1 { + position: absolute; + width: 640rpx; + height: 360rpx; + border-radius: 15rpx; + overflow: hidden; + z-index: 5; + opacity: 0.7; + top: 12%; + margin: 0 20rpx; + } + + .active1_a { + opacity: 1; + z-index: 10; + width: 640rpx; + top: 11%; + transition: all 0.2s ease-in 0s; + } + + .active1 { + opacity: 1; + z-index: 10; + width: 640rpx; + height: 310rpx; + top: 17%; + transition: all 0.2s ease-in 0s; + } + + .item1 { + width: 100%; + height: 360rpx; + overflow: hidden; + border-radius: 16rpx; + } + \ No newline at end of file diff --git a/components/commodityBox/commodityBox.js b/components/commodityBox/commodityBox.js new file mode 100644 index 0000000..80cc9e1 --- /dev/null +++ b/components/commodityBox/commodityBox.js @@ -0,0 +1,32 @@ + +Component({ + data: { + schedule:0 + }, + properties: { + item:{ + type:Object, + value:{} + } + }, + methods: { + + go(e){ + let url = e.currentTarget.dataset.url + tt.navigateTo({ + url: url, // 指定页面的 url + success: (res) => { + + }, + fail: (res) => { + + }, + }); + } + }, + // created:function(){ + + + // } + +}) \ No newline at end of file diff --git a/components/commodityBox/commodityBox.json b/components/commodityBox/commodityBox.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/commodityBox/commodityBox.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/commodityBox/commodityBox.ttml b/components/commodityBox/commodityBox.ttml new file mode 100644 index 0000000..fb2be1a --- /dev/null +++ b/components/commodityBox/commodityBox.ttml @@ -0,0 +1,27 @@ + + + + + + {{item.title}} + + + + + {{item.remainInventoryText}} + + + + + + {{item.salePriceStr}} + + ¥{{item.priceStr}} + + 免费领取 + 立即购买 + 已售空 + + + + \ No newline at end of file diff --git a/components/commodityBox/commodityBox.ttss b/components/commodityBox/commodityBox.ttss new file mode 100644 index 0000000..a7bdda4 --- /dev/null +++ b/components/commodityBox/commodityBox.ttss @@ -0,0 +1,121 @@ +.commodityBox{ + width:96%; + margin: 20rpx auto 0 auto; + background-color: #ffffff; + overflow: hidden; + border-radius: 10rpx; + } + .commodiImg{ + float: left; + width: 300rpx; + height: 176rpx; + border-radius: 10rpx; + /* background-color: aqua; */ + margin: 20rpx; + + } + .img{ + width: 300rpx; + height: 176rpx; + border-radius: 10rpx; + } + .textBox{ + width: 50%; + float: left; + margin-top: 20rpx; + font-size: 28rpx; + + } + .title{ + height: 80rpx; + overflow:hidden; + text-overflow:ellipsis; + display:-webkit-box; + -webkit-box-orient:vertical; + -webkit-line-clamp:2; + font-size: 30rpx; + font-weight: 500; + } + .marketBox{ + overflow: hidden; + height: 40rpx; + } + .progress{ + height: 20rpx; + width: 46%; + border-radius: 10rpx; + float: left; + background-color: #e6e6e6; + margin-top: 10rpx; + position: relative; + overflow: hidden; + } + .progress_a{ + /* width: 20%; */ + height: 20rpx; + /* border-radius: 10rpx; */ + background-color: #fb3e5c; + position: absolute; + top: 0; + left: 0; + } + .progressText{ + float: right; + width: 50%; + font-size: 26rpx; + color: #707070; + } + .payBox{ + overflow: hidden; + } + .payNumBox{ + float: left; + /* overflow: hidden; + height: 40rpx; */ + } + .payIcon{ + font-size: 24rpx; + float: left; + color: #fb3e5c; + line-height: 40rpx; + } + .price{ + height: 40rpx; + line-height: 40rpx; + float: left; + font-size: 30rpx; + color: #fb3e5c; + } + .original{ + font-size: 26rpx; + color: #707070; + text-decoration: line-through; + } + + .payBtn{ + color: #fff; + background:linear-gradient(to right,#fc3e5a,#f86883); + float: right; + margin-right: 10%; + margin-top: 20rpx; + height: 60rpx; + line-height: 60rpx; + width: 180rpx; + text-align: center; + border-radius: 60rpx; + margin-bottom: 20rpx; + } + .noBtn{ + color: #fff; + background:#e6e6e6; + float: right; + margin-right: 10%; + margin-top: 20rpx; + height: 60rpx; + line-height: 60rpx; + width: 180rpx; + text-align: center; + border-radius: 60rpx; + margin-bottom: 20rpx; + } + \ No newline at end of file diff --git a/components/commodityMould/commodityMould.js b/components/commodityMould/commodityMould.js new file mode 100644 index 0000000..779149d --- /dev/null +++ b/components/commodityMould/commodityMould.js @@ -0,0 +1,133 @@ +const util = require("../../utils/util"); +Component({ + /** + * 组件的属性列表 util.toHHmmss(res.data.endTime,); + */ + properties: { + special:{ + type: Boolean, + value: false + }, + titleImgUrl:{ + type:String, + value:"", + }, + isShowCount:{ + type: Boolean, + value: false + }, + obj:{ + type:Object, + value:{} + } + }, + + /** + * 组件的初始数据 + */ + data: { + setIntervalLsit:[] + }, + + attached: function () { + let this_ =this + let arr = [] + let tempLsit = [] + // 处理首页定时 + if (this_.properties.obj.couponList!=null&&this_.properties.obj.couponList.length>0){ + //限时抢购 倒计时 + this_.properties.obj.couponList.map((item,index)=>{//初次渲染 + if (item.targetAd==2){ + let tempObj = {} + let beginTime = item.beginTime;//开始时间 + let endTime = item.endTime;//结束时间 + let present = new Date().getTime()//当前时间 + let textTime = item.beginTime >= present?"距开始":"距结束" + tempObj={ + value: item.beginTime >= present ? beginTime - present : endTime - present, + valueText: item.beginTime >= present ? util.toHHmmss(beginTime - present) : util.toHHmmss(endTime - present), + // vaFlag: tempObj.value<=0?true:false,//活动是否结束 + index:index, + interval:"" , + beginTime: beginTime,//开始时间 + endTime: endTime,//开始时间 + textTime: textTime + } + arr.push(tempObj) + this_.setData({ + setIntervalLsit: arr + }) + } + }) + } + tempLsit =this_.data.setIntervalLsit + tempLsit.map((item,index)=>{//再次渲染 + + item.interval = setInterval(function(){ + let present = new Date().getTime()//当前时间 + if(item.value<=1){ + + clearInterval(item.interval) + item.vaFlag = true,//活动是否结束 + console.log(item.value, "活动已经结束") + }else{ + + + let tempTime = item.beginTime >= present ? item.beginTime - present : item.endTime - present + // console.log(tempTime, "presents") + item.value = tempTime, + item.valueText = util.toHHmmss(tempTime - 1000) + item.textTime = item.beginTime >= present ? "距开始" : "距结束", + item.vaFlag= item.value <= 0 ? true : false,//活动是否结束 + this_.setData({ + setIntervalLsit: tempLsit + }) + + } + },1000) + }) + // 处理首页定时 + }, + detached: function () { + this.data.setIntervalLsit.map(item=>{ + clearInterval(item.interval) + }) + console.log("88888") + // 在组件实例被从页面节点树移除时执行 ; + }, + + /** + * 组件的方法列表 + */ + methods: { + lookAll(){ + tt.navigateTo({ + url: `/${this.properties.obj.weappPath}`, + }) + }, + goDetail(e){ + console.log(e.currentTarget.dataset) + let couponChannelId = e.currentTarget.dataset.id + let couponId = e.currentTarget.dataset.couponid + let type = e.currentTarget.dataset.type + if (type==9){ + tt.navigateTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, + }) + }else{ + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, + }) + } + + + }, + gotoTopic(e) { + + let id = e.currentTarget.dataset.id + tt.navigateTo({ + url: `/pages/topicDetail/index?id=${id}` + }) + }, + } +}) diff --git a/components/commodityMould/commodityMould.json b/components/commodityMould/commodityMould.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/commodityMould/commodityMould.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/commodityMould/commodityMould.ttml b/components/commodityMould/commodityMould.ttml new file mode 100644 index 0000000..2724943 --- /dev/null +++ b/components/commodityMould/commodityMould.ttml @@ -0,0 +1,65 @@ + + + + + + + + + + + + {{obj.name}} + 查看更多优惠活动 + + + + + + + + +
+ + + + + + + + + + {{item.title}} + + + + + + {{item.salePriceStrQ?item.salePriceStrQ:item.salePriceStr}} + {{item.salePriceStrH?'.'+item.salePriceStrH:''}} + + {{item.creditPrice}} + 积分 + + + ¥{{item.priceStr}} + + + + {{setIntervalLsit[index].textTime}} + {{setIntervalLsit[index].vaFlag?'活动已结束':setIntervalLsit[index].valueText}} + + + + + + + 查看更多优惠活动 + +
+
+
+ +
\ No newline at end of file diff --git a/components/commodityMould/commodityMould.ttss b/components/commodityMould/commodityMould.ttss new file mode 100644 index 0000000..8275bed --- /dev/null +++ b/components/commodityMould/commodityMould.ttss @@ -0,0 +1,259 @@ +.commBox { + width: 96%; + margin: 27rpx auto; + background-color: #fff; + border-radius: 20rpx; + overflow: hidden; + } + + .titleBox { + width: 100%; + overflow: hidden; + height: 140rpx; + background-image: url("https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_icon_d9qt.png"); + background-size: 100% 100%; + background-repeat: no-repeat; + } + + .titleImg { + width: 180rpx; + height: 40rpx; + float: left; + margin: 20rpx; + display: block; + } + + .specialTitle { + float: left; + margin: 10rpx 20rpx; + font-size: 38rpx; + font-family: YouSheBiaoTiHei; + font-weight: 600; + color: #37332d; + } + + .more { + float: right; + font-size: 24rpx; + font-family: OPPOSans; + font-weight: 500; + color: #866741; + margin: 16rpx 20rpx; + } + + .rup { + width: 13rpx; + height: 20rpx; + margin: 2rpx 0 0 6rpx; + } + + .contBox { + overflow: hidden; + /* width: 96%; */ + margin: -50rpx auto 0 auto; + } + + .topImg { + width: 100%; + height: 140rpx; + border-radius: 16rpx; + margin-bottom: 40rpx; + /* background-color: chartreuse; */ + } + + .topImg image { + border-radius: 16rpx; + width: 100%; + height: 100%; + } + + .itemBox { + overflow: hidden; + display: -webkit-box; + overflow-x: scroll; + -webkit-overflow-scrolling: touch; + margin: 20rpx auto; + width: 96%; + } + + .itemBox::-webkit-scrollbar { + display: none; + } + + .item { + width: 240rpx; + /* background-color: antiquewhite; */ + margin-right: 20rpx; + } + + .itemImg { + position: relative; + width: 240rpx; + height: 240rpx; + border-radius: 16rpx; + /* background-color: aquamarine; */ + } + + .itemImg image { + width: 100%; + height: 100%; + border-radius: 16rpx; + } + + .sellout { + position: absolute; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.5); + width: 240rpx; + height: 240rpx; + border-radius: 20rpx; + } + + .selloutImg { + width: 195rpx !important; + height: 154rpx !important; + margin: 18% auto; + display: block; + } + + .titleNameBox { + /* font-size: 18px; */ + height: 80rpx; + line-height: 40rpx; + display: flex; + align-items: center; + justify-content: center; + } + + .titleName { + width: 100%; + font-size: 28rpx; + font-family: OPPOSans; + font-weight: 500; + color: #333; + margin-top: 10rpx; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; + text-overflow: ellipsis; + } + + .priceBox { + overflow: hidden; + margin: 10rpx 0; + } + + .f { + float: left; + } + + .r { + float: right; + } + + .sellingBox { + overflow: hidden; + } + + .fuhao { + color: #df2d2d; + font-size: 24rpx; + float: left; + font-family: OPPOSans; + /* font-weight: bold; */ + margin-top: 10rpx; + } + + .int { + float: left; + font-size: 36rpx; + font-family: OPPOSans; + font-weight: bold; + color: #df2d2d; + } + + .originalBox { + overflow: hidden; + } + + .origina { + text-align: right; + font-size: 24rpx; + font-family: OPPOSans; + font-weight: 400; + text-decoration: line-through; + color: #999; + margin-top: 10rpx; + margin-right: 10rpx; + } + + .countBox { + width: 100%; + height: 46rpx; + background-image: url("https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_icon_bq.png"); + background-size: 100% 100%; + background-repeat: no-repeat; + margin-bottom: 20rpx; + line-height: 46rpx; + overflow: hidden; + } + + .countText { + font-size: 22rpx; + font-family: OPPOSans; + font-weight: 400; + color: #999; + background: linear-gradient(180deg, #dcb07d 0%, #f5e0bf 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + margin-left: 8rpx; + } + + .countDate { + font-size: 24rpx; + font-family: OPPOSans; + font-weight: bold; + color: #4c3820; + margin-right: 8rpx; + } + + .moreItem { + background: #f7f7f7; + border-radius: 8px; + } + + .noDataImg { + width: 160rpx; + height: 160rpx; + margin: 25% auto 5% auto; + } + + .noDataImg image { + width: 100%; + height: 100%; + } + + .noDataText { + text-align: center; + font-size: 22rpx; + font-family: OPPOSans; + font-weight: 500; + color: #999; + } + + .product { + width: 96%; + height: 140rpx; + margin: 30rpx auto 10rpx; + border-radius: 16rpx; + overflow: hidden; + } + + .product image { + height: 100%; + display: block; + width: 100%; + } + \ No newline at end of file diff --git a/components/coupons/index.js b/components/coupons/index.js new file mode 100644 index 0000000..a2c675f --- /dev/null +++ b/components/coupons/index.js @@ -0,0 +1,46 @@ +const app = getApp() +Component({ + /** + * 组件的属性列表 + */ + properties: { + paramAtoB: String, + from: String, + data: { + value: {}, + type: Object + }, + }, + + /** + * 组件的初始数据 + */ + data: { + mouldType: 0, + }, + attached: function () { + // 在组件实例进入页面节点树时执行 + if (app.globalData.mouldType) { + this.setData({ + mouldType: app.globalData.mouldType + }) + } + }, + methods: { + gotoDetail(e) { + let couponId = e.currentTarget.dataset.couponid; + let title = e.currentTarget.dataset.title; + let id = e.currentTarget.dataset.id; + let targetAd = e.currentTarget.dataset.targetad; + if (id && targetAd != 7) { + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${id}&couponId=${couponId}&title=${title}`, + }) + } else if (targetAd == 7) { + tt.navigateTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${id}&couponId=${couponId}&title=${title}`, + }) + } + } + } +}); \ No newline at end of file diff --git a/components/coupons/index.json b/components/coupons/index.json new file mode 100644 index 0000000..34e4209 --- /dev/null +++ b/components/coupons/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "i-button": "../../dist/button/index" + } +} \ No newline at end of file diff --git a/components/coupons/index.ttml b/components/coupons/index.ttml new file mode 100644 index 0000000..a2c4cfd --- /dev/null +++ b/components/coupons/index.ttml @@ -0,0 +1,75 @@ + + 预售 + + + + + + + + + + 限时券 + 砍价券 + 拼团券 + 消费卡 + + + + + + + {{data.title}} + {{data.subTitle}} + + + ¥ + {{data.salePriceStr}} + ¥{{data.priceStr}} + + + 抢购价 + ¥{{data.salePriceStr}} + + + 可砍至 + ¥{{data.salePriceStr}} + + + 拼团价 + ¥{{data.salePriceStr}} + + + + + {{data.priceStr}}小时 + + + + {{data.priceStr}}小时 + + + + 预售定金:¥{{data.salePriceStr}} + + + + + + 免费领 + 购买 + + 去抢购 + + 去砍价 + + 去拼团 + 已售罄 + 已下架 + + + \ No newline at end of file diff --git a/components/coupons/index.ttss b/components/coupons/index.ttss new file mode 100644 index 0000000..8cd561a --- /dev/null +++ b/components/coupons/index.ttss @@ -0,0 +1,372 @@ +@import "../../app.ttss"; + +.coupons { + position: relative; + width: 340rpx; + display: inline-block; + overflow: hidden; + border-radius: 12rpx; +} +.earnest{ + color: red; + font-size: 24rpx; + padding-left: 10rpx; +} +.coupons-border { + height: 1rpx; + left: 30rpx; + right: 30rpx; + background: #f5f5f5; + position: absolute; + bottom: 0; +} + +.coupons-img image { + display: block; + width: 300rpx; + height: 176rpx; + margin: 20rpx auto 0; + /* border-top-left-radius: 10rpx; + border-top-right-radius: 10rpx; */ +} + +.coupons-info { + width: 90%; + height: 152rpx; + border-radius: 0rpx 0rpx 10rpx 10rpx; + background: #fff; + margin: 0 auto; +} + +.coupons-info-name { + font-size: 30rpx; + color: #3c3c3c; + letter-spacing: 0; + line-height: 38rpx; +} + +.coupons-info-price { + padding: 16rpx 0 0; +} + +.i { + font-size: 24rpx; + font-style: normal; +} + +.coupons-info-price-p { + display: inline-block; + font-size: 50rpx; + margin-bottom: 26rpx; + width: 100%; +} + +.price { + font-size: 36rpx; + font-family: PingFang-SC-Bold; + font-weight: bold; + line-height: 44rpx; + margin-left: 16rpx; + padding-top: 16rpx; + color: #fd832d; + width: 60%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.rmb { + font-size: 24rpx !important; + margin-right: 4rpx !important; + color: #FD782D!; +} + +.num { + color: #fd782d; +} + +.tit { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + font-size: 28rpx; + line-height: 32rpx; + padding-top: 20rpx; + padding-left: 10rpx; + color: #333; + letter-spacing: 0; +} + +.coupons-info-price-o { + display: block; + text-align: center; + font-size: 26rpx; + color: #b4b4b4; + letter-spacing: 0.96rpx; + text-decoration: line-through; + line-height: 24rpx; +} + +.coupons-info-distance { + font-size: 22rpx; + color: #c0c0c0; + letter-spacing: 0; + padding-bottom: 10rpx; + line-height: 30rpx; +} + +.coupons-info-address { + font-size: 22rpx; + color: #585858; + letter-spacing: 0; + line-height: 30rpx; +} + +.coupons-btn { + position: absolute; + bottom: 14rpx; + right: 24rpx; +} + +.coupons-btn-gm { + border-radius: 10px !important; + margin: 0 !important; + padding: 0 !important; + font-size: 26rpx; + color: #fff !important; + letter-spacing: 0; + height: 51rpx !important; + width: 100rpx !important; + line-height: 51rpx !important; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%) !important; +} + +.coupons-btn-gms { + background: #b9b9b9 !important; + border-radius: 10px !important; + opacity: 0.6; + margin: 0 !important; + padding: 0 !important; + font-family: PingFangSC-Semibold; + font-size: 26rpx; + font-weight: 400; + color: #fff !important; + letter-spacing: 0; + height: 51rpx !important; + width: 100rpx !important; + line-height: 51rpx !important; +} + +.subtitle { + font-size: 24rpx; + color: #999; + overflow: hidden; + height: 24rpx; + width: 65%; + padding-left: 10rpx; + line-height: 24rpx; + white-space: nowrap; + text-overflow: ellipsis; + margin-top: 12rpx; +} + +.coupons-info-manjian { + font-weight: normal; + font-size: 20rpx; + line-height: 34rpx; + display: inline-block; + color: #ff4949; + letter-spacing: 0; +} + +.coupons-info-manjian1 { + font-weight: normal; + font-size: 20rpx; + line-height: 22rpx; + color: #919191; + letter-spacing: 0; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + width: 300rpx; + margin-top: 16rpx; +} + +.coupons-info-manjian text { + display: block; + line-height: 20rpx; +} + +.coupons-info-manjian > text:nth-of-type(1) { + display: block; + /* color: #FF4949; */ + opacity: 0.6; +} + +.view02 { + font-size: 20rpx; + line-height: 34rpx; + text-decoration: line-through; + color: #999 !important; + font-weight: normal; + letter-spacing: 0; + margin-left: 10rpx; +} + +.view01 { + text-decoration: line-through; + color: #999 !important; +} + +.txt2 { + display: block; + color: #ccc; +} + +/**上拉加载更多**/ + +.userinfo { + display: flex; + flex-direction: column; + align-items: center; +} + +.userinfo-avatar { + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.userinfo-nickname { + color: #aaa; +} + +.sy { + display: block; + text-align: right; + width: 181rpx; + font-size: 24rpx; + color: #999; + height: 40rpx; + margin-top: 106rpx; +} + +.usermotto { + margin-top: 200px; +} + +scroll-view { + width: 100%; +} + +.item { + width: 90%; + height: 300rpx; + margin: 20rpx auto; + background: brown; + overflow: hidden; +} + +.item .img { + width: 430rpx; + margin-right: 20rpx; + float: left; +} + +.title { + font-size: 30rpx; + display: block; + margin: 30rpx auto; +} + +.description { + font-size: 26rpx; + line-height: 15rpx; +} + +.navigator-hover { + opacity: 1 !important; + background: #fff; +} + +.hover { + opacity: 0.6; +} + +.navigator { + display: inline-block; + background: #fff; + border-radius: 12rpx; + position: relative; +} + +.presell { + position: absolute; + width: 300rpx; + height: 40rpx; + background-color: rgba(247, 21, 21, 0.6); + z-index: 100; + top: 158rpx; + line-height: 20px; + text-align: center; + color: #fff; + margin-left: 20rpx; + font-size: 26rpx; +} + +.navigator:nth-of-type(2n+1) { + /* margin-right: 10rpx; */ +} + +.superscript { + position: absolute; + top: -10rpx; + left: -12rpx; + width: 86rpx; + height: 86rpx; + overflow: hidden; +} + +/* 使用背景色渐变 */ + +.superscript .gradual { + width: 100%; + height: 100%; + background: linear-gradient(135deg, #31b968 50%, transparent 50%); +} + +/* 使用三角形 */ + +.superscript .triangle { + width: 0; + height: 0; + border-top: 130rpx solid #31b968; + border-right: 130rpx solid transparent; +} + +/* 使用矩形旋转, 和父节点的 overflow:hidden 配合 */ + +.superscript .rect { + width: 176rpx; + height: 183rpx; + margin: -91rpx 0 0 -91rpx; + transform: rotateZ(45deg); +} + +.superscript .desc { + position: absolute; + top: 29%; + left: 16%; + z-index: 1; + color: #fff; + font-size: 23rpx; + transform: rotate(-45deg); +} + +.saleprice { + font-size: 24rpx; + display: inline-block; + margin-right: 10rpx; + font-weight: 400; +} diff --git a/components/getPhoen/getPhoen.js b/components/getPhoen/getPhoen.js new file mode 100644 index 0000000..098829f --- /dev/null +++ b/components/getPhoen/getPhoen.js @@ -0,0 +1,120 @@ +const config = require("../../config/config"); +const Http = require("../../utils/HttpBasics"); +// d:\fumaolianke\ttFmC\tt富茂C\components\getPhoen\getPhoen.js +Component({ + data: { + phone: "", + auth: "", + time: "获取验证码", + verFlag: true, + currentTime: 61, + setInter: '' + }, + properties: { + type: Boolean, + showBox: false + }, + + methods: { + getCode() { + var that = this; + var currentTime = that.data.currentTime + that.data.setInter = setInterval(function () { + currentTime--; + that.setData({ + time: currentTime + '秒' + }) + if (currentTime <= 0) { + clearInterval(that.data.setInter) + that.setData({ + time: '获取验证码', + currentTime: 61, + verFlag: true + }) + } + }, 1000) + }, + setPhone(e) { + this.setData({ + phone: e.detail.value + }) + }, + setAuth(e) { + this.setData({ + auth: e.detail.value + }) + }, + verify() { + let phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; + if (!this.data.verFlag) { + return + } + if (phoneReg.test(this.data.phone)) { + Http.get({ + url: config.api.sendValidationCode, + data: { + phone: this.data.phone, + type:6 + } + }).then(res => { + console.log(res, "res"); + this.setData({ + verFlag: false + }) + this.getCode() + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, // 内容 + icon: "none" + }); + }) + } else { + tt.showToast({ + title: '手机号有误', + icon: "none", + }) + } + + }, + hieBox(){ + this.triggerEvent("heiBox" ,false) + }, + hiePhoen(){ + this.triggerEvent("hiePhoen" ,false) + }, + send() { + let phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/; + if (phoneReg.test(this.data.phone)) { + if(this.data.auth!=""){ + Http.get({ + url: config.api.validationCode, + data: { + phone: this.data.phone, + code: this.data.auth, + type:6 + } + }).then(res => { + this.hiePhoen() + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, // 内容 + icon: "none" + }); + }) + }else{ + tt.showToast({ + title: '请输入验证码', + icon: "none", + }) + } + + } else { + tt.showToast({ + title: '手机号有误', + icon: "none", + }) + } + + } + } +}) \ No newline at end of file diff --git a/components/getPhoen/getPhoen.json b/components/getPhoen/getPhoen.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/getPhoen/getPhoen.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/getPhoen/getPhoen.ttml b/components/getPhoen/getPhoen.ttml new file mode 100644 index 0000000..25de3cf --- /dev/null +++ b/components/getPhoen/getPhoen.ttml @@ -0,0 +1,29 @@ + + + + 授权手机号 + + + + + + + {{time}} + + + 授权手机号 + + \ No newline at end of file diff --git a/components/getPhoen/getPhoen.ttss b/components/getPhoen/getPhoen.ttss new file mode 100644 index 0000000..87469e0 --- /dev/null +++ b/components/getPhoen/getPhoen.ttss @@ -0,0 +1,95 @@ +.box{ + width: 100%; + height: 100vh; + position: fixed; + top: 0; + left: 0; + background: rgba(0, 0, 0, 0.3); + z-index: 100000; +} +.phoneBox{ + position: absolute; + width: 80%; + /* height: 200rpx; */ + border-radius: 12rpx; + background-color: #f6f6f6; + transform: translate(-50%, -50%); + top: 50%; + left: 50%; + overflow: hidden; + +} +.userPhone{ + overflow: hidden; + margin: 20rpx ; +} +.inputPhone{ + float: left; + text-indent: 40rpx; + font-size: 28rpx; + color: #000; + letter-spacing: 0; + margin-top: 28rpx; + width: 50%; + display: block; +} +.btn{ + width: 210rpx !important; + border-radius: 16rpx; + margin-top: 12rpx; + margin-right: 30rpx; + font-size: 30rpx!important; + letter-spacing: 0; + padding: 0!important; + float: right; + height: 80rpx; + line-height: 80rpx; + background: #52a0fd; + color: #fff; + text-align: center; +} +.auth{ + width: 50%; + text-indent: 40rpx; + font-size: 28rpx; + color: #000; + letter-spacing: 0; + margin: 20rpx; +} +.send{ + width: 80%; + line-height: 80rpx; + height: 80rpx; + background: #52a0fd; + color: #fff; + font-size: 36rpx; + text-align: center; + margin: 40rpx auto 20rpx auto; + border-radius: 12rpx; + font-size: 30rpx; +} +.hiePhone{ + width: 80%; + + margin: 10rpx auto; + overflow: hidden; +} +.f{ + float: left; + font-size: 30rpx; + height: 60rpx; + line-height: 60rpx; + margin-left: 30%; +} +.r{ + width: 40rpx; + height: 40rpx; + /* line-height: 60rpx; */ + text-align: center; + float: right; + margin-top: 10rpx; + /* font-size: 30rpx; */ +} +input{ + text-align: left; +} \ No newline at end of file diff --git a/components/hot/hot.js b/components/hot/hot.js new file mode 100644 index 0000000..174cfd5 --- /dev/null +++ b/components/hot/hot.js @@ -0,0 +1,143 @@ +// pages/index/sw/index.js +let config = require("../../config/config.js"); +let Http = require("../../utils/HttpBasics"); +let app = getApp(); +const imgurl = require("../../utils/imgurl"); +const bgColor = require("../../utils/bgColor.js") +Component({ + /** + * 组件的属性列表 + */ + properties: {}, + + /** + * 组件的初始数据 + */ + data: { + sql: bgColor.colorFirst.main.sql, + txt: bgColor.colorFirst.main.txt, + change: imgurl.change.url, + None: imgurl.None.url, + jianUrl: imgurl.jian.url, + barginicon: imgurl.barginicon.url, + wangmeimeibargin: imgurl.wangmeimeibargin.url, + kData:[], + kSize:'', + pSize: '', + pData:[], + couponId:'', + couponId1: '', + }, + /** + * 组件的方法列表 + */ + methods: { + //获取砍价拼团数据 + getList(val) { + // debugger + let that = this; + let param = '' + if(val=='1'){ + param={ + targetAd : 6, + couponId: this.data.couponId + } + }else{ + param = { + targetAd : 7, + couponId: this.data.couponId1 + } + } + Http.get({ + url: config.api.change, + data:param, + }).then(res => { + if(res.data != undefined && res.data){ + if(val=='1'){ + that.setData({ + kData: res.data.data, + kSize: res.data.size, + couponId: res.data.data.couponId, + }); + }else{ + that.setData({ + pData: res.data.data, + pSize:res.data.size, + couponId1: res.data.data.couponId + }); + + } + } else { + if(val=='1'){ + that.setData({ + kData: '', + kSize: '', + couponId: '', + }); + }else{ + that.setData({ + pData: '', + pSize:'', + couponId1: '' + }); + + } + } + + }) + .catch(err => { + console.log(err) + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + // 换一换 + getChange(){ + let that = this + if (that.kSize != 1 && that.kSize != 0){ + that.getList(1) + } + if (that.pSize!=1 && that.pSize !=0) { + that.getList(2) + } + }, + //跳转砍价详情 + gotokjdetail: function (e) { + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${ + e.currentTarget.dataset.couponchannelid + }&couponId=${ + e.currentTarget.dataset.couponid + }&targetAd=${ + e.currentTarget.dataset.targetad + }` + }); + }, + //跳转拼团详情 + gotoptdetail: function (e) { + tt.navigateTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${ + e.currentTarget.dataset.couponchannelid + }&couponId=${ + e.currentTarget.dataset.couponid + }&targetAd=${ + e.currentTarget.dataset.targetad + }` + }); + }, + }, + ready() { + app.couponChannelListCallback = (token,val) => { + Http.setToken(token); + this.getList(1); + this.getList(2); + }; + if (app.globalData.token && app.globalData.token != null) { + app.couponChannelListCallback(app.globalData.token); + } + } +}); diff --git a/components/hot/hot.json b/components/hot/hot.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/hot/hot.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/hot/hot.ttml b/components/hot/hot.ttml new file mode 100644 index 0000000..ee25e65 --- /dev/null +++ b/components/hot/hot.ttml @@ -0,0 +1,59 @@ + + + + + 爆款专区 + + + 换一换 + + + + + + + + + + + + {{kData.title}} + ¥{{kData.priceStr}} + {{kData.salePriceStr}} + 砍价 + + + + + + + + 疯狂补货中… + 敬请期待 + 砍价 + + + + + + + + + {{pData.title}} + ¥{{pData.priceStr}} + {{pData.salePriceStr}} + 拼团 + + + + + + + + 疯狂补货中... + 敬请期待 + 拼团 + + + + diff --git a/components/hot/hot.ttss b/components/hot/hot.ttss new file mode 100644 index 0000000..82a3092 --- /dev/null +++ b/components/hot/hot.ttss @@ -0,0 +1,133 @@ + +@import "../../app.ttss"; +.hotBox{ + width:710rpx; + margin: 0 auto ; +} +.hotTitle{ + width: 100%; + height: 60rpx; + line-height: 60rpx; + font-size: 30rpx; + display: flex; + justify-content: space-between; + font-family:PingFangSC-Medium; +} +.titleL .titleR{ + width: 100rpx; +} +.titleR text{ + float: left; + margin-right: 10rpx; + font-family:PingFangSC-Regular!important; +} +.titleR view{ + height: 40rpx; + width: 40rpx; + /* margin-top: 10rpx; */ + float: left; +} +.titleR image{ + height: 28rpx; + width: 28rpx; +} +.sql{ + width:12rpx; + height:24rpx; + border-radius:8rpx; + float: left; + margin: 20rpx 10rpx 0 0; +} +.hotCon{ + width: 100%; +} +.kanjia, .pintuan{ + width: 346rpx; + height: 156rpx; + float: left; + border-radius: 12rpx; + display: flex; + justify-content: space-between; + position: relative; +} +.kanjia{ + margin-right: 18rpx; + background:linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%); +} +.pintuan{ + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); +} +.hotCon image{ + width: 86rpx; + height: 86rpx; + margin: 24rpx 0 46rpx 16rpx; +} +.hotCon .btn{ + width:80rpx; + height:44rpx; + line-height: 44rpx; + background:rgba(255,255,255,1); + border-radius:18rpx; + font-size: 24rpx; + position: absolute; + right: 20rpx; + bottom: 20rpx; + text-align: center; +} +.btnk{ + color: #2C8DFF; +} +.btnp{ + color: #FD782D; +} +.btnNone{ + width:80rpx; + height:44rpx; + line-height: 44rpx; + border-radius:18rpx; + font-size: 24rpx; + position: absolute; + right: 20rpx; + bottom: 20rpx; + text-align: center; + background:rgba(255,255,255,0.5) +} +.kjText,.ptText{ + color: #FFFFFF; + margin: 14rpx 10rpx 20rpx 10rpx; +} + +.title{ + width: 210rpx; + font-size: 30rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space:nowrap; + float: left; +} +.price{ + width: 128rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space:nowrap; + font-size: 22rpx; + text-decoration:line-through; + float: left; +} +.expect{ + width: 210rpx; + font-size: 22rpx; + float: left; +} +.sale{ + width: 140rpx; + font-size: 32rpx; + float: left; + margin-top: -8rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.sale text{ + font-size: 20rpx!important; +} diff --git a/components/navbar/img/back.svg b/components/navbar/img/back.svg new file mode 100644 index 0000000..614c029 --- /dev/null +++ b/components/navbar/img/back.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/navbar/img/home.svg b/components/navbar/img/home.svg new file mode 100644 index 0000000..b8fe7ed --- /dev/null +++ b/components/navbar/img/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/components/navbar/navbar.js b/components/navbar/navbar.js new file mode 100644 index 0000000..04910f3 --- /dev/null +++ b/components/navbar/navbar.js @@ -0,0 +1,83 @@ +const app = getApp() + +Component({ + + properties: { + background: { + type: String, + value: '#F4F5F9' + }, + color: { + type: String, + value: '#000' + }, + text: { + type: String, + value: 'Wechat' + }, + showLocationIf: { + type: Boolean, + value: false + }, + back: { + type: Boolean, + value: false + }, + home: { + type: Boolean, + value: false + } + }, + + data: { + array: ['A广场', 'B广场-北京西单'], + index: 1, + statusBarHeight: app.statusBarHeight + 'px', + navigationBarHeight: (app.statusBarHeight + 44) + 'px', + indexFlaig:null, + }, + methods: { + backHome: function () { + app.globalData.selected = 0 + let tempUrl = '/index/index' + tt.reLaunch({ + url: tempUrl, + success(res) { + console.log(`${res}`); + }, + fail(err) { + console.log(`navigateTo调用失败`,err,tempUrl); + }, + }); + }, + bindPickerChange: function (e) { + console.log('picker发送选择改变,携带值为', e.detail.value) + this.setData({ + index: e.detail.value + }) + }, + back:function() { + tt.navigateBack({ + delta: 1, + success(res) { + console.log(`${res}`); + }, + fail(err) { + console.log(`navigateTo调用失败`,err); + }, + }) + } + }, + attached: function(){ + this.setData({ + indexFlaig:app.globalData.selected + }) + let pages = getCurrentPages(); + console.log(pages.length); + if (pages.length <= 1) { + this.setData({ + back: false + }) + } + } +}) diff --git a/components/navbar/navbar.json b/components/navbar/navbar.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/navbar/navbar.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/navbar/navbar.ttml b/components/navbar/navbar.ttml new file mode 100644 index 0000000..01b8c13 --- /dev/null +++ b/components/navbar/navbar.ttml @@ -0,0 +1,20 @@ + + + + + + + + + + + + {{text}} + + + + {{array[index]}} + + + + \ No newline at end of file diff --git a/components/navbar/navbar.ttss b/components/navbar/navbar.ttss new file mode 100644 index 0000000..055b358 --- /dev/null +++ b/components/navbar/navbar.ttss @@ -0,0 +1,92 @@ +.navbar { + width: 100vw; + background-color: #F4F5F9; + position: fixed; + left: 0; + top: 0; + /* height:150rpx; */ + overflow: hidden; + z-index: 400000000; +} + +.title-container { + height: 44px; + display: flex; + align-items: center; + position: relative; +} + +.capsule { + margin-left: 10px; + height: 32px; + border: 1px solid #e1e1e3; + border-radius: 60px; + display: flex; + align-items: center; + padding: 0 20rpx; + background: #fff!important; +} + +.capsule > view { + width: 35px; + height: 60%; + position: relative; +} + +.capsule > view:nth-child(2) { + border-left: 1px solid #777; +} + +.capsule image { + width: 70%; + height: 100%; + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%,-50%); +} + +.title { + color: #000; + position: absolute; + left: 104px; + right: 104px; + font-weight: 600; + font-size: 32rpx; + text-align: center; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +@font-face { + font-family: 'iconfont'; /* project id 1353695 */ + src: url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.eot'); + src: url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.eot?#iefix') format('embedded-opentype'), + url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.woff2') format('woff2'), + url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.woff') format('woff'), + url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.ttf') format('truetype'), + url('//at.alicdn.com/t/font_1353695_nyv2ld9xqk8.svg#iconfont') format('svg'); +} +.iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-daohangdizhiweizhi:before { + content: "\e787"; +} +.locations{ + font-size: 28rpx; + display: inline-block; + width: 200rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.pick-box{ + width: 260rpx; + padding-left: 20rpx; +} \ No newline at end of file diff --git a/components/optimization/optimization.js b/components/optimization/optimization.js new file mode 100644 index 0000000..58bfb32 --- /dev/null +++ b/components/optimization/optimization.js @@ -0,0 +1,45 @@ +// components/optimization/optimization.js +Component({ + /** + * 组件的属性列表 + */ + properties: { + businessList:{ + type:Array, + value:[] + }, + businessData: { + type: Array, + value: [] + }, + }, + + /** + * 组件的初始数据 + */ + data: { + classIndex:0 + }, + + /** + * 组件的方法列表 + */ + methods: { + goDetail(e){ + let couponChannelId = e.currentTarget.dataset.id + let couponId = e.currentTarget.dataset.couponid + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`, + }) + }, + setIndex(e){ + let index = e.currentTarget.dataset.index + let id = e.currentTarget.dataset.id + this.triggerEvent('businessid',id) + this.setData({ + classIndex:index + }) + } + + } +}) diff --git a/components/optimization/optimization.json b/components/optimization/optimization.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/optimization/optimization.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/optimization/optimization.ttml b/components/optimization/optimization.ttml new file mode 100644 index 0000000..8db3b72 --- /dev/null +++ b/components/optimization/optimization.ttml @@ -0,0 +1,40 @@ + + + 优选好物 + Preferred Good + + + + + + {{item.title}} + + + + + + + + + + + {{item.title}} + + + + {{item.salePriceStrQ?item.salePriceStrQ:item.salePriceStr}} + {{item.salePriceStrH?'.'+item.salePriceStrH:''}} + + 已售 {{item.sale}} + + ¥{{item.priceStr}} + + + + + + + + + + \ No newline at end of file diff --git a/components/optimization/optimization.ttss b/components/optimization/optimization.ttss new file mode 100644 index 0000000..a1698c8 --- /dev/null +++ b/components/optimization/optimization.ttss @@ -0,0 +1,202 @@ +.optimizationBox { + /* overflow: hidden; */ + margin-top: 20rpx; + } + + .titleImg { + width: 96%; + height: 80rpx; + margin: 0rpx auto; + background-image: url("https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_ggw_yxhw.png"); + background-size: 100% 100%; + background-repeat: no-repeat; + } + + .textl { + font-size: 34rpx; + font-family: OPPOSans; + font-weight: bold; + color: #dfbe99; + margin: 20rpx; + } + + .textr { + font-size: 30rpx; + font-family: OPPOSans; + font-weight: 300; + color: #91897e; + margin: 20rpx; + } + + .f { + float: left; + } + + .r { + float: right; + } + + .classifyBox { + width: 100%; + border-radius: 20rpx 20rpx 0 0; + background-color: #fff; + overflow: hidden; + display: -webkit-box; + overflow-x: scroll; + -webkit-overflow-scrolling: touch; + /* margin: 10rpx 0; *//* background: linear-gradient(0deg, #F5F5F5, #fff); */ + } + + .classifyBox::-webkit-scrollbar { + display: none; + } + + .itemBox { + width: 100rpx; + height: 100rpx; + margin: 0 20rpx; + } + + .className { + font-size: 28rpx; + font-family: OPPOSans; + font-weight: 500; + color: #454340; + text-align: center; + margin: 20rpx auto 10rpx auto; + } + + .className_a { + font-size: 30rpx; + font-family: OPPOSans; + font-weight: 800; + color: #c99f67; + text-align: center; + background: linear-gradient(180deg, #cc9a60 0%, #dfbf8e 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + margin: 20rpx auto 10rpx auto; + } + .xian{ + width: 22rpx; + height: 5rpx; + background: linear-gradient(180deg, #D5A56E, #E9D0AA); + border-radius: 3px; + margin: 0 auto; + } + .contBox{ + background: linear-gradient(0deg, #F5F5F5, rgba(255, 255, 255, 0.5)); + /* height: 350rpx; */ + } + .contLsitBox{ + width: 96%; + margin: 0 auto; + display: flex; + overflow: hidden; + justify-content: space-between; + flex-wrap: wrap; + + } + .item{ + width: 49%; + background-color: #fff; + border-radius: 20rpx; + margin: 12rpx 0; + position: relative; + } + .itemImg{ + width: 100%; + height: 350rpx; + border-radius: 20rpx; + /* background-color: aquamarine; */ + } + .itemImg image{ + width: 100%; + height: 100%; + border-radius: 20rpx 20rpx 0 0; + } + .titleName{ + width:90%; + height: 80rpx; + font-size: 28rpx; + font-family: OPPOSans; + font-weight: 500; + color: #333333; + margin: 10rpx auto 0 auto; + + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + white-space:normal; + + } + .priceBox{ + width: 90%; + overflow: hidden; + margin: 10rpx auto; + } + .f{ + float: left; + } + .r{ + float:right; + } + .sellingBox{ + overflow: hidden + } + .fuhao{ + color: #DF2D2D; + font-size: 24rpx; + float: left; + font-family: OPPOSans; + /* font-weight: bold; */ + margin-top: 10rpx + } + .int{ + float: left; + font-size: 36rpx; + font-family: OPPOSans; + font-weight: bold; + color: #DF2D2D; + } + .originalBox{ + overflow: hidden + } + .origina{ + text-align: right; + font-size: 24rpx; + font-family: OPPOSans; + font-weight: 400; + text-decoration: line-through; + color: #999999; + margin-top: 10rpx; + margin-right: 10rpx; + } + .priceNum{ + text-align: right; + font-size: 24rpx; + font-family: OPPOSans; + font-weight: 400; + + color: #999999; + margin-top: 10rpx; + /* margin-right: 10rpx; */ + } + .sellout{ + position: absolute; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.5); + width: 100%; + height: 100%; + border-radius: 20rpx; + } + + .selloutImg{ + width: 195rpx !important; + height: 154rpx !important; + margin: 50% auto; + display: block + } \ No newline at end of file diff --git a/components/store/index.js b/components/store/index.js new file mode 100644 index 0000000..d398f64 --- /dev/null +++ b/components/store/index.js @@ -0,0 +1,79 @@ +const imgurl = require("../../utils/imgurl"); +Component({ + /** + * 组件的属性列表 + */ + properties: { + merchantVoList: { + value: [], + type: Array + } + }, + + /** + * 组件的初始数据 + */ + data: { + teljpgUrl: imgurl.teljpg.url, + showMore:false, + more: "点击查看更多", + hidden:"hidden", + height: "" + }, + + /** + * 组件的方法列表 + */ + methods: { + /** + * 跳转到门店列表的详情页面 + */ + gotoDetail(e) { + tt.navigateTo({ + url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}` + }) + }, + // 点击查看更多 + more: function () { + console.log(this.properties.merchantVoList,"merchantVoList"); + let that = this; + if (that.data.more == '点击查看更多') { + this.setData({ + hidden: "", + height: 'auto!important', + more: "点击收起", + showMore: true + }) + } else { + that.setData({ + hidden: "hidden", + height: 4 * 140 + 'rpx', + more: "点击查看更多", + showMore: true + }) + } + }, + phone: function (e) { + let that = this; + tt.makePhoneCall({ + phoneNumber: e.target.dataset.merchantlinkphone + }); + } + }, + ready: function () { + let merchantVoList = this.properties.merchantVoList; + if (merchantVoList.length>0){ + if (merchantVoList.length <= 4) { + this.setData({ + height: merchantVoList.length * 140 + 'rpx', + showMore: false, + hidden:"hidden" + }) + } else if (merchantVoList && merchantVoList.length > 4) { + this.setData({ + height: 4 * 140 + 'rpx' + }) + } + } + } +}); diff --git a/components/store/index.json b/components/store/index.json new file mode 100644 index 0000000..32640e0 --- /dev/null +++ b/components/store/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} \ No newline at end of file diff --git a/components/store/index.ttml b/components/store/index.ttml new file mode 100644 index 0000000..2c7c2e1 --- /dev/null +++ b/components/store/index.ttml @@ -0,0 +1,19 @@ +适用门店 + + + +{{more}} \ No newline at end of file diff --git a/components/store/index.ttss b/components/store/index.ttss new file mode 100644 index 0000000..9defcf3 --- /dev/null +++ b/components/store/index.ttss @@ -0,0 +1,76 @@ +.applyshop { + font-size: 30rpx; + height: 70rpx; + line-height: 70rpx; + text-indent: 1em; + color: #333; + background: #fff; + } + + .posi { + position: relative; + width: 100%; + background: #FFF; + } + .posi_logo { + position: relative; + width: 92%; + display: flex; + padding: 20rpx 0; + background: #fff; + margin: 0 auto; + } + + .posi_logo view:nth-child(1) { + border-radius: 16rpx; + } + + .posi_logo view:nth-child(1) image { + display: block; + width: 100rpx; + height: 100rpx; + border-radius: 16rpx; + margin-right: 16rpx; + border: 1px solid #e5e5e5; + } + .name{ + font-size: 32rpx; + color: #333; + letter-spacing: 0; + width: 500rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + } + .posi_logo view:nth-child(2) view { + font-size: 32rpx; + color: #333; + letter-spacing: 0; + } + + .shopVoList { + display: flex !important; + padding-left: 0 !important; + flex-direction: row !important; + } + + .shopVoList text { + font-size: 20rpx !important; + color: #b8b8b8 !important; + } + .bottom{ + background: #fff; + color: #666; + text-align: center; + padding: 20rpx 0; + font-size: 32rpx; + } + .tel { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 50rpx; + height: 50rpx; + } \ No newline at end of file diff --git a/components/tabbar/tabbar.js b/components/tabbar/tabbar.js new file mode 100644 index 0000000..e7fb22c --- /dev/null +++ b/components/tabbar/tabbar.js @@ -0,0 +1,72 @@ +const Http = require("../../utils/HttpBasics"); +var config = require("../../config/config.js"); +let app = getApp(); + +Component({ + data: { + selected: null, + "color": "#abb1be", + "selectedColor": "#fc3e5a", + list: [ + { + "pagePath": "/index/index", + "text": "首页", + "iconPath": "../../assets/images/home.png", + "selectedIconPath": "../../assets/images/home_a.png" + }, + { + "pagePath": "/index/searchbar", + "text": "门店", + "iconPath": "../../assets/images/portal.png", + "selectedIconPath": "../../assets/images/portal_a.png" + }, + { + "pagePath": "/pages/order/index/index", + "text": "订单", + "iconPath": "../../assets/images/dindan.png", + "selectedIconPath": "../../assets/images/dindan_a.png" + }, + { + "pagePath": "/index/user", + "text": "我的", + "iconPath": "../../assets/images/user.png", + "selectedIconPath": "../../assets/images/user_a.png" + } + ] + }, + properties: { + + }, + lifetimes: { + attached: function () { + // 在组件实例进入页面节点树时执行 + console.log(app.globalData.selected,'selected'); + this.setData({ + selected:app.globalData.selected + }) + }, + detached: function () { + // 在组件实例被从页面节点树移除时执行 + }, + }, + methods: { + navigateTo(e) { + + // this.setData({ + // list: this.data.home_a_img + // }) + // console.log(this.data.home_a_img) + + const data = e.currentTarget.dataset; + // this.setData({ + // selected: data.index + // }) + app.globalData.selected = data.index + console.log(app.globalData.selected); + const url = data.path; + tt.reLaunch({ + url + }); + }, + } +}) \ No newline at end of file diff --git a/components/tabbar/tabbar.json b/components/tabbar/tabbar.json new file mode 100644 index 0000000..e8cfaaf --- /dev/null +++ b/components/tabbar/tabbar.json @@ -0,0 +1,4 @@ +{ + "component": true, + "usingComponents": {} +} \ No newline at end of file diff --git a/components/tabbar/tabbar.ttml b/components/tabbar/tabbar.ttml new file mode 100644 index 0000000..e79b132 --- /dev/null +++ b/components/tabbar/tabbar.ttml @@ -0,0 +1,8 @@ + + + + + {{item.text}} + + + \ No newline at end of file diff --git a/components/tabbar/tabbar.ttss b/components/tabbar/tabbar.ttss new file mode 100644 index 0000000..117e2f7 --- /dev/null +++ b/components/tabbar/tabbar.ttss @@ -0,0 +1,41 @@ +.tab-bar { + position: fixed; + bottom: 0; + left: 0; + right: 0; + height: 70rpx; + padding: 10rpx; + background: white; + display: flex; + padding-bottom: env(safe-area-inset-bottom); + overflow: hidden; + } + + .tab-bar-border { + background-color: rgba(0, 0, 0, 0.33); + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 1px; + transform: scaleY(0.5); + } + + .tab-bar-item { + flex: 1; + text-align: center; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + } + + .tab-bar-item image { + width: 46rpx; + height: 46rpx; + } + + .tab-bar-item view { + font-size: 20rpx; + } + \ No newline at end of file diff --git a/config/config.js b/config/config.js new file mode 100644 index 0000000..d78a6e1 --- /dev/null +++ b/config/config.js @@ -0,0 +1,398 @@ +var config = { + api: { + /* + *欢乐城首页专题 + */ + showList:"/topic/showList", + /* + *记录微信订阅 + */ + activityDey:"/wxActivity/listStatus",//活动日历日期 + activityCalendar:'/wxActivity/list',//活动日历列表 + signDey:"/userSign/listStatus",//签到日期列表 + continuousDye:"/userSign/signInStatus",//连续签到天数 + userSign:"/userSign/signIn",//签到 + signRule:"/credit/credit_rules",//签到规则 + wxMsg: '/user/updateMsg', + /** + * 获取首页按钮 + */ + wxCustomizeModule:"/wxCustomizeModule/list", + /** + * 微信消息推送获取模板id + */ + templateId: "/wxMsg/templateList", + //问卷列表 + questionnaire :"/wxQuestionOneself/list", + //问卷详情 + questionnaireDetail:"/wxQuestionOneself/detailsById", + //提交问卷 + submitQuestin:"/wxQuestionOneself/userAdd", + //投诉建议add + suggest:"/wxOpinion/add", + /** + * 接口用途:login + */ + login: "/user/login", + /** + * 授权后获取用户的昵称,unionId等信息 + */ + getUserInfo: "/user/getUserInfo", + //图片上传 + imgUpload: '/upload/awsFileUpload', + /** + * 接口用途:授权后获取用户的手机号 + */ + getUserPhone: "/user/getUserPhone", + /** + * 检查用户授权状态 + */ + checkUserStatus: "/user/checkUserStatus", + /** + * 检查用户手机授权状态 + */ + checkPhoneStatus: "/user/checkPhoneStatus", + /** + * 商户优惠信息 + */ + listByMerchant: "/wxCouponChannel/listByMerchant", + /** + * 优惠券详情 + */ + couponDetail: "/wxCoupon/detail", + /** + * 购物车订单详情 + */ + goodsDetail:"/order/goodsDetail", + /** + * 优惠券图文混排详情 + */ + couponHtmlDetail: "/wxCoupon/html", + couponHtmlDetailForPkg: "/couponOrder/html", + /** + * 获取样式 + */ + setType: '/wxMiniappTheme/getOne', + /** + * 业态查询 + * filter + * 2 券 + * 1 商户 + */ + businessList: "/wxBusiness/listAll", + /** + * 频道查询 + */ + couponChannelList: "/wxCouponChannel/list", + /** + * 换一换change + */ + change: "/wxCouponChannel/change", + /** + * 下订单 + */ + orderSave: "/order/save", + /** + * 多少量下单 + */ + goodsShopCartSave:"/order/goodsShopCartSave", + /** + * 支付订单 + */ + payOrderCreate: "/pay/create", + /** + * 订单状态更新 + */ + payOrderUpdate: "/pay/updatePayOrder", + /** + * 订单列表 /order/list + */ + orderList: "/order/listGoods_v1", + + getWeRunData: '/user/getWeRunData', + /** + * 订单详情 + */ + orderDetail: "/order/detail_v1", + // 券包详情 + // orderDetailAll: "/order/detail_v1", + /** + * 券包 + */ + couponOrderList: "/couponOrder/list", + /** + * 券包详情 + */ + couponOrderDetail: "/couponOrder/detail", /// TODO + /** + * 验证码发送 + */ + sendValidationCode: "/wxMsgValidationcode/sendvalidationcode", + /** + * 验证码确认 + */ + validationCode: "/wxMsgValidationcode/hasvalidationcode", + /** + * 车场信息获取 + */ + scoreLevelInfo: '/mall/scoreLevelInfo', + getParkInfo: "/wxPark/info", + /** + * 用户所绑车牌获取 + */ + userCarCount: "/user/carCount", + /** + * 用户所绑车牌获取 + */ + getUserCarList: "/user/carList", + /** + * 联合登录 + */ + carInit: "/car/init", + /** + * 绑车牌 + */ + bindCar: "/car/bindCar", + /** + * 解绑车牌 + */ + unbindCar: "/car/unbindCar", + /** + * 停车费 + */ + getCarStopFee: "/car/getCarStopFee", + /** + * 停车费抵扣 (TJD) + */ + deductionFee: "/car/deductionFee", + /** + * 优免券领取 + */ + getCarCoupon: "/car/getCoupon", + /** + * 停车券包 + */ + couponOrderCarList: "/car/couponOrderList", + /** + * banner + */ + bannerlist: "/wxCampaign/list", + /** + * banner详情页面 + */ + bannerDetail: "/wxCampaign/findById", + /** + * 授权个人信息 + * 和授权手机号 + * 和login页面 + * 页面的图标 + */ + marketicon: '/mall/getAppIcon', + /** + * 获取停车场状态 + */ + getParkStatus: '/car/getParkStatus', + /** + * 检查核销的状态 + */ + getStatus: "/couponOrder/getStatus", + /** + * 获得成长值 + */ + getScore: '/user/userinfo', + /** + * 小程序分享 + * title + * 描述 + */ + getWeapNote: '/mall/getWeapNote', + /** + * 商场信息(小程序分享) + */ + getMallInfo: '/mall/mallInfo', + /** + * 小程序获取游戏路径 + */ + getGame: '/game/getOne', + /** + * 小程序获取广告路径 + */ + getGg: '/floatingLayer/getFloatingLayer', + /** + * 小程序某一个游戏信息 + */ + getOneGame: '/game/getOneGame', + /** + * 用户更新信息 + */ + updateInfo: "/user/updateUserInfo", + /** + * 查询问卷 + */ + getQuestion: "/wxQuestion/getQuestion", + /** + * 提交问卷 + */ + answerQuestion: "/wxQuestion/answerQuestion", + /** + * + 获取打折商户列表 + */ + discountMerchantList: "/mall/discountMerchantList", + /** + * 卡包分页列表接口 + */ + cardorderList: "/couponOrder/cardList", + /** + * 卡券详情接口 + */ + cardDetail: "/couponOrder/cardDetail", + /** + * C端扫B端储值卡支付订单 + */ + cardPayOrder: "/cardPay/order_create", + /** + * 兑换历史列表 + */ + scoreHistory: "/scoreHistory/list", + /** + * 获取用户折扣率 + */ + getDiscountInfo: "/user/getDiscountInfo", + /** + * C端扫B端储值卡交易流水列表接口 + */ + cardpayList: "/cardPay/list", + /** + * 根据code查询接口 + */ + findByCode: "/merchant/findByCode", + /** + * 参与砍价 + */ + pressOrderJoin: "/press/pressOrderJoin", + /** + * 我的砍价列表 + */ + pressOrderList: "/order/pressOrderList", + /** + * 砍价订单详情 + */ + pressOrderDetail: "/order/pressOrderDetail", + /** + * + */ + getPressOrderStatus: "/press/getPressOrderStatus", + /** + * 查询转赠卡状态 + */ + queryCardStatus: "/couponOrder/queryCardStatus", + /** + * 领取转赠卡 + */ + cardAccept: '/couponOrder/cardAccept', + /** + * 获取我的拼团列表 + */ + getMySepllList: '/orderGroup/queryOrderGroup', + /** + *查询差1个的团购信息 + */ + queryRemainOne: '/orderGroup/queryRemainOne', + /** + * *分页列表接口 + */ + merchantList: "/merchant/list", + /* + * 查询拼团状态 + */ + queryOrderGroupStatus: '/orderGroup/queryOrderGroupStatus', + /** + * 去拼团 + */ + toOrderGroup: '/orderGroup/toOrderGroup', + /** + * 查询是否已参团 + */ + queryAttendStatus: '/orderGroup/queryAttendStatus', + /** + * 专题 + */ + topicShow: "/topic/show", + /** + * 专题详情 + */ + topicFindById: "/topic/findById", + /** + * 积分券详情 + */ + integralDetail: '/wxCoupon/findById', + /** + * 会员积分记录 + */ + integralList: '/credit/list', + /** + * 用户更新位置信息 + */ + updateLBS: "/user/updateLBS", + /** + * 用户更新信息 + */ + updateUserInfo: "/user/updateUserInfo", + /** + * 用户更新scene + */ + updateScene: "/user/updateScene", + /** + * 富文本详情 + */ + printHtmlById: "/wxCampaign/printHtmlById", + acfindById: "/wxActivity/findById", + acPrintHtmlById: "/wxActivity/printHtmlById", + //参与活动 + activityJoin: "/wxActivityJoin/join", + //签到 + activitySign: "/wxActivityJoin/sign", + activityList: "/wxActivityJoin/list", + //获取未支付的订单 + getUnPaidOrder: "/order/getUnPaidOrder", + getCouponOrderByPassword: '/couponPassword/getCouponOrderByPassword', + getbuildingfloorlist: '/wxMallBuilding/getbuildingfloorlist', + //商场信息接口 + getMallInfo: "/mall/mallInfo", + // 获取楼层楼座数据 + getbuildingfloorlist: "/wxMallBuilding/getbuildingfloorlist", + // 获取所有直播间和商品信息 + getReplayList: "/live/replayList", + // 获取直播房间回放数据和商品信息 + getRoomList: "/live/roomList", + //商城地图 + getStoreMap:"/wxMallBuilding/getbuildingfloorlist", + //判断有没有蜂鸟地图 + ifFengMap:'/fengniaomap/getConfig', + //分享小程序二维码 + getQrcodeFx:"/user/userinfoQrCode", + //添加收货地址 + collectSite:"/userBasicInfoAddress/saveOrUpdate", + //收货地址列表 + siteList: "/userBasicInfoAddress/list", + //查询收货地址 + siteCheck: "/userBasicInfoAddress/findById", + //删除收获地址 + siteDel: "/userBasicInfoAddress/del", + //确认收货 + verify:"/couponOrder/verify", + //全包下订单 + couponPackageSave :"/order/couponPackageSave", + + + //获取动态核销码 + dynamicId:"/couponOrder/dynamicId" + }, +}; +/* +for (var key in config.api) { + config.api[key] = apiPrefix + config.api[key]; +} +*/ +module.exports = config; \ No newline at end of file diff --git a/dist/badge/index.js b/dist/badge/index.js new file mode 100644 index 0000000..2b9fb30 --- /dev/null +++ b/dist/badge/index.js @@ -0,0 +1,29 @@ +Component({ + externalClasses: ['i-class', 'i-class-alone'], + + properties: { + count: { + type: Number, + value: 0, + observer: 'finalCount' + }, + overflowCount: { + type: Number, + value: 99 + }, + dot: { + type: Boolean, + value: false + }, + }, + data: { + finalCount: 0 + }, + methods: { + finalCount() { + this.setData({ + finalCount: parseInt(this.data.count) >= parseInt(this.data.overflowCount) ? `${this.data.overflowCount}+` : this.data.count + }); + }, + } +}); diff --git a/dist/badge/index.json b/dist/badge/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/dist/badge/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/dist/badge/index.ttml b/dist/badge/index.ttml new file mode 100644 index 0000000..1289043 --- /dev/null +++ b/dist/badge/index.ttml @@ -0,0 +1,5 @@ + + + + {{ finalCount }} + diff --git a/dist/badge/index.ttss b/dist/badge/index.ttss new file mode 100644 index 0000000..281658f --- /dev/null +++ b/dist/badge/index.ttss @@ -0,0 +1 @@ +.i-badge{position:relative;display:inline-block;line-height:1;vertical-align:middle}.i-badge-count{position:absolute;transform:translateX(50%);top:-6px;right:0;height:18px;border-radius:9px;min-width:18px;background:#ed3f14;border:1px solid transparent;color:#fff;line-height:18px;text-align:center;padding:0 5px;font-size:12px;white-space:nowrap;transform-origin:-10% center;z-index:10;box-shadow:0 0 0 1px #fff;box-sizing:border-box;text-rendering:optimizeLegibility}.i-badge-count-alone{top:auto;display:block;position:relative;transform:translateX(0)}.i-badge-dot{position:absolute;transform:translateX(-50%);transform-origin:0 center;top:-4px;right:-8px;height:8px;width:8px;border-radius:100%;background:#ed3f14;z-index:10;box-shadow:0 0 0 1px #fff} \ No newline at end of file diff --git a/dist/button/index.js b/dist/button/index.js new file mode 100644 index 0000000..f0e9b3e --- /dev/null +++ b/dist/button/index.js @@ -0,0 +1,80 @@ +Component({ + externalClasses: ['i-class'], + + properties: { + // default, primary, ghost, info, success, warning, error + type: { + type: String, + value: '', + }, + inline: { + type: Boolean, + value: false + }, + // default, large, small + size: { + type: String, + value: '', + }, + // circle, square + shape: { + type: String, + value: 'square' + }, + disabled: { + type: Boolean, + value: false, + }, + loading: { + type: Boolean, + value: false, + }, + long: { + type: Boolean, + value: false + }, + openType: String, + appParameter: String, + hoverStopPropagation: Boolean, + hoverStartTime: { + type: Number, + value: 20 + }, + hoverStayTime: { + type: Number, + value: 70 + }, + lang: { + type: String, + value: 'en' + }, + sessionFrom: { + type: String, + value: '' + }, + sendMessageTitle: String, + sendMessagePath: String, + sendMessageImg: String, + showMessageCard: Boolean + }, + + methods: { + handleTap () { + if (this.data.disabled) return false; + + this.triggerEvent('click'); + }, + bindgetuserinfo({ detail = {} } = {}) { + this.triggerEvent('getuserinfo', detail); + }, + bindcontact({ detail = {} } = {}) { + this.triggerEvent('contact', detail); + }, + bindgetphonenumber({ detail = {} } = {}) { + this.triggerEvent('getphonenumber', detail); + }, + binderror({ detail = {} } = {}) { + this.triggerEvent('error', detail); + } + } +}); diff --git a/dist/button/index.json b/dist/button/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/dist/button/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/dist/button/index.ttml b/dist/button/index.ttml new file mode 100644 index 0000000..43c7826 --- /dev/null +++ b/dist/button/index.ttml @@ -0,0 +1,20 @@ + \ No newline at end of file diff --git a/dist/button/index.ttss b/dist/button/index.ttss new file mode 100644 index 0000000..5fe394b --- /dev/null +++ b/dist/button/index.ttss @@ -0,0 +1,39 @@ +.i-btn{ + text-align:center; + vertical-align:middle; + touch-action:manipulation; + cursor:pointer; + background-image:none; + white-space:nowrap; + user-select:none; + font-size:14px; + border-radius:2px; + border:0!important; + position:relative; + text-decoration:none; + height:44px; + line-height:44px; + box-shadow:inset 0 0 0 1px rgba(0,0,0,.1); + color:#fff!important; + background:#f7f7f7; + color:#495060; + margin:10px +} +.i-btn-hover{opacity:.9} +.i-btn-long{border-radius:0;margin:0;box-shadow:none} +.i-btn-large{height:48px;line-height:48px} +.i-btn-small{height:40px;line-height:40px} +.i-btn-primary{color:#fff!important;background:#2d8cf0!important} +.i-btn-ghost{color:#fff!important;background:#fff!important;color:#495060!important} +.i-btn-success{color:#fff!important;background:#19be6b!important} +.i-btn-warning{color:#fff!important;background:#f90!important} +.i-btn-error{color:#fff!important;background:#ed3f14!important} +.i-btn-info{color:#fff!important;background:#2db7f5!important} +.i-btn-circle{border-radius:44px} +.i-btn-large.i-btn-circle{border-radius:48px} +.i-btn-small.i-btn-circle{border-radius:40px} +.i-btn-loading{opacity:.6} +.i-btn-loading-inner{display:inline-block;margin-right:12px;vertical-align:middle;width:14px;height:14px;background:0 0;border-radius:50%;border:2px solid #fff;border-color:#fff #fff #fff transparent;animation:btn-spin .6s linear;animation-iteration-count:infinite} +.i-btn-disabled{color:#bbbec4!important;background:#f7f7f7!important} +.i-btn-inline{display:inline-block}@keyframes btn-spin{0%{transform:rotate(0)}100%{transform:rotate(360deg)}} +button::after{ border: none; } \ No newline at end of file diff --git a/dist/sticky-item/index.js b/dist/sticky-item/index.js new file mode 100644 index 0000000..a00af0f --- /dev/null +++ b/dist/sticky-item/index.js @@ -0,0 +1,40 @@ +Component({ + externalClasses: ['i-class'], + options: { + multipleSlots: true + }, + relations : { + '../sticky/index' : { + type : 'parent' + } + }, + data : { + top : 0, + height : 0, + isFixed : false, + index : -1, + }, + methods: { + updateScrollTopChange(scrollTop){ + const data = this.data; + const top = data.top; + const height = data.height; + this.setData({ + isFixed : ( scrollTop >= top && scrollTop < top + height ) ? true : false + }) + }, + updateDataChange(index) { + const className = '.i-sticky-item'; + const query = tt.createSelectorQuery().in(this); + query.select( className ).boundingClientRect((res)=>{ + if( res ){ + this.setData({ + top : res.top, + height : res.height, + index : index + }) + } + }).exec() + } + } +}) \ No newline at end of file diff --git a/dist/sticky-item/index.json b/dist/sticky-item/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/dist/sticky-item/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/dist/sticky-item/index.ttml b/dist/sticky-item/index.ttml new file mode 100644 index 0000000..613a5c0 --- /dev/null +++ b/dist/sticky-item/index.ttml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/dist/sticky-item/index.ttss b/dist/sticky-item/index.ttss new file mode 100644 index 0000000..7328f0f --- /dev/null +++ b/dist/sticky-item/index.ttss @@ -0,0 +1 @@ +.i-sticky-item-header{background:#eee;font-size:14px;width:100%;height:32px;line-height:32px}.i-sticky-item-content{font-size:14px}.i-sticky-title{width:100%;padding:0 15px;box-sizing:border-box;background:#eee}.i-sticky-fixed .i-sticky-title{position:fixed;top:0} \ No newline at end of file diff --git a/dist/sticky/index.js b/dist/sticky/index.js new file mode 100644 index 0000000..2352a68 --- /dev/null +++ b/dist/sticky/index.js @@ -0,0 +1,64 @@ +Component({ + externalClasses: ['i-class'], + properties : { + scrollTop : { + type : Number, + observer(val){ + this._updateScrollTopChange(); + } + } + }, + relations : { + '../sticky-item/index' : { + type : 'child', + linked(){ + this._updateDataChange(); + }, + linkChanged () { + this._updateDataChange(); + }, + unlinked () { + this._updateDataChange(); + } + } + }, + data : { + timer : null, + itemLength : 0, + }, + methods : { + _updateScrollTopChange(){ + const stickies = this.getRelationNodes('../sticky-item/index'); + console.log(stickies,"stickies"); + if(stickies && stickies.length > 0 ){ + stickies.forEach((item) => { + if( item ){ + item.updateScrollTopChange( this.data.scrollTop ); + } + }) + } + }, + _updateDataChange( ){ + const stickies = this.getRelationNodes('../sticky-item/index'); + if(stickies && stickies.length > 0 ){ + if( this.data.timer ){ + clearTimeout( this.data.timer ) + this.setData({ + timer : null + }) + } + this.data.timer = setTimeout(()=>{ + stickies.forEach((item,index) => { + if( item ){ + item.updateDataChange(index); + } + }) + },0) + this.setData({ + timer : this.data.timer + }) + } + } + } + +}) \ No newline at end of file diff --git a/dist/sticky/index.json b/dist/sticky/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/dist/sticky/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/dist/sticky/index.ttml b/dist/sticky/index.ttml new file mode 100644 index 0000000..aee0c63 --- /dev/null +++ b/dist/sticky/index.ttml @@ -0,0 +1,3 @@ + + + diff --git a/dist/sticky/index.ttss b/dist/sticky/index.ttss new file mode 100644 index 0000000..e69de29 diff --git a/dist/tab/index.js b/dist/tab/index.js new file mode 100644 index 0000000..eed380f --- /dev/null +++ b/dist/tab/index.js @@ -0,0 +1,50 @@ +Component({ + externalClasses: ["i-class"], + + relations: { + "../tabs/index": { + type: "parent" + } + }, + + properties: { + key: { + type: String, + value: "" + }, + title: { + type: String, + value: "" + }, + dot: { + type: Boolean, + value: false + }, + count: { + type: Number, + value: 0 + } + }, + + data: { + current: false, + currentColor: "", + scroll: false + }, + + methods: { + changeCurrent(current) { + this.setData({ current }); + }, + changeCurrentColor(currentColor) { + this.setData({ currentColor }); + }, + changeScroll(scroll) { + this.setData({ scroll }); + }, + handleClickItem() { + const parent = this.getRelationNodes("../tabs/index")[0]; + parent.emitEvent(this.data.key); + } + } +}); diff --git a/dist/tab/index.json b/dist/tab/index.json new file mode 100644 index 0000000..eb6877d --- /dev/null +++ b/dist/tab/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": + { + "i-badge": "../badge/index" + } +} diff --git a/dist/tab/index.ttml b/dist/tab/index.ttml new file mode 100644 index 0000000..71aa650 --- /dev/null +++ b/dist/tab/index.ttml @@ -0,0 +1,10 @@ + + + + {{ + title }} + {{ title }} + + + + \ No newline at end of file diff --git a/dist/tab/index.ttss b/dist/tab/index.ttss new file mode 100644 index 0000000..ce9e7ca --- /dev/null +++ b/dist/tab/index.ttss @@ -0,0 +1,48 @@ +.i-tabs-tab { + flex: 1; + display: flex; + width: 100%; + -webkit-box-pack: center; + justify-content: center; + -webkit-box-align: center; + align-items: center; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + flex-direction: column; + text-align: center; + position: relative +} + +.i-tabs-tab-bar { + display: block; + width: 72%; + height: 8rpx; + background: 0 0; + position: absolute; + bottom: 0; + left: 15%; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius: 100px; +} + +.i-tabs-tab-title { + font-size: 26rpx; + line-height: 30rpx; + text-align: center; + box-sizing: border-box; + color: #A6A6A6; +} + +.i-tabs-tab-title-current { + color: #3C3C3C; + font-size: 30rpx; + font-weight: 500; + font-family:PingFangSC-Medium; +} + +.i-tabs-tab-scroll { + display: inline-block; + width: auto; + min-width:96rpx; + margin-right:33rpx; +} \ No newline at end of file diff --git a/dist/tabs/index.js b/dist/tabs/index.js new file mode 100644 index 0000000..95fbe52 --- /dev/null +++ b/dist/tabs/index.js @@ -0,0 +1,60 @@ +Component({ + externalClasses: ['i-class'], + + relations: { + '../tab/index': { + type: 'child', + linked () { + this.changeCurrent(); + }, + linkChanged () { + this.changeCurrent(); + }, + unlinked () { + this.changeCurrent(); + } + } + }, + + properties: { + current: { + type: String, + value: '', + observer: 'changeCurrent' + }, + color: { + type: String, + value: '' + }, + scroll: { + type: Boolean, + value: false + }, + fixed: { + type: Boolean, + value: false + } + }, + + methods: { + changeCurrent (val = this.data.current) { + let items = this.getRelationNodes('../tab/index'); + let len = 0; + if(items){ + len = items.length?items.length:0; + } + + + if (len > 0) { + items.forEach(item => { + item.changeScroll(this.data.scroll); + item.changeCurrent(item.data.key === val); + item.changeCurrentColor(this.data.color); + }); + } + }, + emitEvent (key) { + this.triggerEvent('change', { key }); + } + } +}); diff --git a/dist/tabs/index.json b/dist/tabs/index.json new file mode 100644 index 0000000..467ce29 --- /dev/null +++ b/dist/tabs/index.json @@ -0,0 +1,3 @@ +{ + "component": true +} diff --git a/dist/tabs/index.ttml b/dist/tabs/index.ttml new file mode 100644 index 0000000..c2cb4eb --- /dev/null +++ b/dist/tabs/index.ttml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/dist/tabs/index.ttss b/dist/tabs/index.ttss new file mode 100644 index 0000000..69fc772 --- /dev/null +++ b/dist/tabs/index.ttss @@ -0,0 +1,42 @@ +.i-tabs { + display: flex; + width: 100%; + height: 48px; + line-height: 48px; + box-sizing: border-box; + position: relative; + justify-content: space-around; + align-items: center; + -webkit-box-align: center; + /* background: #fff */ +} + +.i-tabs::after { + content: ''; + position: absolute; + top: 0; + left: 0; + width: 200%; + height: 200%; + transform: scale(.5); + transform-origin: 0 0; + pointer-events: none; + box-sizing: border-box; + /* border: 0 solid #e9eaec; */ + border-bottom-width: 1px +} + +.i-tabs-scroll { + display: block; + overflow-x: auto; + margin-bottom: 22rpx; + white-space: nowrap; + /* box-shadow:0 0 2px 0 rgba(211,211,211,0.50); */ + /* border-bottom: 1rpx solid #eeeeee; */ +} + +.i-tabs-fixed { + position: fixed; + top: 0; + z-index: 2 +} \ No newline at end of file diff --git a/iconfont.ttss b/iconfont.ttss new file mode 100644 index 0000000..69b429c --- /dev/null +++ b/iconfont.ttss @@ -0,0 +1,22 @@ +@font-face {font-family: "iconfont"; + src: url('iconfont.eot?t=1568701793152'); /* IE9 */ + src: url('iconfont.eot?t=1568701793152#iefix') format('embedded-opentype'), /* IE6-IE8 */ + url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAL4AAsAAAAABrwAAAKqAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcAqBSIFaATYCJAMICwYABCAFhG0HMBsABsgekkQC4ByegcrDAoAQCLRWZuAQ1ROBA7RA4BAKaNmybtVXtY7IAcnq3VqzIggboUqyiugVQ3aPc4szdQ+sCRogwMz8/1xO764CCmR+oFzmmnTUCzDeGuBe2CYrkAC8ZXjVpa2DPg8B2ImSQTRM1jYTBTQwTQBiyuVniULOi0bLCSsCc81ajbhIFqs8lC+BC+H3xR/ysoLEpICSto0vE703YYraMK4c+gi8+cyAvAkUkAE0iK7aaIs0QiYr7NEMcdhXoYDvTYbh6xF7/fMQZiDfCUAE5d4Tz+Xfao0EQHPv/VVgcNQDwORyOm3e9deXcM/79Y3jUPfb1cDbt9vv3u28ebP1+vUxF29G7Kzn7dvDo1b3tY2rXSInFmNx8vuXPoyor9T//xe4DlwNf38Nrm8r19Ln5+lryPJZnvWqepGyWMnrz758+lTuI4uyvZB88lTtMxaLVtXnD9y0otW6mLp5Uy7mMy1i+PFhWCaT6UkAxjd1S8X82t+wmf+so7de8d/q0AB8uP/fH04wvmlUDGC9AZuAH8nrWactAeikNni1SUkV0w2K7RgAA3D6fR2rDN11UmAldO92C5EpKKwkoJqUASYcFIAZK9VgJ13zZgcBC9IIbQPS7BIQeD0AiZvnoPB6hWrSFzAR9g/MeFNgp6fAng6SGi/VSzzTeAnnK3AvKGLcoEtR4TpyE5zJrCCkbKNUbgDaWTnFxBQjlHMsUJZ3tGbAJIUwIZdhEBDEkjy80A1H67jbzB6pe1PjgsJEiXoSOqOhS2DAChh3gUSY31wrlT6/DnFG4IxswTWZtyFJcQcHubLk9ECn0qgX7l6uWWRxHUs0BoyQSAg0ETMKMErAXP0oD7qgNYyNCMe6slmjkb7Sxvry8Ou2AHZAJQUOU5gXyShDiQQAAA==') format('woff2'), + url('iconfont.woff?t=1568701793152') format('woff'), + url('iconfont.ttf?t=1568701793152') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ + url('iconfont.svg?t=1568701793152#iconfont') format('svg'); /* iOS 4.1- */ + } + + .iconfont { + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } + + .icon-sousuo:before { + content: "\e646"; + } + + \ No newline at end of file diff --git a/index/index.js b/index/index.js new file mode 100644 index 0000000..a80cdd8 --- /dev/null +++ b/index/index.js @@ -0,0 +1,1322 @@ +// const extConfig = tt.getExtConfigSync ? tt.getExtConfigSync() : {} +// let ifStoreApp = extConfig.attr.ifStoreApp; +// let businessSwitch = extConfig.attr.businessSwitch +// let mch_id = extConfig.attr.mchId +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const Http = require("../utils/HttpBasics"); +const imgurl = require("../utils/imgurl"); +const config = require("../config/config"); +const QR = require("../utils/memberqrcode.js"); +const util = require("../utils/util"); +const bgColor = require("../utils/bgColor.js") +let app = getApp(); +Page({ + data: { + userAvatarUrl: '', + userName: '', + aa: (app.statusBarHeight + 34) + "rpx", + noDataFlag: false, + busineKye: 0, + businePageNum: 1, + credit: 0, + businessList: [], //优选好物导航 + businessData: [], //优选好物数据 + topicObj2: null, //欢乐城首页限时抢购 + topicObj3: null, //欢乐城首页砍价 + topicObj4: null, //欢乐城首页拼团 + topicObj5: null, //欢乐城首页消费卡 + topicObj6: null, //欢乐城首页积分商城 + specialLsit: [], //欢乐城首页专题 + marketName: "", //商场名称 + mouldType: 0, + navLineHeight: ((app.statusBarHeight + app.statusBarHeight) + 44) + "px", + huanlechengImgurl: "https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/", + // mch_id: mch_id, + goUrl: "", //商圈跳转链接 + accreditFlag: 1, //1是未授权微信且未授权手机号 2授权了微信 没授权手机号 3微信和手机号都授权了 + // businessSwitch: businessSwitch, + typeLsit: {}, + showLocationIf: true, + // ifStoreApp: ifStoreApp, + navigationBarTitle: '首页', + navigationBarHeight, + chengzhangBox: bgColor.colorFirst.main.chengzhangBox, + activeColor: bgColor.colorFirst.main.activeColor, + qg: bgColor.colorFirst.main.qg, + newUrl: "", + cover: "", + kanjia: imgurl.kanjia.url, + pintuan: imgurl.pintuan.url, + xiaofeika: imgurl.xiaofeika.url, + xingyun: imgurl.xingyun.url, + jfshangcheng: imgurl.jfshangcheng.url, + toutiao: imgurl.toutiao.url, + more: imgurl.more.url, + giftHr: imgurl.giftHr.url, + giftHr: imgurl.giftHr.url, + next: imgurl.next.url, + usergift: imgurl.usergift.url, + guanbi1: imgurl.guanbi1.url, + icon0001: imgurl.icon0001.url, + icon0002: imgurl.icon0002.url, + icon0003: imgurl.icon0003.url, + icon0004: imgurl.icon0004.url, + icon0005: imgurl.icon0005.url, + icon0006: imgurl.icon0006.url, + icon0007: imgurl.icon0007.url, + icon0008: imgurl.icon0008.url, + barcode: imgurl.barcode.url, + leftarrows: imgurl.leftarrows.url, + newcard: imgurl.newcard.url, + newseckill: imgurl.newseckill.url, + newbargain: imgurl.newbargain.url, + newgroup: imgurl.newgroup.url, + product: imgurl.product.url, + barginicon: imgurl.barginicon.url, + pintuan: imgurl.pintuan.url, + live: imgurl.live.url, + duihuan: imgurl.duihuan.url, + market: app.globalData.market, + list: [], + xslist: [], + loading: true, + fistLogin: null, + alphaData: null, + alphaData1: null, + swiperCurrent: 0, + title: null, + weappShareTitle: '', //分享标题 + weappShareCoverImg: '', //分享图片 + desc: null, + scrollTop: 0, + showGame: false, + showTopic: false, + showQg: false, + gamedata: {}, + couponId: '', //游戏返回时传回的字段 + played: false, //从游戏页面跳回首页返回true + havePlayEd: app.globalData.havePlayEd, + havePlayEd1: app.globalData.havePlayEd1, + staticGamedata: {}, + showIf: false, + showPages: false, + display: 'none', + display1: 'none', + optionsData: null, + page: 1, // 刷新进入页面时已经加载了第一页数据,onReachBottom时 page++,从第2页开始加载 + openId: '', + showGg: false, + ggdata: {}, + liveFlag: 0, //直播按钮显隐标志位 + squareName: "", //当前广场 + isShowSqare: false, + moduleList: [], //按钮列表 + }, + getBusineData(e) { + this.setData({ + businePageNum: 1, + busineKye: e.detail, + noDataFlag: false, + }) + this.getCouponChannelList(e.detail) + }, + getBusinessList() { //获取优选导航 + Http.get({ + url: config.api.businessList, + data: { + filter: 2 + } + }).then(res => { + this.setData({ + businessList: [{ + id: 0, + title: "全部", + type: 1 + }].concat(res.data) + }); + }).catch(err => { + tt.showModal({ + title: '提示', + content: err.message ? err.message : err.data, + showCancel: false + }) + }) + }, + getCouponChannelList(key) { + if (this.data.noDataFlag) { + return + } + tt.showLoading({ + title: "加载中" + }); + let param = {} + if (key == 0) { + param = { + pageNum: this.data.businePageNum, + pageSize: 6, + targetAd: 101 + } + } else { + param = { + pageNum: this.data.businePageNum, + pageSize: 6, + business: key, + targetAd: 101 + + } + } + + Http.get({ + url: config.api.couponChannelList, + data: param + }).then(res => { + if (res.data.list&&res.data.list.length != 0) { + + let tempLsit = this.data.businessData + let data = res.data.list + data.map(item => { + if (item.salePriceStr && item.salePriceStr.indexOf('.') != -1) { + let str = item.salePriceStr.split('.') + item.salePriceStrQ = str[0] + item.salePriceStrH = str[1] + } + item.sale = item.inventory - item.remainInventory + }) + + if (this.data.businePageNum > 1) { + this.setData({ + businessData: [...tempLsit, ...data] + }) + } else { + this.setData({ + businessData: data + }) + } + }else{ + this.setData({ + noDataFlag: true + }) + } + tt.hideLoading(); + }).catch(err => { + tt.hideLoading(); + tt.showModal({ + title: '提示', + content: err.message ? err.message : err.data, + showCancel: false + }) + }) + }, + goPage(e) { + let obj = e.currentTarget.dataset.obj + console.log(obj, "obj") + if (obj.linkType == 1) { + if (obj.linkUrl == "/pages/game/index") { + this.gotogame() + } else { + + tt.navigateTo({ + url: obj.linkUrl, + + }) + + } + //小程序内部跳转 + } else if (obj.linkType == 2) { + //跳转到外部小程序 + tt.navigateToMiniProgram({ + appId: obj.outLinkAppid, + path: obj.linkUrl ? obj.linkUrl : '', + fail: err => { + tt.showModal({ + title: '提示', + content: err, + showCancel: false + }) + } + }) + } + }, + //获取按钮列表 + getModule() { + Http.get({ + url: config.api.wxCustomizeModule + }).then(res => { + this.setData({ + moduleList: res.data, + }) + }).catch(err => { + if (err.status != 404) + tt.showModal({ + title: '提示', + content: err.message ? err.message : err.data, + showCancel: false + }) + }) + }, + //判断用户是否授权 + uesrInfo() { + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res => { + Http.get({ + url: config.api.checkPhoneStatus + }).then(res => { //全部授权 + this.setData({ + accreditFlag: 3 + }) + }).catch(err => { + if (err.code == 11005) { //未授权手机号 + this.setData({ + accreditFlag: 2 + }) + } else { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }).catch(err => { + if (err.code == 11004) { //未授权微信 + this.setData({ + accreditFlag: 1 + }) + } else { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }, + + //获取当前广场名 + //跳转到每日签到 + goSign() { + tt.navigateTo({ + url: '/pages/activityCalendar/activityCalendar', + }) + }, + //活动日历 + goCalendar() { + tt.navigateTo({ + url: '/pages/dateLsit/dateLsit', + }) + }, + //跳转到其他广场列表 + goSquareList() { + if (this.data.isShowSqare) { + tt.navigateTo({ + url: '/pages/location/location', + }) + } + + }, + goLive() { + tt.navigateTo({ + url: '/pages2/live/livelist/index', + }) + }, + alphaClick1: function (even) { + var animation = tt.createAnimation({}) + animation.opacity(0).step({ + duration: 2000 + }) + this.setData({ + alphaData: animation.export() + }) + }, + alphaClick: function (even) { + var animation = tt.createAnimation({}) + animation.opacity(0).step({ + duration: 2000 + }) + this.setData({ + alphaData1: animation.export() + }) + }, + // 我的卡包 + mycard: function () { + tt.navigateTo({ + url: '/pages/cardorder/index/index', + }) + }, + //我的券包 + mycoupon: function () { + tt.navigateTo({ + url: '/pages/couponorder/index/index', + }) + }, + gotoSpellGroup: function () { + tt.navigateTo({ + url: '/pages/spellGroup/spellGroup', + }) + }, + qrcode: function () { + var that = this; + let memberId = that.data.memberId; + if (memberId) { + tt.navigateTo({ + url: '/pages/specialcourtesy/specialcourtesy' + }) + } + }, + //跳往限时秒杀 + gotoRushBuy: function () { + tt.navigateTo({ + url: '/pages/rushToBuy/index', + }) + }, + swiperChange: function (e) { + this.setData({ + swiperCurrent: e.detail.current + }); + }, + gotogame: function () { + let that = this; + if (!that.data.showIf) { + tt.showToast({ + title: '暂无游戏频道', + icon: "none", + duration: 3000 + }) + } else { + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res1 => { + app.globalData.type = 'gm' + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + var data = { + couponChannelId: "" + that.data.couponChannelId, + couponId: "" + that.data.couponId + }; + if (that.data.couponChannelId == null) { + var data = { + couponId: "" + that.data.couponId + }; + } + tt.redirectTo({ + url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + }) + }).catch(err => { + if (err.code == 11005) { + // 用户手机未授权 + /** + * 将值传到用户手机号授权的页面 + * + */ + app.globalData.skipUrl = '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + app.globalData.skip = 'redirectTo' + tt.redirectTo({ + url: "/pages/getphoneInfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + }); + } else if (err.code == 11006) { + // 用户手机已加密 + tt.redirectTo({ + url: "/pages/phoneinput/phoneinput?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + }); + } else { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }).catch(err => { + if (err.code == 11004) { //未授权微信 + app.globalData.type = 'gm' + tt.redirectTo({ + url: "/pages/getuserinfo/index?path=index&url=" + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + }); + } else { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + + } + + }, + mySpecial: function () { + console.log("special"); + tt.navigateTo({ + url: '/pages/specialcourtesy/specialcourtesy', + }) + }, + //是否属于集团 + ifShowSqare() { + if (tt.getStorageSync("squareList")) { + this.setData({ + isShowSqare: true + }) + } else { + this.setData({ + isShowSqare: false + }) + } + }, + /** + * 获取全局样式 + */ + getType() { + Http.get({ + url: config.api.setType, + data: { + mouldType: app.globalData.mouldType + } + }).then(res => { + const { + code, + data + } = res + if (code == 200) { + app.globalData.typeLsit = data + this.setData({ + typeLsit: data, + }) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onLoad: function (options) { + console.log(123); + + + let that = this; + let optionss; + + let openId = tt.getStorageSync('openId') + if (tt.getStorageSync('options')) { + optionss = JSON.parse(tt.getStorageSync('options')); + } + if (options.played == "true") { + that.setData({ + played: true + }) + } + if (optionss && optionss.couponChannelId || optionss && optionss.orderId) { + that.setData({ + optionsData: optionss + }) + that.getWeapNote(optionss.couponChannelId, optionss.orderId); + } else { + that.getWeapNote() + } + //获取条形码 + // util.barcode("barcode", optionss.quancode, 510, 100); + // console.log(Http.headers.token, "?") + + }, + /** + * 获得经纬度 + */ + // getLocation() { + // let that = this; + // tt.getLocation({ + // type: "wgs84", + // success: function(res) { + // console.log(res, 9999) + // if (res && res.longitude && res.latitude) { + // Http.post({ + // url: config.api.updateLBS, + // data: { + // latitude: res.latitude, + // longitude: res.longitude + // } + // }).then(res => { + // console.log(res, 9999) + // }) + // } + // }, + // fail: error => { + // console.log(error); + // } + // }) + // }, + + + + onShow: function () { + console.log(app.globalData.mouldType, "mouldType") + // tt.requestSubscribeMessage({ + // tmplIds: [], // 需要填入开放平台申请的模版id,支持最多3个同类型模版 + // success(res) { + // //订阅成功 + // console.log("订阅成功", res); + // }, + // fail(error) { + // //订阅失败 + // console.log("订阅失败, 错误详情: ", error); + // tt.showToast({ + // title: "订阅失败", + // icon: "fail", + // }); + // }, + // complete(res) { + // //订阅完成 + // console.log("tt.requestSubscribeMessage API调用完成: ", res); + // }, + // }); + + this.setData({ + mouldType: app.globalData.mouldType, + marketName: app.globalData.marketName, + activeColor: app.globalData.mouldType == 1 ? "#E9D0AA" : bgColor.colorFirst.main.activeColor + }) + // this.uesrInfo() + this.ifShowSqare(); + if (tt.getStorageSync("squareList") && tt.getStorageSync("selectedMall")) { + var temp = tt.getStorageSync("squareList").filter(item => item.tenantId == tt.getStorageSync("selectedMall"))[0].name + this.setData({ + squareName: temp + }) + } + if (typeof this.getTabBar === 'function' && + this.getTabBar()) { + this.getTabBar().setData({ + selected: 0, + }) + } + let that = this; + that.setData({ + havePlayEd: app.globalData.havePlayEd ? app.globalData.havePlayEd : false, + havePlayEd1: app.globalData.havePlayEd1 ? app.globalData.havePlayEd1 : false + }) + + /** + * couponNum 是否有普通的优惠券购买 + * couponNum2 是否有新买的消费卡 + */ + let num = tt.getStorageSync('couponNum'); + let num1 = tt.getStorageSync('couponNum2'); + + // if (num == 'couponNum' || num1 == 'couponNum2') { + // tt.showTabBarRedDot({ + // index: 3 + // }) + // } else { + // tt.hideTabBarRedDot({ + // index: 3 + // }) + // } + + if (app.globalData.score) { + that.setData({ + fistLogin: app.globalData.score + }) + } + // 如果有游戏 + setTimeout(function () { + that.alphaClick(); + }, 8000) + // 如果有广告 + setTimeout(function () { + that.alphaClick1(); + }, 8000) + }, + + + getmemberId: function (token) { + let that = this; + Http.get({ + url: config.api.getScore, + data: { + token: token + } + }).then(res => { + that.setData({ + levelName: res.data.levelName, + upgradePercent: res.data.upgradePercent, + upgradeScore: res.data.upgradeScore, + memberId: res.data.id, + credit: res.data.credit, + userAvatarUrl: res.data.avatarUrl ? res.data.avatarUrl:'', + userName: res.data.nickName ? res.data.nickName:'', + }) + }) + .catch(err => { + tt.showModal({ + title: '提示', + content: err.message, + showCancel: false + }) + }) + }, + gotoChengzhangzhi: function () { + tt.navigateTo({ + url: '/pages/czdetail/czdetail', + }) + }, + goIntegralmall() { + tt.navigateTo({ + url: '/pages/integralmall/index', + }) + }, + gotoBargain: function () { + tt.navigateTo({ + url: '/pages/bargain/bargain', + }) + }, + gotoSpellGroup: function () { + tt.navigateTo({ + url: '/pages/spellGroup/spellGroup', + }) + }, + gotoCard: function () { + tt.navigateTo({ + url: '/pages/discountCardList/discountCardList', + }) + }, + // gotoGame: function () { + // tt.navigateTo({ + // url: '/pages/game/index', + // }) + // }, + gotoJfsc: function () { + tt.navigateTo({ + url: '/pages/integralmall/index', + }) + }, + + /** + * + * @param {code,page} + * 子组件向父组件传值 + */ + onGetCode: function (e) { + this.setData({ + code: e.detail.val, + page: e.detail.pageNum, + }); + console.log(e.detail.val) + console.log(e.detail.pageNum) + }, + getWeapNote: function (couponChannelId, couponId, orderId) { + var that = this; + + if (app.globalData.token) { + // 登录 + console.log(app.globalData.token) + + that.setData({ + mouldType: app.globalData.mouldType, + marketName: app.globalData.marketName, + activeColor: app.globalData.mouldType == 1 ? "#E9D0AA" : bgColor.colorFirst.main.activeColor + }) + + //获取首页按钮 + that.getModule() + that.getmemberId(app.globalData.token); + that.getBannerlist(); + if (that.data.mouldType == 0) { //富茂原版 + that.topicShow(); + that.getxsList(); + } else if (that.data.mouldType == 1) { //欢乐城模板 + that.getShowList() + that.topicShowall(2); + that.topicShowall(3); + that.topicShowall(4); + that.topicShowall(5); + that.topicShowall(6); + that.getBusinessList(); + that.getCouponChannelList(0) + } + + + that.getType() + that.uesrInfo() + // that.getLocation(); + that.getMallInfo(app.globalData.token); + + if (app.couponChannelListCallback) { + app.couponChannelListCallback(app.globalData.token); + } + if (app.couponListCallback) { + app.couponListCallback(app.globalData.token); + } + if (app.businessListCallback) { + app.businessListCallback(app.globalData.token); + } + Http.get({ + url: config.api.getWeapNote, + data: { + appId: app.globalData.appId, + } + }) + .then(res => { + console.log(33333333333) + console.log(app.globalData.token) + console.log(res) + console.log(33333333333) + // that.getGameOne(app.globalData.token) + // that.getStaticGame(app.globalData.token) + that.getGg(app.globalData.token) + let weapNote = JSON.parse(res.data.weapNote); + that.setData({ + // desc: weapNote.firstpage.desc?weapNote.firstpage.desc:"", + // title: weapNote.firstpage.title?weapNote.firstpage.title:'', + }) + }) + .catch(err => { + // that.getGameOne(app.globalData.token) + // that.getStaticGame(app.globalData.token) + that.getGg(app.globalData.token) + tt.showModal({ + title: "提示", + content: err.message, + showCancel: false + }); + }); + + } else { + app.tokenCallback = token => { + // 登录 + console.log(app.globalData.token) + that.setData({ + mouldType: app.globalData.mouldType, + marketName: app.globalData.marketName, + activeColor: app.globalData.mouldType == 1 ? "#E9D0AA" : bgColor.colorFirst.main.activeColor + }) + //获取首页按钮 + that.getModule() + that.getmemberId(app.globalData.token); + that.getBannerlist(); + if (that.data.mouldType == 0) { //富茂原版 + that.topicShow(); + that.getxsList(); + } else if (that.data.mouldType == 1) { //欢乐城模板 + that.getShowList() + that.topicShowall(2); + that.topicShowall(3); + that.topicShowall(4); + that.topicShowall(5); + that.topicShowall(6); + that.getBusinessList(); + that.getCouponChannelList(0) + } + that.getType() + that.uesrInfo() + // that.getLocation(); + that.getMallInfo(app.globalData.token); + if (app.couponChannelListCallback) { + app.couponChannelListCallback(app.globalData.token); + } + if (app.couponListCallback) { + app.couponListCallback(app.globalData.token); + } + if (app.businessListCallback) { + app.businessListCallback(app.globalData.token); + } + + Http.get({ + url: config.api.getWeapNote, + data: { + appId: app.globalData.appId, + } + }) + .then(res => { + console.log(33333333333) + console.log(app.globalData.token) + console.log(res) + console.log(33333333333) + // that.getGameOne(app.globalData.token) + // that.getStaticGame(app.globalData.token) + that.getGg(app.globalData.token) + let weapNote = JSON.parse(res.data.weapNote); + that.setData({ + // desc: weapNote.firstpage.desc?weapNote.firstpage.desc:"", + // title: weapNote.firstpage.title?weapNote.firstpage.title:'', + }) + }) + .catch(err => { + // that.getGameOne(app.globalData.token) + // that.getStaticGame(app.globalData.token) + that.getGg(app.globalData.token) + tt.showModal({ + title: "提示", + content: err.message, + showCancel: false + }); + }); + } + } + + }, + + getStaticGame(token) { + let _this = this; + Http.get({ + url: config.api.getGame, + data: { + triggleAction: 2, // 固定入口 + token: token + } + }).then(res => { + if (res.data.id) { + _this.setData({ + showIf: true, + newUrl: res.data.imgUrl + }) + } else { + _this.setData({ + showIf: false + }) + } + _this.setData({ + staticGamedata: res.data + }) + }) + .catch(err => { + _this.setData({ + showIf: false + }) + console.log(err) + }) + }, + getGameOne: function (token) { + let _this = this; + Http.get({ + url: config.api.getGame, + data: { + triggleAction: 1, // 登录触发 + token: token + } + }).then(res => { + if (res.data.id) { + _this.setData({ + showGame: true, + }) + } else { + _this.setData({ + showGame: false + }) + } + _this.setData({ + gamedata: res.data + }) + }) + .catch(err => { + _this.setData({ + showGame: false + }) + this.alphaClick(); + }) + }, + /** + * mallinfo + */ + getMallInfo: function (token) { + let that = this; + Http.get({ + url: config.api.getMallInfo, + data: { + token: token, + } + }).then(res => { + that.setData({ + liveFlag: res.data.liveSupport, + weappShareTitle: res.data.weappShareTitle ? res.data.weappShareTitle : null, + weappShareCoverImg: res.data.weappShareCoverImg ? res.data.weappShareCoverImg : null, + }); + console.log(that.data.liveFlag, "||||") + }) + .catch(err => { + // 不需要错误提示 + }); + }, + //获取限时抢购列表 + getxsList() { + let that = this; + Http.get({ + url: config.api.couponChannelList, + data: { + pageNum: 1, + pageSize: 3, + targetAd: 2 + } + }).then(res => { + if (res && res.data.total > 0) { + that.setData({ + xslist: res.data.list, + showQg: true + }); + } else { + that.setData({ + showQg: false + }) + } + }) + .catch(err => { + console.log(err) + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + /** + * banner + */ + getBannerlist: function () { + let that = this; + Http.get({ + url: config.api.bannerlist, + data: { + pageNum: 1, + pageSize: 7 + } + }).then(res => { + that.getmemberId(app.globalData.token); + // that.checkUserCarStatus(); + that.setData({ + list: res.data.list + }); + }) + .catch(err => { + that.getmemberId(app.globalData.token); + // that.checkUserCarStatus(); + }); + }, + //获取欢乐城专题 + getShowList() { + Http.get({ + url: config.api.showList + }).then(res => { + let tempData = res.data + tempData.map(item1 => { + if (item1.couponList) { + item1.couponList.map(item2 => { + if (item2.salePriceStr && item2.salePriceStr.indexOf('.') != -1) { + let str = item2.salePriceStr.split('.') + item2.salePriceStrQ = str[0] + item2.salePriceStrH = str[1] + } + }) + } + + }) + this.setData({ + specialLsit: res.data ? res.data : [] + + }) + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + /** + * topicType=2 限时抢购 + * topicType=3 砍价 + * topicType=4 拼团 + * topicType=5 消费卡 + * topicType=6 积分商城 + */ + topicShowall(topicType) { + Http.get({ + url: config.api.topicShow, + data: { + topicType + } + }).then(res => { + + let data = res.data + + if (data.couponList != null && data.couponList.length > 0) { + data.couponList.map(item => { + if (item.salePriceStr && item.salePriceStr.indexOf('.') != -1) { + let str = item.salePriceStr.split('.') + item.salePriceStrQ = str[0] + item.salePriceStrH = str[1] + } + }) + } + + if (topicType == 2) { + let tempData = data + this.setData({ + topicObj2: data + }) + } else if (topicType == 3) { + this.setData({ + topicObj3: data + }) + } else if (topicType == 4) { + this.setData({ + topicObj4: data + }) + } else if (topicType == 5) { + this.setData({ + topicObj5: data + }) + } else if (topicType == 6) { + this.setData({ + topicObj6: data + }) + } + + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + // 专题显示 + topicShow: function () { + let that = this; + Http.get({ + url: config.api.topicShow, + data: { + token: app.globalData.token + } + }).then(res => { + if (res && res.data) { + that.setData({ + name: res.data.name, + cover: res.data.cover, + id: res.data.id, + showTopic: true + }) + } else { + that.setData({ + showTopic: false + }) + } + }) + .catch(err => { + console.log(err); + }) + }, + gotoTopic() { + tt.navigateTo({ + url: `/pages/topicDetail/index?id=${this.data.id}` + }) + }, + /** + * 检查用户是否有车 + */ + // checkUserCarStatus: function() { + // var that = this; + // Http.get({ + // url: config.api.userCarCount, + // data: {} + // }).then(res => { + // if (res.data > 0) { + // // 用户名下有车 + // app.globalData.phone = res.data.phone; + // app.globalData.supportCar = true; + // // 共同登录 + // that.userCarLogin(); + // } + // }); + // }, + /** + * car共同登录 + */ + // userCarLogin: function() { + // var that = this; + // if (!app.globalData.carLogin) { + // // 共同登录 + // Http.post({ + // url: config.api.carInit, + // data: { + // phone: app.globalData.phone + // } + // }).then(res => { + // app.globalData.carLogin = true; + // app.globalData.parkVendor = res.data.vendor; + // if (res.data.token != "undefined") { + // app.globalData.etcpToken = res.data.token; + // } + // }); + // } + // }, + /** + * 获取用户信息 + */ + // getUserInfo: function() { + // // 获取用户信息 + // tt.getSetting({ + // success: res => { + // if (res.authSetting["scope.userInfo"]) { + // // 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 + // tt.getUserInfo({ + // success: res => { + // // 可以将 res 发送给后台解码出 unionId + // } + // }); + // } + // } + // }); + // }, + gotoBargain: function () { + tt.navigateTo({ + url: '/pages/bargain/bargain' + }) + }, + //限时抢购的详情页面 + gotodetail: function (e) { + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.couponchannelid + }&couponId=${e.currentTarget.dataset.couponid}` + }); + }, + //浮层广告 + getGg: function (token) { + + let that = this + Http.get({ + url: config.api.getGg, + data: { + token: token, + appId: app.globalData.appId, + openId: "" // tt.getStorageSync('openId') + } + }).then(res => { + console.log(res) + if (res.data.id) { + that.setData({ + showGg: true, + }) + console.log(that.data.showGg, 1111111111111) + } else { + that.setData({ + showGg: false + }) + // that.getGameOne(app.globalData.token) + console.log(that.data.showGg, 222222222222222222) + } + that.setData({ + ggdata: res.data + }) + }) + .catch(err => { + this.setData({ + showGg: false + }) + // that.getGameOne(app.globalData.token) + that.alphaClick1(); + }) + }, + /** + * 刷新 + */ + onPullDownRefresh: function (e) { + tt.showLoading({ + title: "加载中..." + }); + let that = this; + that.setData({ + topicObj2: null, //欢乐城首页限时抢购 + topicObj3: null, //欢乐城首页砍价 + topicObj4: null, //欢乐城首页拼团 + topicObj5: null, //欢乐城首页消费卡 + topicObj6: null, //欢乐城首页积分商城 + specialLsit: null,//专题 + }) + // that.getWeapNote(); + that.setData({ + page: 1 + }) + if (that.data.optionsData != null && (that.data.optionsData.couponChannelId || that.data.optionsData.orderId)) { + that.getWeapNote(that.data.optionsData.couponChannelId, that.data.optionsData.orderId); + } else { + that.getWeapNote() + } + if (that.selectComponent("#lists")) { + if (that.data.code == 0 || that.data.code == undefined) { + that.selectComponent("#lists").getList(0, 1, "refresh"); + tt.stopPullDownRefresh(); + } else { + that.selectComponent("#lists").getList(that.data.code, 1, "refresh"); + tt.stopPullDownRefresh(); + }; + that.selectComponent("#hot").getList(); + } + + // 砍价下拉刷新 + // that.selectComponent("#bargain").getList(); + // that.selectComponent("#spellGroup").getList(); + // that.selectComponent("#rushtobyCard").getList(); + + //爆款专区下拉刷新 + + that.getxsList(); + that.topicShow(); + setTimeout(function () { + tt.hideLoading(); + tt.stopPullDownRefresh(); + }, 1600); + + }, + //加载更多 + onReachBottom: function () { + console.log("我到底了") + let that = this; + that.data.page++; + that.setData({ + page: that.data.page, + businePageNum: that.data.businePageNum + 1 + }); + console.log("加载更多页数" + that.data.page,); + console.log("加载更多key" + that.data.code); + if (that.data.mouldType == 0) { //富茂源模板 + //父组件获得子组件的方法 + //如果code == 0 + if (that.data.code == 0 || that.data.code == undefined) { + that.selectComponent("#lists").getList(0, that.data.page); + } else { + that.selectComponent("#lists").getList(that.data.code, that.data.page); + } + } else if (that.data.mouldType == 1) { + this.getCouponChannelList(that.data.busineKye) + } + + }, + // 用户点击右上角分享 + onShareAppMessage: function () { + app.globalData.previewFlag = true + return { + path: "/pages/index/index", + title: this.data.weappShareTitle, + imageUrl: this.data.weappShareCoverImg, + success: function (res) { + tt.showToast({ + title: "分享成功", + duration: 1000, + icon: "success" + }); + } + }; + } +}); \ No newline at end of file diff --git a/index/index.json b/index/index.json new file mode 100644 index 0000000..d18c932 --- /dev/null +++ b/index/index.json @@ -0,0 +1,16 @@ + +{ + "usingComponents": { + "c-banner": "../components/banner/index", + "c-coupons": "../pages/main/coupons/index", + "c-hot": "../components/hot/hot", + "c-advertisement":"../components/advertisement/advertisement", + "navbar": "../components/navbar/navbar", + "c-mould":"../components/commodityMould/commodityMould", + "optimization":"../components/optimization/optimization", + "tabbar":"../components/tabbar/tabbar" + }, + "enablePullDownRefresh": true, + "navigationBarBackgroundColor": "#F4F5F9" + } + \ No newline at end of file diff --git a/index/index.ttml b/index/index.ttml new file mode 100644 index 0000000..1b23ea4 --- /dev/null +++ b/index/index.ttml @@ -0,0 +1,257 @@ + + + + + + + + + + + + + {{squareName}} ↓ + + + + + + + + + + + + + {{levelName}} + + + + + 还需{{upgradeScore}}成长值可升级 + + + + + + + + + + + + + + + + + {{item.name}} + + + + + + 砍价 + + + + 拼团 + + + + 限时抢购 + + + + + + 限时专区 + 限时惊爆价 轻松拎回家 + + + + + + {{xslist[index].title}} + + + + + + 更多... + + + + + + + + + + + + + + + + + + + 您今日签到成功,获得{{fistLogin}}成长值 + + + + + + + + + + + + + + + + + + + + + {{marketName}} + + + + + + + + + + + + + + + + + + +

{{userName}}

+ + {{levelName}} + 积分:{{credit}} +
+ + + + 还需 + {{upgradeScore}}成长值 + 可升级 + +
+
+ + + + + + +
+ + + + + + + {{item.name}} + + + + + + + 砍价 + + + + 拼团 + + + + 限时抢购 + + +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + 您今日签到成功,获得{{fistLogin}}成长值 + + + + + + + + + + + +
+ \ No newline at end of file diff --git a/index/index.ttss b/index/index.ttss new file mode 100644 index 0000000..52cc8a5 --- /dev/null +++ b/index/index.ttss @@ -0,0 +1,828 @@ +@import "../app.ttss"; + +page { + background: #f4f5f9; +} +.temp{ + width: 100rpx; + height: 100rpx; + background-color: darkcyan +} +.xia { + width: 24rpx; + height: 14rpx; + margin: auto 10rpx; + display: block; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + + /* margin: auto; */ +} + +.goSqunar { + display: flex; + justify-content: space-around; +} +.goSqunar1 { + display: flex; + justify-content: center; + +} + +.title { + font-size: 32rpx; + font-family: OPPOSans; + font-weight: bold; + +} + +.title1 { + max-width:320rpx; + font-size: 32rpx; + font-family: OPPOSans; + font-weight: bold; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.squareMore { + width: 24rpx; + /* height: 15rpx; */ +} +.marketName{ + +} +.f { + float: left; +} + +.r { + float: right; +} + +.vgrade { + /* width: 40rpx; */ + height: 26rpx; + float: left; + margin: 10rpx; + background: linear-gradient(180deg, #d5a56e, #e9d0aa); + border-radius: 16rpx 0 16rpx 0; + color: #fff; + line-height: 26rpx; + font-size: 24rpx; + padding: 4rpx 10rpx; +} + +.integralNum { + float: left; + font-family: OPPOSans; + font-weight: bold; + color: #be8b50; + font-size: 26rpx; +} + +.color_box1 { + background-color: #fff; + background-image: url('https://formall.oss-accelerate.aliyuncs.com/cimg/v20211214/home_top_bnt.png'); + background-size: 100% 100%; + border-radius: 0 0 40rpx 40rpx; + overflow: hidden; + background-repeat: no-repeat; +} + +.color_box { + /* padding-top: 20rpx; *//* background-image: linear-gradient(#DC143C, #F4F5F9); */ + background-color: #f4f5f9; +} + +.underlingImg { + width: 30rpx; + height: 60rpx; + font-size: 30prx; + float: left; + /* margin-top: 20rpx; */ +} + +.underlingName { + float: left; + line-height: 30rpx; + color: #a6a6a6; + /* margin-top: 20rpx; */ + margin-bottom: 20rpx; + margin-left: 5rpx; +} + +.index-position { + background: rgba(0, 0, 0, 0.5); + height: 88rpx; + position: absolute; + top: 0; + width: 100%; + font-family: PingFangSC-Semibold; + font-size: 30rpx; + color: #fff; + letter-spacing: 0.75rpx; + z-index: 9; + line-height: 88rpx; + overflow: hidden; +} + +.red { + position: absolute; + width: 13rpx; + height: 13rpx; + border-radius: 50%; + background: red; + right: -50rpx; + top: 19rpx; + left: 0; + margin: auto; + display: none; +} + +page { + width: 100%; + height: auto !important; + overflow-x: hidden; +} + +.txt { + margin-left: 20rpx; +} + +.game-entry { + position: fixed; + right: 27rpx; + bottom: 443rpx; + width: 120rpx; + margin: 37rpx auto 0; + z-index: 10; +} + +.gameimg { + display: block; + width: 100%; +} + +.underling { + padding: 10rpx 30rpx; +} + +.userinfo { + width: 690rpx; + height: 96rpx; + border-radius: 16rpx; + display: flex; + justify-content: space-between; + margin: 0 auto 30rpx; +} + +.userinfo1 { + width: 690rpx; + height: 96rpx; + border-radius: 16rpx; + display: flex; + justify-content: space-between; + margin: 0 auto; +} + +.infoLeft { + height: 100%; + border-radius: 12rpx; + background: #fff; +} + +.section { + padding: 0 20rpx; + justify-content: space-around; + text-align: center; + margin-top: 25rpx; + margin-bottom: 30rpx; +} + +.sellsection { + margin-bottom: 37rpx; + padding: 0 38rpx; +} + +.section >view, .sellsection>view { + width: 25%; + display: inline-block; + position: relative; +} + +.section >view image, .sellsection>view image { + display: block; + margin: 0 auto; +} + +.section >view image { + width: 55rpx; + height: 55rpx; + margin-top: 20rpx; + margin-bottom: 14rpx; +} + +.sellsection>view image { + width: 159rpx; + height: 134rpx; +} + +.section text { + font-size: 24rpx; + color: rgba(51, 51, 51, 1); + display: block; + margin-top: 0rpx; +} + +.showQrcode { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 1000; + background: rgba(0, 0, 0, 0.6); +} + +.qrcode image { + margin: 15rpx 20rpx 15rpx; + z-index: 100; +} + +.qrcode1 image { + margin: 15rpx 20rpx 15rpx; + z-index: 100; +} + +.showQrcode { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 1000; + background: rgba(0, 0, 0, 0.6); +} + +.canvas-box { + position: fixed; + width: 500rpx; + overflow: hidden; + left: 0; + top: 200rpx; + right: 0; + margin: auto; + background: #fff; + border-radius: 16rpx; + z-index: 100; + padding-bottom: 30rpx; +} + +.showQrcode text { + display: none; + text-align: center; + font-size: 28rpx; +} + +.button { + width: 414rpx; + text-align: center; + margin: 0 auto; + height: 80rpx; + line-height: 80rpx; + background: rgba(255, 255, 255, 1); + border-radius: 10rpx; + font-size: 32rpx; + color: rgba(2, 192, 255, 1); + overflow: hidden; +} + +.memberIds { + padding-top: 30rpx; + font-size: 30rpx; +} + +.search { + background: rgba(2, 192, 255, 1); + height: 50rpx; +} + +.searchbar { + position: relative; + width: 685rpx; + height: 76rpx; + margin: 0 auto; + text-align: center; +} + +.searchbar image { + width: 40rpx; +} + +.searchbar text { + font-size: 28rpx; + line-height: 50rpx; + color: #fff; + display: inline-block; +} + +.user-avatar { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + overflow: hidden; + float: left; + margin: 10rpx 10rpx; +} + +.user-avatar open-data { + display: block; + width: 100%; + height: 100%; +} + +.user-avatar1 { + width: 80rpx; + height: 80rpx; + border-radius: 50%; + overflow: hidden; + float: left; + margin: 0 10rpx; +} + +.user-avatar1 image { + display: block; + width: 100%; + height: 100%; +} + +.user-data { + letter-spacing: 0.64rpx; + line-height: 46rpx; + font-size: 30rpx; + color: #333; + background: #fff; + margin-top: 10rpx; + margin-bottom: 26rpx; + float: right; + display: flex; + flex-direction: column; +} + +.user-data1 { + letter-spacing: 0.64rpx; + line-height: 46rpx; + font-size: 30rpx; + color: #333; + background: #fff; + /* margin-top: 10rpx; */ + margin-bottom: 26rpx; + float: right; + display: flex; + flex-direction: column; +} + +.nameBox open-data { + float: left; +} + +.chengzhangBox { + height: 32rpx; + line-height: 26rpx; + border-radius: 9px 9px 9px 0px; + font-family: PingFangSC-Regular; + font-weight: 400; + color: rgba(255, 255, 255, 1); + float: left; + margin-top: 8rpx; +} + +.chengzhang { + font-size: 22rpx; + font-weight: 400; + color: #fff; + height: 22rpx; + line-height: 22rpx; + padding: 0 8rpx; +} + +.integral { + margin-left: 70rpx; +} + +.jifen { + display: inline-block; + height: 34rpx; + color: #999; + font-size: 24rpx; + line-height: 34rpx; +} + +.jifenNumber { + color: #d18b4c; + font-size: 34rpx; + line-height: 34rpx; + margin-left: 10rpx; + font-weight: bold; +} + +.view { + display: flex; + font-size: 24rpx; + color: #999; +} + +.view>.score { + margin-left: 9rpx; + color: #333; + font-size: 30rpx; + margin-right: 23rpx; + font-family: PingFang-SC-Bold; +} + +.qrcode1 { + width: 106rpx; + height: 96rpx; + border-radius: 12rpx; +} + +.qrcode { + width: 106rpx; + height: 96rpx; + background: #fff; + border-radius: 12rpx; +} + +.qrcodeimg { + width: 68rpx !important; + height: 68rpx !important; +} + +.leftimg { + position: absolute; + right: 40rpx; + top: 60rpx; + margin-top: -7rpx; + width: 14rpx; + height: 26rpx; +} + +.duihuanimg { + display: block; + width: 48rpx; + margin-top: 6rpx; +} + +.product { + width: 710rpx; + margin: 30rpx auto 10rpx; + border-radius: 16rpx; + overflow: hidden; +} + +.product image { + display: block; + width: 100%; +} + +.textBox { + width: 400rpx; + height: 100%; + float: left; + margin-left: 10rpx; +} + +.textBox .name { + width: 400rpx; + font-size: 28rpx; + color: #3c3c3c; + margin-top: 20rpx; +} + +.textBox .title { + width: 400rpx; + font-size: 20rpx; + color: #a6a6a6; + margin-top: 10rpx; +} + +.product .gift { + width: 88rpx; + height: 88rpx; + float: left; + margin-top: 30rpx; + margin-left: 15rpx; +} + +.next image { + width: 26rpx; + height: 40rpx; +} + +.gift image { + width: 88rpx; + height: 76rpx; +} + +.product .next { + width: 32rpx; + height: 60rpx; + float: right; + margin-top: 40rpx; + margin-right: 26rpx; +} + +#rushtobyCard { + margin-top: 30rpx; +} + +.signin { + width: 542rpx; + height: 94rpx; + position: fixed; + top: 0; + left: 0; + right: 0; + z-index: 10000000; + margin: auto; +} + +.signin open-data { + position: absolute; + width: 90rpx; + left: 0; + top: 0; + bottom: 0; + height: 94rpx; + margin: auto; + border-radius: 50%; + overflow: hidden; +} + +.signin text { + display: block; + background: rgba(0, 0, 0, 0.5); + font-size: 28rpx; + height: 80rpx; + width: 100%; + line-height: 80rpx; + color: #d6d5d5; + text-indent: 4em; + border-radius: 60rpx; + margin-top: 7rpx; +} + +.remainchengzhangzhi { + display: block; + color: #a6a6a6; + font-size: 22rpx; + margin-top: 5rpx; + height: 30rpx; + line-height: 30rpx; + float: left; + margin-left: 10rpx; + width: 255rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.remainchengzhangzhi p{ + display: inline; +} +progress { + width: 200rpx; + border-radius: 60rpx; + overflow: hidden; + float: left; + margin-top: 10rpx; +} + +.channelBox { + width: 688rpx; + /* height: 220rpx; */ + margin: 20rpx auto; + display: flex; + flex-wrap: wrap; + /* justify-content: space-between; */ + background: #f4f5f9; +} + +.kjBox { + width: 25%; + height: 118rpx; + font-size: 24rpx; + color: #a6a6a6; + margin-top: 10rpx; + text-align: center; +} + +.kjBox1 { + width: 25%; + height: 118rpx; + font-size: 24rpx; + color: #a6a6a6; + margin-top: 10rpx; + text-align: center; +} + +.kjBox image { + width: 60rpx; + height: 60rpx; + margin: auto; +} + +.kjBox1 image { + width: 80rpx; + height: 80rpx; + margin: auto; +} + +.text { + margin: 0 auto; +} + +.toutiao { + width: 710rpx; + height: 128rpx; + line-height: 128rpx; + margin: 0 auto; + background: #fff; + box-shadow: 0px 6rpx 16rpx 0px rgba(236, 238, 243, 1); + border-radius: 12rpx; + margin-top: 18rpx; + margin-bottom: 18rpx; + position: relative; +} + +.toutiao1 { + width: 710rpx; + height: 128rpx; + margin: 0 auto; + background: #fff; + box-shadow: 0px 6rpx 16rpx 0px rgba(236, 238, 243, 1); + border-radius: 12rpx; + margin-top: 18rpx; + margin-bottom: 18rpx; + display: flex; + justify-content: space-between; +} + +.xianshi { + display: flex; + flex-direction: column; + justify-content: center; + align-content: center; + font-size: 30rpx; + padding: 20rpx; +} + +.xianshi>text { + height: 40rpx; +} + +.xianshi>text:nth-child(1) { + font-size: 30rpx; + font-family: PingFangSC; + font-weight: 500; +} + +.xianshi>text:nth-child(2) { + margin-top: 10rpx; + height: 28rpx; + font-size: 20rpx; + font-family: PingFangSC; + font-weight: 400; + color: rgba(166, 166, 166, 1); + line-height: 28rpx; +} + +.xsCon { + width: 300rpx; + display: flex; + justify-content: flex-end; + overflow: hidden; +} + +.igBox { + height: 100%; + width: 100rpx; + display: flex; + flex-direction: column; + justify-content: center; + align-content: center; +} + +.igBoxm { + height: 100%; + width: 100rpx; + display: flex; + flex-direction: column; + text-align: center; +} + +.imageH { + height: 50rpx !important; + width: 50rpx !important; + border-radius: 50%; + margin: 15rpx auto; + margin-bottom: 15rpx; +} + +.more { + height: 70rpx !important; + width: 70rpx !important; + margin: 0 auto; +} + +.imTit { + height: 14px; + font-size: 10px; + font-family: PingFangSC; + font-weight: 400; + color: rgba(60, 60, 60, 1); + line-height: 14px; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-align: center; +} + +.toutiao view:nth-child(2) { + font-size: 26rpx; + font-family: PingFangSC-Regular; + font-weight: 400; + color: rgba(60, 60, 60, 1); + float: left; + width: 500rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.toutiao view:nth-child(2) text:nth-child(1) { + color: red; +} + +.toutiao view:nth-child(2) text:nth-child(2) { + text-decoration: line-through; + color: red; +} + +.toutiao .imgBox { + width: 64rpx; + height: 64rpx; + float: left; + margin: 5rpx 0 5rpx 20rpx; +} + +.toutiao image { + width: 48rpx; + height: 38rpx; + margin: auto; +} + +.toutiao .qg { + width: 80rpx; + height: 44rpx; + line-height: 44rpx; + border-radius: 18rpx; + border: 2rpx solid; + position: absolute; + top: 0; + bottom: 0; + right: 20rpx; + margin: auto; + font-size: 24rpx; + font-family: PingFangSC-Medium; + font-weight: 500; + color: #fd782d; + text-align: center; +} + +i-tabs i-tabs-scroll { + background: #f4f5f9 !important; +} + +.integralBox { + width: 110rpx; + height: 110rpx; + bottom: 500rpx; + right: 20rpx; + position: fixed; + z-index: 1000000; +} + +.integralBox1 { + width: 140rpx; + height: 140rpx; + bottom: 500rpx; + right: 20rpx; + position: fixed; + z-index: 1000000; +} diff --git a/index/searchbar.js b/index/searchbar.js new file mode 100644 index 0000000..3e8ef14 --- /dev/null +++ b/index/searchbar.js @@ -0,0 +1,207 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const Http = require("../utils/HttpBasics"); +const imgurl = require("../utils/imgurl"); +const config = require("../config/config"); +let app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + lists: [], + merchantVoList: [], + indexId: 0, + businessId: 0, + windowHeight: "", + page: 1, + isFirstPage: false, + isLastPage: false, + teljpgUrl: imgurl.teljpg.url, + map: imgurl.map.url, //商场地图 + mapUrl: '/pages/marketAtlas/marketAtlas', //跳转地图的路径 + }, + getFemgMap() { //判断时候对接封了地图 + Http.get({ + url: config.api.ifFengMap + }).then(res => { + if (res.data) { // + let initMpa = { + appName: res.data.appName, + key: res.data.appKey, + defaultThemeName: res.data.themeId, + tenantId: res.data.tenantId, + mapId: res.data.mapId + } + console.log(initMpa, "initMpa") + this.setData({ + mapUrl: `/pages2/fengMap/fengMap?initMap=${JSON.stringify(initMpa)}` + }) + } else { + this.setData({ + mapUrl: "/pages/marketAtlas/marketAtlas" + }) + + } + }).catch(err => { + this.setData({ + mapUrl: "/pages/marketAtlas/marketAtlas" + }) + }) + }, + //跳转到地图 + goMap() { + tt.navigateTo({ + url: this.data.mapUrl, + }) + }, + // 左侧点击事件 + jumpIndex(e) { + let that = this; + let index = e.currentTarget.dataset.menuindex; + that.setData({ + indexId: index, + businessId: index + }); + that.setData({ + page: 1 + }) + that.getList(1, that.data.businessId); + }, + goSearchBar() { + tt.navigateTo({ + url: '/pages/searchbar/searchbar', + }) + }, + /** + * 跳转到门店列表的详情页面 + */ + gotoDetail(e) { + tt.navigateTo({ + url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}` + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + let that = this; + that.getBussiness(); + that.getList(1, 0); + tt.showLoading({ + title: '加载中...', + }) + }, + onShow() { + this.getFemgMap() + let that = this; + if (typeof this.getTabBar === 'function' && + that.getTabBar()) { + that.getTabBar().setData({ + selected: 1 + }) + }; + tt.getSystemInfo({ + success: function(res) { + that.setData({ + windowHeight: res.windowHeight + }) + }, + }) + }, + getBussiness: function() { + let that = this; + Http.get({ + url: config.api.businessList, + data: { + filter: 1 + } + }).then(res => { + that.setData({ + lists: [{ + id: 0, + title: "全部", + type: 1 + }].concat(res.data) + }); + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + getList: function(page, businessId) { + let that = this; + let data; + if (businessId == 0) { + data = { + pageNum: page, + pageSize: 8 + } + } else { + data = { + pageNum: page, + pageSize: 8, + businessId: businessId + } + } + Http.get({ + url: config.api.merchantList, + data: data + }).then(res => { + tt.hideLoading(); + if (page == 1) { + that.setData({ + merchantVoList: [], + }) + } + var tmpArr = that.data.merchantVoList; + tmpArr.push.apply(tmpArr, res.data.list); + // console.log(tmpArr) + that.setData({ + merchantVoList: tmpArr, + isFirstPage: res.data.isFirstPage, + isLastPage: res.data.isLastPage + }) + // console.log(that.data.merchantVoList) + }) + .catch(err => { + tt.hideLoading(); + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + phone: function(e) { + let that = this; + if (e.currentTarget.dataset.merchantlinkphone) { + tt.makePhoneCall({ + phoneNumber: e.currentTarget.dataset.merchantlinkphone + }) + } + }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + let that = this; + that.data.page++; + that.setData({ + page: that.data.page + }); + console.log(that.data.page); + // 如果是最后一页 + //就不发送请求 + if (!that.data.isLastPage || that.data.isFirstPage && that.data.isLastPage) { + that.getList(that.data.page, that.data.businessId); + } + } +}) \ No newline at end of file diff --git a/index/searchbar.json b/index/searchbar.json new file mode 100644 index 0000000..4552eba --- /dev/null +++ b/index/searchbar.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "门店", + "navigationBarBackgroundColor": "#F4F5F9", + "navigationBarTextStyle": "black", + "usingComponents": { + "navbar": "../components/navbar/navbar", + "tabbar":"../components/tabbar/tabbar" + } + } \ No newline at end of file diff --git a/index/searchbar.ttml b/index/searchbar.ttml new file mode 100644 index 0000000..3ddf369 --- /dev/null +++ b/index/searchbar.ttml @@ -0,0 +1,50 @@ + + + + + 搜索门店 + + + + + + + + + {{item.title}} + + + + + + + + + + + + + + 暂无数据 + + + + + + + \ No newline at end of file diff --git a/index/searchbar.ttss b/index/searchbar.ttss new file mode 100644 index 0000000..d396923 --- /dev/null +++ b/index/searchbar.ttss @@ -0,0 +1,191 @@ +@import "../iconfont.ttss"; +.searchicon{ + margin-right: 5rpx; +} +.map{ + position: fixed; + right: 0; + top: 740rpx; + height: 100rpx; + width: 100rpx; + /* background-color: chartreuse; */ +} +.search{ + z-index:5000; + left:0; + right: 0; + margin: auto; + width: 700rpx; + height: 68rpx; + line-height: 68rpx; + border:1px solid #ccc; + background: #F4F5F9; + border-radius:10rpx; + text-align: center; + color: #999; + font-size:30rpx; +} +.under_line{ + width: 100%; +} +.scrollY { + width: 134rpx; + position: fixed; + left: 0; + background:#F4F5F9; + /* top:240rpx; */ + margin-top: 40rpx; + overflow: scroll; +} + + +.text-style { + position: relative; + width: 139rpx; + height: 100rpx; + line-height: 100rpx; + text-align: center; + font-size: 30rpx; + font-family: PingFangSC-Semibold; + color: #3C3C3C; + background: #FFFFFF; + font-weight:500; +} +.text-styleHover{ + position: relative; + width: 139rpx; + height: 100rpx; + line-height: 100rpx; + text-align: center; + font-size: 26rpx; + font-family: PingFangSC-Semibold; + color: #A6A6A6; +} +.text-style text{ + font-size: 26rpx; +} +.active1 { + font-size: 26rpx!important; +} +.active { + position: absolute; + left: 4rpx; + bottom: 0rpx; + top:0; + margin: auto; + width:12rpx; + height:24rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius:7rpx; +} + +.posi { + position: relative; + width: 616rpx; + float: right; + margin-top: 20rpx; +} + +.posi>view:nth-child(2) { + width: 100%; + display: flex; + justify-content: space-between; + box-sizing: border-box; +} + +.posi>view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi>view:nth-child(2) text:nth-child(2) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi_logo { + position: relative; + width:576rpx!important; + height:176rpx; + background:rgba(255,255,255,1); + box-shadow:0px 4rpx 8rpx 0px rgba(0,0,0,0.04); + border-radius:16rpx; + margin: 20rpx; + overflow: hidden; +} +.tel { + position: absolute; + right: 3%; + top: 0; + bottom: 0; + margin: auto; + width: 50rpx; + height: 50rpx; +} +.merchants{ + width: 90%; + display: flex; + background: #fff; + padding-right:5%; + overflow: hidden; +} +.merchants view:nth-child(1) image { + display: block; + width: 120rpx; + height: 120rpx; + border-radius: 16rpx; +} +.position{ + text-align: center; + margin-top: 100rpx; + color: #999; +} +.leftBox{ + padding: 20rpx 0; +} + +.shopVo{ + margin-left: 20rpx; +} + +.merchantName{ + color: #3C3C3C; + font-size: 32rpx; + margin-left: 20rpx; + width: 60%; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; + margin-top: 10rpx; +} +.shopVo text{ + float: left; +} +page { + padding: 0 0 30rpx; +} + +.text{ + display: block; + width: 25%; + text-align: center; +} + +.view view:nth-of-type(1) { + font-size: 28rpx; + color: #888; +} + +.shopVoList{ + padding-left: 0!important; + display: inline-block!important; + width: 345rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.shopVoList text{ + font-size: 20rpx!important; + color: #b8b8b8!important; + margin-right: 10rpx; +} \ No newline at end of file diff --git a/index/user.js b/index/user.js new file mode 100644 index 0000000..252ffc0 --- /dev/null +++ b/index/user.js @@ -0,0 +1,132 @@ +const app = getApp() +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px"; +const Http = require("../utils/HttpBasics"); +const config = require("../config/config"); +const imgurl = require("../utils/imgurl"); +Page({ + data: { + navigationBarHeight, + showPhoem: false, + phoemFalg: true,//授权手机标记 + }, + showPhoemBtn() { + this.setData({ + showPhoem: true + }) + }, + go(e) { + if (this.data.phoemFalg) { + tt.showToast({ + title: '请授权手机号', // 内容 + icon: 'none', // 图标 + success: (res) => { + + }, + fail: (res) => { + + }, + }); + } else { + let url = e.currentTarget.dataset.url + console.log(url); + if(url=='/pages/order/index/index?id=all'){ + tt.navigateTo({ + url: url, + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }else{ + tt.navigateTo({ + url: url, // 指定页面的 url + success: (res) => { + + }, + fail: (res) => { + + }, + }); + } + + } + + }, + setPhone(paramData) {//子组件调用这个方法说明手机号已经授权成功 + this.setData({ + showPhoem: paramData.detail, + phoemFalg: false + }) + tt.showToast({ + title: '授权成功', // 内容 + icon: 'none', // 图标 + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }, + + setBox(paramData) { + this.setData({ + showPhoem: paramData.detail + }) + tt.showToast({ + title: '取消授权', // 内容 + icon: 'none', // 图标 + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }, + onLoad: function (options) { + let _this = this + Http.get({//判断是否授权抖音 + url: config.api.checkPhoneStatus, + + }).then(res => { + this.setData({ + phoemFalg: false + }) + }).catch(err => { + console.log(err, "我出错了") + }) + + + tt.getUserInfo({ + withCredentials: true, + success: function (res) { + _this.setData({ + userData: res.userInfo + }) + Http.post({ + url: config.api.getUserInfo, + data: { + encryptedData: res.encryptedData, + iv: res.iv + } + }).then(res => { + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + fail(res) { + tt.navigateTo({ + url: 'pages/index/index' // 指定页面的url + }); + }, + }) + } +}) \ No newline at end of file diff --git a/index/user.json b/index/user.json new file mode 100644 index 0000000..fc5894e --- /dev/null +++ b/index/user.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "我的", + "usingComponents": { + "navbar": "../components/navbar/navbar", + "phoem":"../components/getPhoen/getPhoen", + "tabbar":"../components/tabbar/tabbar" + } +} \ No newline at end of file diff --git a/index/user.ttml b/index/user.ttml new file mode 100644 index 0000000..71bedb4 --- /dev/null +++ b/index/user.ttml @@ -0,0 +1,82 @@ + + + + + + + {{userData.nickName}} + + 授权手机号 + + + + + + + + + 个人信息 + + + + 我的订单 + + + + 我的券包 + + + + 积分商城 + + + + + + 更多服务 + + + + + + + + 问卷调查 + + + + + + 关于我们 + + + + + + + + + 服务资质 + + + + + + + \ No newline at end of file diff --git a/index/user.ttss b/index/user.ttss new file mode 100644 index 0000000..2b3933f --- /dev/null +++ b/index/user.ttss @@ -0,0 +1,156 @@ +/* d:\fumaolianke\ttFmC\tt富茂C\pages\user\user.ttss */ +.userBg{ + width: 100%; + height: 200rpx; + background:linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%); + position: relative; +} +button::after { + border: none; + } +button { + background-color: transparent; + padding-left: 0; + padding-right: 0; + line-height:inherit; +} +button { + border-radius:0; +} +.userLogo{ + position: absolute; + top: 40rpx; + left: 80rpx; + height: 100rpx; + width: 100rpx; + background-color: aliceblue; + border-radius: 50%; +} +.userLogo open-data{ + display: block; + width: 100%; + height: 100%; +} +.userLogo img{ + border-radius: 50% !important; +} +.open{ + width: 100% !important; + height:100% !important; + border-radius: 50% !important; + overflow: hidden; +} +.open img{ + border-radius: 50% !important; +} +.userData{ + position: absolute; + top: 40rpx; + left: 180rpx; + font-size: 26rpx; + color: #ffffff; +} + +.noInfo{ + width: 220rpx; + margin-left: 20rpx; + font-size: 32rpx; + text-overflow: -o-ellipsis-lastline; + overflow:hidden; + text-overflow:ellipsis; + display:-webkit-box; + -webkit-box-orient:vertical; + -webkit-line-clamp:1; +} +.info{ + border: 1rpx #ffffff solid; + border-radius: 50rpx; + padding: 0 10rpx; + margin-top: 10rpx; + margin-left: 20rpx; + width: 130rpx; +} +.userName{ + position: absolute; + top: 60rpx; + left: 180rpx; + font-size: 26rpx; + color: #ffffff; +} +.tempBpx{ + position: relative; + width: 680rpx; + height: 160rpx; +} +.functionBox{ + position: absolute; + width: 680rpx; + height: 160rpx; + left: 5%; + top: -23%; + background-color: #ffffff; + border-radius: 10rpx; + display: flex; + justify-content:space-around; +} +.itemBox{ + width:30% ; + /* text-align: center; */ +} +.itemLogoBox{ + width: 60rpx; + height: 60rpx; + /* background-color: #cacaca; */ + margin: 20rpx auto 0 auto; +} +.itemLogo{ + width: 100%; + height: 100%; +} +.itemNAme{ + text-align: center; + font-size: 26rpx; + margin-top: 10rpx; +} +.moreBox{ + width: 680rpx; + margin: 20rpx auto 0 auto; + background-color: #ffffff; + border-radius: 10rpx; + overflow: hidden; +} +.fuwu{ + font-size: 28rpx; + margin: 20rpx; +} +.fuwuItemBox{ + /* display: flex; */ + overflow: hidden; +} +.f{ + float: left; +} +.r{ + float: right; +} +.fuwuItem{ + /* width: 25%; */ + /* background-color: aquamarine; */ + border-bottom: 1rpx #f6f6f6 solid; + padding: 20rpx 0; + overflow: hidden; + width: 90%; + margin: 0 auto; + +} +.fuwuLogoBox{ + width: 50rpx; + height: 50rpx; + /* background-color: #fb3e5c; */ +} +.fuwuName{ + text-align: center; + font-size: 24rpx; + margin-top: 10rpx; + margin-left: 10rpx; +} \ No newline at end of file diff --git a/pages/bannerdetail/bannerdetail.js b/pages/bannerdetail/bannerdetail.js new file mode 100644 index 0000000..2091d78 --- /dev/null +++ b/pages/bannerdetail/bannerdetail.js @@ -0,0 +1,55 @@ +let config = require("../../config/config.js"); +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +let app = getApp(); +const Http = require("../../utils/HttpBasics"); +const util = require("../../utils/util"); +const imgurl = require("../../utils/imgurl"); +Page({ + data: { + mouldType: 0, + navigationBarHeight, + data: {}, + couponId: null, + orderId: "", + day: "", + hour: "", + wmhome: imgurl.wmhome.url, + minute: "", + nodes: '' + }, + onLoad(options) { + this.setData({ + mouldType: app.globalData.mouldType, + }) + let that = this; + if (options.id){ + Http.get({ + url: config.api.bannerDetail, + data: { + id: options.id + } + }).then(res => { + if(res.data.type==2){ + that.setData({ + nodes: res.data.html + }) + } + that.setData({ + data: res.data + }); + }).catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }, + goback: function () { + tt.reLaunch({ + url: '/index/index', + }) + }, +}); diff --git a/pages/bannerdetail/bannerdetail.json b/pages/bannerdetail/bannerdetail.json new file mode 100644 index 0000000..9136d3d --- /dev/null +++ b/pages/bannerdetail/bannerdetail.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "活动详情", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/bannerdetail/bannerdetail.ttml b/pages/bannerdetail/bannerdetail.ttml new file mode 100644 index 0000000..58e47c0 --- /dev/null +++ b/pages/bannerdetail/bannerdetail.ttml @@ -0,0 +1,59 @@ + + + + + + + + + + {{data.title}} + {{data.subTitle}} + + 活动说明 + {{data.detail}} + + + + + + + + + + + + + {{item.title}} + {{item.subTitle}} + + {{item.salePriceStr}} + + 满¥{{item.usePriceStr}}可用 + + + 仅限本店使用 + + + + + + + + 免费领 + 马上购 + + + + + + \ No newline at end of file diff --git a/pages/bannerdetail/bannerdetail.ttss b/pages/bannerdetail/bannerdetail.ttss new file mode 100644 index 0000000..bed136a --- /dev/null +++ b/pages/bannerdetail/bannerdetail.ttss @@ -0,0 +1,568 @@ +@import "../../app.ttss"; + +page { + background: #eee; +} + +.coupons { + width: 100%; + position: relative; +} + +.coupons-body { + /* padding:40rpx 40rpx; */ + flex: 1; + /* overflow: auto; */ +} + +.banner { + position: relative; + width:750rpx; + overflow: hidden; + + /* box-shadow:0px 14px 26px 0px rgba(199,203,211,1); */ + +} + +.banner image { + width: 100%; + border-radius: 12rpx; +} + +.act { + position: relative; + z-index: 1000000000; + background: #fff; + border-radius: 12rpx; + width: 94%; + padding-bottom: 20rpx; + margin: 20rpx auto 0; +} + +.act text { + display: block; + padding-left: 4.8%; + padding-right: 4.8%; +} + +.txt001 { + display: block; + font-size: 34rpx; + color: #363636; + letter-spacing: 0; + text-align: left; + line-height: 48rpx; + padding-top: 3.2%; +} + +.txt002 { + font-size: 24rpx; + color: #999; + letter-spacing: 0; + text-align: left; + line-height: 33rpx; +} + +.proct { + position: relative; + /* height: 60rpx; */ + margin-top: 20rpx; +} + +.proct text:nth-of-type(1) { + display: block; + font-size: 30rpx; + color: #FD782D; + letter-spacing: 0; + line-height: 32rpx; + margin-bottom: 20rpx; + /* width: 60rpx; */ + /* height: 64rpx; */ +} + +.proct text:nth-of-type(2) { + display: block; + /* width: 498rpx; */ + /* height: 63rpx; */ + /* overflow: hidden; */ + word-wrap:break-word; + /* text-overflow: ellipsis; */ + font-size: 22rpx; + color: #6f6f6f; + letter-spacing: 0; + margin: 0 auto; +} + +.orbg { + position: absolute; + top: 256rpx; + z-index: 1000000; +} + +.banner text { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 122rpx; + height: 48rpx; + line-height: 48rpx; + opacity: 0.8; + background: #000; + font-size: 24rpx; + color: #fff; + letter-spacing: 0; + text-indent: 0.5em; + border-top-left-radius: 50rpx; + border-bottom-left-radius: 50rpx; +} + +.coupons_info { + width: 92%; + height: 120rpx; + display: flex; + justify-content: space-between; + padding: 0 4% 4%; + background: #fff; +} + +.coupons_info view { + display: flex; + flex-direction: column; +} + +.coupons_info view:nth-child(1) text { + font-size: 30rpx; + line-height: 32rpx; + margin-top: 10%; +} + +.coupons_info view:nth-child(1) text:nth-child(1) text { + color: #ff3434; + font-size: 24rpx; + border: 1px solid #ff3434; + border-radius: 6rpx; + margin-left: 2%; + padding: 0 5rpx; +} + +.coupons_info view:nth-child(1) text:nth-child(2), +.coupons_info view:nth-child(1) text:nth-child(3) { + color: #b8b8b8; + font-size: 24rpx; + margin-top: 4%; +} + +.coupons_info view:nth-child(1) text:nth-child(2) text, +.coupons_info view:nth-child(1) text:nth-child(3) text { + color: #ff3434; + font-size: 24rpx; +} + +.coupons_info view:nth-child(2) text:nth-child(1) { + font-size: 36rpx; + color: #ff3434; + margin-top: 40rpx; + font-weight: bold; +} + +.coupons_info view:nth-child(2) text:nth-child(2) { + font-size: 24rpx; + color: #b4b4b4; + text-decoration: line-through; + padding-left: 10rpx; + padding-top: 4rpx; +} + +navigator { + display: block; + margin-bottom: 24rpx; + width: 344rpx; +} + +.navigator-hover{ + opacity: 1!important; + background: #fff!important; + border-radius:16rpx; +} +.active{ + opacity: .6; +} +navigator:nth-of-type(2n) { + float: right; +} + +navigator:nth-of-type(2n+1) { + float: left; +} + +.contain { + padding: 24rpx 25rpx 0; +} + +.posi { + width: 92%; + display: flex; + flex-direction: column; + padding: 0 4%; + background: #fff; + margin-top: 2%; +} + +.posi>view:nth-child(2) { + width: 100%; + height: 87rpx; + display: flex; + justify-content: space-between; + border-top: 1px solid #f6f6f6; + line-height: 87rpx; +} + +.posi>view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi>view:nth-child(2) text:nth-child(2) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi_logo { + width: 100%; + height: 156rpx; + display: flex; + margin-top: 30rpx; +} + +.posi_logo view:nth-child(1) { + width: 126rpx; + height: 126rpx; + border-radius: 50%; + overflow: hidden; + flex: 2; +} + +.posi_logo view:nth-child(1) image { + width: 100%; + height: 100%; +} + +.posi_logo view:nth-child(2) { + display: flex; + flex-direction: column; + flex: 8; + padding-top: 20rpx; + padding-left: 30rpx; +} + +.posi_logo view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; +} + +.posi_logo view:nth-child(2) text:nth-child(2) { + font-size: 24rpx; + color: #b8b8b8; + padding-top: 10rpx; +} + +.notes view:nth-child(1) { + width: 92%; + height: 87rpx; + padding: 0 4%; + line-height: 87rpx; + background: #fff; + /* border-top: 1rpx solid #f5f5f5; */ +} + +.notes view:nth-child(1) text { + font-size: 30rpx; + font-weight: bold; +} + +.notes view:nth-child(2) { + width: 92%; + height: auto; + padding: 0 4% 4%; + background: #fff; + /* border-bottom: 1rpx solid #f5f5f5; */ + display: flex; + flex-direction: column; +} + +.notes view:nth-child(2)>text { + font-size: 28rpx; + color: #a9a9a9; + line-height: 45rpx; +} + +.spot { + width: 12rpx; + height: 12rpx; + display: inline-block; + background: #a9a9a9; + margin-right: 16rpx; + position: relative; + bottom: 4rpx; + border-radius: 50%; +} + +.buy-view { + background: #fff; + position: fixed; + padding-top: 10rpx; + height: 98rpx; + bottom: 0rpx; + left: 0; + right: 0; +} + +.buy { + display: block; + background: linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius: 30rpx; + height: 48rpx; + width: 112rpx; + margin: 0 auto; + color: #fff; + font-size: 26rpx; + line-height: 48rpx; + text-align: center; +} + +.coupons1-btn-gm { + background: #00c0ff !important; + border-radius: 10rpx !important; + margin: 0 !important; + padding: 0 !important; + font-family: PingFangSC-Semibold; + font-size: 28rpx; + color: #fff !important; + letter-spacing: 0; + height: 50rpx !important; + width: 138rpx !important; + line-height: 50rpx !important; +} + +.coupons1 { + position: relative; + background: #fff; + border-radius: 16rpx; + padding-bottom: 21rpx; + overflow: hidden; + height: 405rpx; +} + +/* .coupons1-border { + height: 1rpx; + left: 30rpx; + right: 30rpx; + background: #f5f5f5; + position: absolute; + bottom: 0; +} */ + +.coupons1-img { + width: 344rpx; + height: 233rpx; + overflow: hidden; +} + +.coupons1-img image { + display: block; + width: 100%; + height: 100%; +} + +.coupons1-info { + padding-left: 20rpx; +} + +.coupons1-info-name { + font-size: 28rpx; + color: #000; + letter-spacing: 0; +} + +.i { + font-size: 20rpx; + font-style: normal; +} + +.coupons1-info-price-p { + display: inline-block; + font-size: 36rpx; + color: #FD782D; + line-height: 50rpx; + /* margin-top: 21rpx; */ +} + +.tit { + font-size: 30rpx; + color: #000; + letter-spacing: 0; + line-height: 42rpx; + width: 270rpx; + height: 42rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding-top: 12rpx; +} + +.coupons1-info-price-o { + display: block; + text-align: center; + font-size: 26rpx; + color: #b4b4b4; + letter-spacing: 0.96rpx; + text-decoration: line-through; + line-height: 24rpx; +} + +.coupons1-info-distance { + font-size: 22rpx; + color: #c0c0c0; + letter-spacing: 0; + padding-bottom: 10rpx; + line-height: 30rpx; +} + +.coupons1-info-address { + font-size: 22rpx; + color: #585858; + letter-spacing: 0; + line-height: 30rpx; +} + +.coupons1-btn { + position: absolute; + width: 120rpx; + bottom: 25rpx; + right: 13rpx; +} + +.coupons1-btn-gm { + background: #00c0ff !important; + border-radius: 10rpx !important; + margin: 0 !important; + padding: 0 !important; + font-family: PingFangSC-Semibold; + font-size: 28rpx; + color: #fff !important; + letter-spacing: 0; + height: 50rpx !important; + width: 138rpx !important; + line-height: 50rpx !important; +} + +.subtitle { + font-size: 24rpx; + font-weight: 100; + text-align: left; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + width: 300rpx; + color: #999; + letter-spacing: 0; + height: 30rpx; +} + +.coupons1-info-manjian { + color: #fa7c7a; + font-size: 20rpx; + line-height: 34rpx; + display: inline-block; +} + +.jian { + width: 44rpx; + position: absolute; + bottom: 1.7%; + right: 3.5%; +} + +/**上拉加载更多**/ + +.userinfo { + display: flex; + flex-direction: column; + align-items: center; +} + +.userinfo-avatar { + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.userinfo-nickname { + color: #aaa; +} + +.sy { + display: block; + text-align: center; + width: 120rpx !important; + margin-top: 6rpx; +} + +.usermotto { + margin-top: 200px; +} + +/**/ + +scroll-view { + width: 100%; +} + +.item { + width: 90%; + height: 300rpx; + margin: 20rpx auto; + background: brown; + overflow: hidden; +} + +.item .img { + width: 430rpx; + margin-right: 20rpx; + float: left; +} + +.title { + font-size: 30rpx; + display: block; + margin: 30rpx auto; +} + +.description { + font-size: 26rpx; + line-height: 15rpx; +} +button::after{ border: none; } +.goback{ + position: fixed; + right: 50rpx; + bottom: 60rpx; + width:100rpx!important; + height:100rpx; + z-index: 100; + background:rgba(255,255,255,1); + line-height: 95rpx; + border:1rpx solid rgba(227,227,227,1); + border-radius:50%; +} +.goback image{ + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} \ No newline at end of file diff --git a/pages/complaint/complaint.js b/pages/complaint/complaint.js new file mode 100644 index 0000000..02c2c98 --- /dev/null +++ b/pages/complaint/complaint.js @@ -0,0 +1,72 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const Http = require("../../utils/HttpBasics"); +var config = require("../../config/config.js"); +var app = getApp(); +Page({ + data: { + navigationBarHeight, + }, + setDescrideVal(e) { //赋值标题 + let descrideVal = e.detail.value + this.setData({ + descrideVal: descrideVal, + titleVale: "", //标题 + descrideVal: "", //描述 + }) + }, + setTitVal(e) { //赋值描述 + let titleVale = e.detail.value + this.setData({ + titleVale: titleVale + }) + }, + save() { //提交 + if (!this.data.titleVale){ + tt.showToast({ + title: '请输入标题', + icon: "none", + duration: 2000 + }) + return + }else if(!this.data.descrideVal){ + tt.showToast({ + title: '请输入类容', + icon:"none", + duration:2000 + }) + return + } + let parameter = { + title: this.data.titleVale, + explains: this.data.descrideVal + } + Http.post({ + url: config.api.suggest, + data: parameter + }).then(item=>{ + tt.showToast({ + title: "提交成功!", + icon: 'none', + duration: 2000, + success: () => { + setTimeout(() => { + tt.reLaunch({ + url: '/index/index' + }) + }, 2000) + } + }); + }).catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + // mask: false + }); + }) + + }, + onLoad: function (options) { + + } +}) \ No newline at end of file diff --git a/pages/complaint/complaint.json b/pages/complaint/complaint.json new file mode 100644 index 0000000..f705074 --- /dev/null +++ b/pages/complaint/complaint.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "投诉建议", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/complaint/complaint.ttml b/pages/complaint/complaint.ttml new file mode 100644 index 0000000..6047727 --- /dev/null +++ b/pages/complaint/complaint.ttml @@ -0,0 +1,21 @@ + + + + + + {{"标题:"}} + + + + + + 详情描述: + + + + 提交 + + + + \ No newline at end of file diff --git a/pages/complaint/complaint.ttss b/pages/complaint/complaint.ttss new file mode 100644 index 0000000..d1545ce --- /dev/null +++ b/pages/complaint/complaint.ttss @@ -0,0 +1,63 @@ +.Box { + width: 90%; + /* height: 100vh; */ + margin: auto; + overflow: hidden; + font-size: 32rpx; + } + + .titleBox { + overflow: hidden; + margin: 20rpx 0; + } + + .title { + height: 40rpx; + float: left; + padding: 20rpx 20rpx 20rpx 0; + } + + .titValueBox { + width: 500rpx; + float: left; + border: 1px solid rgba(0, 0, 0, 0.1); + border-radius: 6rpx; + padding: 10rpx 10rpx 10rpx 0; + margin: 10rpx 10rpx 10rpx 0; + } + + .titValue { + margin-left: 20rpx; + } + + .describeBox { + padding: 20rpx 20rpx 20rpx 0; + } + + .describeValueBox { + width: 80%; + margin-left: 108rpx; + margin-top: 40rpx; + border-radius: 6rpx; + border: 1px solid rgba(0, 0, 0, 0.1); + height: 600rpx; + } + + .describeValue { + width: 92%; + height: 90%; + margin: 10rpx auto; + + } + + .submit{ + width: 600rpx; + height: 80rpx; + background-color: #FD832D; + color: #fff; + text-align: center; + line-height: 80rpx; + border-radius: 50rpx; + margin: 100rpx 0rpx 0 50rpx; + + } \ No newline at end of file diff --git a/pages/coupon/detail/index.js b/pages/coupon/detail/index.js new file mode 100644 index 0000000..9928209 --- /dev/null +++ b/pages/coupon/detail/index.js @@ -0,0 +1,1464 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +var config = require("../../../config/config.js"); +var app = getApp(); +const Http = require("../../../utils/HttpBasics"); +const util = require("../../../utils/util"); +const imgurl = require("../../../utils/imgurl"); +Page({ + data: { + isGetUser: true,//判断是否授权抖音 + mouldType: 0, + navigationBarHeight, + homeSelectedO: imgurl.homeSelectedO.url, + isshowposter: false, //是否显示分享弹框 + fenxiang: imgurl.fenxiang1.url, + fenxiangUrl: imgurl.fenxiang.url, + clockUrl: imgurl.clock.url, + yushouUrl: imgurl.yushou.url, + teljpgUrl: imgurl.teljpg.url, + closedUrl: imgurl.closed.url, + quesGouUrl: imgurl.ques_gou.url, + headbgUrl: imgurl.headbg.url, + quesBgUrl: imgurl.ques_bg.url, + close02: imgurl.close02.url, + share01: imgurl.share01.url, + fail: imgurl.fail.url, + wmhome: imgurl.wmhome.url, + swiperCurrent: 0, + detailPicture: [], + coverPicture: [], + couponList: [], + data: { + title: null + }, + showPage: false, + questions1: null, + questions2: null, + carList: [], + couponChannelId: null, + orderId: "", + hour: null, + day: null, + month: null, + year: null, + minute: "", + tempFilePaths: null, + userInfo: {}, + hasUserInfo: false, + canIUse: tt.canIUse('button.open-type.getUserInfo'), + id: null, + result: [], + end_time: null, + checked: false, + questionnaire: {}, + questionId: null, + widthScreen: null, + moveData: null, + rotateData: null, + alphaData: null, + scaleData: null, + skewData: null, + matrixData: null, + opacity: 0, + queueData: null, + zIndex: 11, + display: "none", + showbutton: false, + cardData: null, + showCardOffer: false, + isSamePeople: true, + statusText: '', + isReceived: false, + receivedDisabled: false, + clock: "结束", + day: "00", + hour: "00", + min: "00", + sec: "00", + clock02: "00", + day02: "00", + hour02: "00", + min02: "00", + sec02: "00", + countdown: "", + showbutton1: false, + limitCondition: "", + minLimit: 0, + maxLimit: 0, + dispressEndDate: false, + barTitle: "", + activityStatus: "", + //图文混排 + curHtml: '', + contentType: 0, + page: 1,//查询商户优惠券page + idList: [], + showBox: false,//手机号授权框 + }, + /** + * 显示分享弹框 + */ + showshare: function () { + this.setData({ + isshowposter: true, + }) + }, + getCouponList: function (id) { + let that = this; + let data; + data = { + status: 0, + merchantIds: id, + pageNum: that.data.page, + pageSize: 5, + } + Http.post({ + url: config.api.listByMerchant, + data: data + }).then(res => { + if (res.data.page.list <= 0) { + return + } + let dataLsit = [] + // dataLsit = that.data.couponList + dataLsit = res.data.page.list + dataLsit.map((item, index) => { + if (item.id == that.data.couponChannelId) { + dataLsit.splice(index, 1) + } + }) + if (that.data.page > 1) { + let tmpeLsit = that.data.couponList + tmpeLsit.push(...dataLsit) + that.setData({ + couponList: tmpeLsit, + }) + } else { + that.setData({ + couponList: dataLsit, + }) + } + + + // if (res.data && res.data.qrCode){ + // that.setData({ + // qrCode: res.data.qrCode, + // }) + // } + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + + setPhone(paramData) {//子组件调用这个方法说明手机号已经授权成功 + this.setData({ + showBox: paramData.detail, + }) + tt.showToast({ + title: '授权成功', // 内容 + icon: 'none', // 图标 + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }, + setBox(paramData) { + this.setData({ + showBox: paramData.detail + }) + tt.showToast({ + title: '取消授权', // 内容 + icon: 'none', // 图标 + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }, + /** + * 隐藏分享弹框 + */ + hidemodal: function () { + this.setData({ + isshowposter: false, + }) + }, + /** + * 显示分享海报 + */ + /* showPoster: function() { + //跳转到海报生成页 + console.log(this.data.canIUse) + + // return; + tt.navigateTo({ + url: `/pages/canvas/index?couponChannelId=${this.data.data.id}` + }) + }, */ + showPoster: function () { + //跳转到海报生成页 + let that = this; + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res => { + tt.navigateTo({ + url: `/pages/canvas/index?couponChannelId=${that.data.data.id}` + }) + }).catch(err => { + console.log(err) + if (err.code == 11004) { + // 用户昵称未授权 + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${that.data.data.id}&fromflag=poster` + }) + } + }) + + }, + swiperChange: function (e) { + this.setData({ + swiperCurrent: e.detail.current + }); + }, + gohome(e) { + console.log(e.currentTarget.dataset.id, "123") + tt.navigateTo({ + url: `/pages/fillIndent/fillIndent?couponChannelId=${e.currentTarget.dataset.couponchannelid}&couponId=${e.currentTarget.dataset.couponid}&shippingtype=${e.currentTarget.dataset.shippingtype}`, + }) + }, + + gochild(e) { + let id = e.currentTarget.dataset.id + tt.navigateTo({ + url: `/pages/coupon/childDetail/childDetail?couponIds=${id}`, + }) + }, + //获取当前登录用户信息 + getUserInfo: function () { + let that = this; + // 获取用户信息 + Http.get({ + url: config.api.getScore, + data: {} + }) + .then(res => { + console.log(res) + that.getQueryCardStatus() + if (that.data.cardData.cuserId != res.data.id) { + console.log(2222, 6666) + that.setData({ + isSamePeople: false + }) + } + }) + }, + //获取卡转赠状态 + getQueryCardStatus() { + let that = this; + let param = { + id: this.data.cardData.couponOrderId, + cUserId: this.data.cardData.cuserId, + updateDate: util.formatTime(Number(that.data.cardData.updateDate), "yyyy-MM-dd hh:mm:ss") + } + Http.get({ + url: config.api.queryCardStatus, + data: param + }) + .then(res => { + console.log(res, 333333333333) + }) + .catch(err => { + that.setData({ + isReceived: true, + statusText: err.message + }) + }) + }, + receiveCard() { + let that = this; + let param = { + id: this.data.cardData.couponOrderId, + cUserId: this.data.cardData.cuserId, + updateDate: util.formatTime(Number(this.data.cardData.updateDate), "yyyy-MM-dd hh:mm:ss") + } + + this.setData({ + receivedDisabled: true + }) + Http.post({ + url: config.api.cardAccept, + data: param + }) + .then(res => { + tt.showToast({ + title: '领取成功!', + icon: 'none', + duration: 2000, + mask: false + }); + tt.reLaunch({ + url: '/pages/complete/index?couponOrderId=' + this.data.cardData.couponOrderId, + }) + }) + .catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + that.setData({ + receivedDisabled: false + }) + }) + }, + closeAlert() { + this.setData({ + showCardOffer: false + }) + }, + goback: function () { + tt.reLaunch({ + url: '/index/index', + }) + }, + /** + * 点击提交问题单选 + */ + formSubmit: function (e) { + console.log(e); + let that = this; + /** + * 多选 + */ + if (e.currentTarget.dataset.flags == 'multi') { + if (that.data.anwserId.length == 0) { + var answserIs = null + } else { + var answserIs = that.data.anwserId.join(","); + } + } else if (e.currentTarget.dataset.flags == 'single') { + var answserIs = e.detail.value; + } + console.log(answserIs) + console.log(e.currentTarget.dataset.questionid) + Http.post({ + url: config.api.answerQuestion, + data: { + answer: answserIs, + questionId: e.currentTarget.dataset.questionid + } + }) + .then(res => { + that.closeQuestion(); + }) + .catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + /** + * 多选 + */ + checkboxChange: function (e) { + console.log(e) + this.setData({ + anwserId: e.detail.value + }) + }, + + closeQuestion: function () { + let that = this; + that.setData({ + display: "none", + zIndex: 11, + opacity: 0 + }) + setTimeout(function () { + that.orderFunc(); + }, 500) + }, + ifGetUser() { + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res => { + }).catch(err => { + if (err.code == 11004) { + this.setData({ + isGetUser: false + }) + } + }) + }, + + gotopay: function (e) { + let that = this; + app.globalData.previewFlag = true + /* 判断是否授权*/ + if (!that.data.isGetUser) { + tt.getUserProfile({//授权抖音 + success(res) { + Http.post({ + url: config.api.getUserInfo, + data: { + encryptedData: res.encryptedData, + iv: res.iv + } + }).then(res => { + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + tt.showLoading(); + if (e.currentTarget.dataset.type == 51 || e.currentTarget.dataset.type == 50) { + tt.navigateTo({ + url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId, + }) + } else { + let formId = e.detail.formId ? e.detail.formId : ""; + var discount = e.currentTarget.dataset.discount; + that.setData({ + queueData: null, + showbutton: true, + formId: formId + }) + Http.get({ + url: config.api.getQuestion, + data: { + couponType: JSON.stringify(that.data.data.type) + } + }).then(res => { + tt.hideLoading(); + if (res.data == undefined) { + // 立即购买 + that.orderFunc(discount); + that.setData({ + flag: false + }) + } else if (res.data) { + var animation = tt.createAnimation({}); + animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({ + duration: 500 + }) + that.setData({ + queueData: animation.export(), + zIndex: 9, + opacity: 1, + display: "block", + questionnaire: JSON.parse(res.data.content), + questionId: res.data.id + }); + } + }).catch(err => { + tt.hideLoading(); + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }).catch(err => { + that.setData({ + showBox: true + }) + + // tt.navigateTo({ + // url: '/pages/getPhone/getPhone', + // }); + }) + }) + .catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + fail(err) { + console.log(`getUserInfo 调用失败`, err); + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + tt.showLoading(); + if (e.currentTarget.dataset.type == 51 || e.currentTarget.dataset.type == 50) { + tt.navigateTo({ + url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId, + }) + } else { + let formId = e.detail.formId ? e.detail.formId : ""; + var discount = e.currentTarget.dataset.discount; + that.setData({ + queueData: null, + showbutton: true, + formId: formId + }) + Http.get({ + url: config.api.getQuestion, + data: { + couponType: JSON.stringify(that.data.data.type) + } + }).then(res => { + tt.hideLoading(); + if (res.data == undefined) { + // 立即购买 + that.orderFunc(discount); + that.setData({ + flag: false + }) + } else if (res.data) { + var animation = tt.createAnimation({}); + animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({ + duration: 500 + }) + that.setData({ + queueData: animation.export(), + zIndex: 9, + opacity: 1, + display: "block", + questionnaire: JSON.parse(res.data.content), + questionId: res.data.id + }); + } + }) + .catch(err => { + tt.hideLoading(); + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }).catch(err => { + that.setData({ + showBox: true + }) + }) + }, + }); + } else { + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + if (e.currentTarget.dataset.type == 51 || e.currentTarget.dataset.type == 50) { + tt.navigateTo({ + url: '/pages/integralmall/payIntegcoupondetail/index?couponChannelId=' + that.data.couponChannelId + '&couponId=' + that.data.couponId, + }) + } else { + let formId = e.detail.formId ? e.detail.formId : ""; + var discount = e.currentTarget.dataset.discount; + that.setData({ + queueData: null, + showbutton: true, + formId: formId + }) + Http.get({ + url: config.api.getQuestion, + data: { + couponType: JSON.stringify(that.data.data.type) + } + }).then(res => { + tt.hideLoading(); + if (res.data == undefined) { + // 立即购买 + that.orderFunc(discount); + that.setData({ + flag: false + }) + } else if (res.data) { + var animation = tt.createAnimation({}); + animation.translate((that.data.widthScreen - that.data.widthScreen), 0).scale(1).opacity(1).step({ + duration: 500 + }) + that.setData({ + queueData: animation.export(), + zIndex: 9, + opacity: 1, + display: "block", + questionnaire: JSON.parse(res.data.content), + questionId: res.data.id + }); + } + }) + .catch(err => { + tt.hideLoading(); + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }).catch(err => { + that.setData({ + showBox: true + }) + + // tt.navigateTo({ + // url: '/pages/getPhone/getPhone', + // }); + }) + } + + }, + setIntervalTime(end_time) { + let that = this; + var EndTime = end_time; + var NowTime = new Date().getTime(); + var total_micro_second = EndTime - NowTime || []; + // 渲染倒计时时钟 + let obj = that.dateformat(total_micro_second); + if (total_micro_second > 0) { + that.setData({ + clock: obj, + day: obj.a1, + hour: obj.b1, + min: obj.c1, + sec: obj.d1, + }) + } else { + that.setData({ + clock: "00", + day: "00", + hour: "00", + min: "00", + sec: "00", + }) + //如果倒计时结束,需要重新查询一下券的状态 + // 给getDetail一个标识 + that.getDetail(that.data.couponChannelId, 'endclock'); + } + total_micro_second -= 1000; + }, + countdown: function (end_time) { + let that = this; + that.setIntervalTime(end_time); + that.data.setInterval = setInterval(function () { + that.setIntervalTime(end_time); + }, 1000) + }, + // 时间格式化输出,如11:03 25:19 每1s都会调用一次 + dateformat(micro_second) { + // 总秒数 + var second = Math.floor(micro_second / 1000); + // 天数 + var day = Math.floor(second / 3600 / 24) < 10 ? "0" + Math.floor(second / 3600 / 24) : Math.floor(second / 3600 / 24); + // 小时 + var hr = Math.floor(second / 3600 % 24) < 10 ? "0" + Math.floor(second / 3600 % 24) : Math.floor(second / 3600 % 24); + // 分钟 + var min = Math.floor(second / 60 % 60) < 10 ? "0" + Math.floor(second / 60 % 60) : Math.floor(second / 60 % 60); + // 秒 + var sec = Math.floor(second % 60) < 10 ? "0" + Math.floor(second % 60) : Math.floor(second % 60); + + // return day + "天" + hr + "小时" + min + "分钟" + sec + "秒"; + return { + a1: day, + b1: hr, + c1: min, + d1: sec + } + }, + /** + * 获取用户信息 + */ + onLoad(options) { + + this.setData({ + mouldType: app.globalData.mouldType, + }) + let that = this; + if (options.g) { + app.globalData.havePlayEd1 = true; + } + tt.showLoading({ + title: "加载中..." + }); + that.setData({ + onshow: false + }) + if (options && (options.couponChannelId || options.couponIds)) { + if (options.couponIds) { + this.setData({ + couponIds: options.couponIds + }) + that.getDetail(options.couponIds, 'notendclock'); + } else { + that.getDetail(options.couponChannelId, 'notendclock'); + } + + + } + /** + * 转赠判断 + */ + if (options.cuserId) { + this.setData({ + showCardOffer: true, + cardData: options + }) + this.getUserInfo() + } + that.setData({ + couponChannelId: options.couponChannelId, + title: that.data.data.title ? that.data.data.title : '', + }); + if (options.cardType) { + that.setData({ + cardType: options.cardType + }) + } + }, + getHtml(couponChannelId) { + Http.get({ + url: config.api.couponHtmlDetail, + data: { + couponChannelId: couponChannelId + } + }).then(res => { + console.log(res) + if (res.code == 200 && res.data.html) { + this.setData({ + curHtml: decodeURI(res.data.html) + }) + app.globalData.curHtml = this.data.curHtml; + console.log(app.globalData.curHtml) + } + }) + }, + getDetail: function (couponChannelId, flag) { + let that = this; + let data = {}; + if (that.data.couponIds) { + data.couponId = couponChannelId + } else { + data.couponChannelId = couponChannelId + } + var parmer = { + url: config.api.couponDetail, + data: data + }; + Http.get(parmer) + .then(res => { + + if (res.data.merchantVoList && res.data.merchantVoList.length) { + let merchantVoList = res.data.merchantVoList + let idList = [] + merchantVoList.map(item => { + idList.push(item.id) + }) + that.setData({ + idList: idList + }) + that.getCouponList(idList) + } + //aaa + if (res.data.contentType != undefined && res.data.contentType == 1) { + //获取图文展示详情html + this.setData({ + contentType: res.data.contentType + }) + this.getHtml(couponChannelId); + } + that.setData({ + couponId: res.data.couponId + }) + that.setData({ + showPage: true + }) + if (res && res.data && res.data.detailPicture) { + that.setData({ + detailPicture: JSON.parse(res.data.detailPicture) + }) + } + if (res && res.data && res.data.coverPicture) { + that.setData({ + coverPicture: JSON.parse(res.data.coverPicture) + }) + } + if (res && res.data && res.data.conditions) { + that.setData({ + limitCondition: JSON.parse(res.data.conditions).type + }) + if (JSON.parse(res.data.conditions).type == 2 && (JSON.parse(res.data.conditions).min || JSON.parse(res.data.conditions).min == 0)) { + that.setData({ + minLimit: JSON.parse(res.data.conditions).min + }) + } + if (JSON.parse(res.data.conditions).type == 2 && (JSON.parse(res.data.conditions).max) || JSON.parse(res.data.conditions).max == 0) { + that.setData({ + maxLimit: JSON.parse(res.data.conditions).max + }) + } + } + /** + * 将优惠券优惠卡的详情的BarTitle + * 设置成券的名称 + */ + // tt.setNavigationBarTitle({ + // title: res.data.title + // }) + that.setData({ + barTitle: res.data.title + }) + var EndTime = res.data.validStartDate; + var NowTime = new Date().getTime(); + + /** + * activityStatus==0 活动未开始 + * activityStatus==1 活动已开始 + * flag == endclock 说明倒计时已经结束 + */ + if (res.data.endTime && res.data.beginTime) { + that.setData({ + begin_time: res.data.beginTime, + end_time: res.data.endTime, + activityStatus: res.data.activityStatus ? res.data.activityStatus : '' + }) + if (res.data.activityStatus == 0 && flag != 'endclock') { + that.countdown(res.data.beginTime); + } else if (res.data.activityStatus != 0 && flag != 'endclock') { + that.countdown(res.data.endTime); + } else { + clearInterval(that.data.setInterval) + } + if (res.data.activityStatus == 0) { + var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss"); + if (util.timechuo(beginTime).indexOf('-') == 0) { + that.setData({ + beginTime: "活动已结束", + }); + } else { + that.setData({ + beginTime: util.timechuo(beginTime) + }); + } + } else { + var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss"); + if (util.timechuo(endTime).indexOf('-') == 0) { + that.setData({ + endtime: "活动已结束", + }); + } else { + that.setData({ + endtime: util.timechuo(endTime) + }); + } + } + } + tt.hideLoading(); + that.setData({ + data: res.data, + merchantVoList: res.data.merchantVoList + }); + if (res.data.type == 10) { + that.setData({ + salePriceStr: res.data.salePriceStr, + pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"), + pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"), + priceStr: res.data.priceStr, + tailPriceStr: res.data.tailPriceStr, + origPriceStr: res.data.origPriceStr + }) + } + if (res.data.validType == 1) { + that.setData({ + validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"), + validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"), + pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"), + pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"), + }); + } else { + if (res.data.validDays) { + that.setData({ + validDays: res.data.validDays + }); + } + } + }).catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + /** + * 邀请好友继续砍价 + */ + inviteFriend: function (e) { + let that = this; + let formId = e.detail.formId; + that.setData({ + formId: formId, + showbutton1: true + }) + that.orderFunc("discount"); + }, + /** + * 支付订单更新 + */ + payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => { + let that = this; + // 支付成功 + Http.post({ + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + composeOrderId: orderId, + status: status, + reason: reason + } + }) + .then(res => { + tt.hideLoading() + // 有价券 + if (!type && type != 'free') { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${orderId + }` + }); + } else if (type == 'free') { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${orderId + }` + }); + } + }) + .catch(err => { + console.log(err); + if (!type) { + setTimeout(function () { + _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType); + }, 2000) + } + }) + }, + checkPhoneStatus: function () { + let that = this; + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }) + .then(res => { + console.log(666, '授权成功!') + that.receiveCard() + }) + .catch(err => { + if (err.code == 11005) { + /** + * 手机号没有授权,将值传到用户手机号授权的页面 + * + */ + tt.redirectTo({ + url: "/pages/getphoneInfo/index?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate, + }); + } else if (err.code == 11006) { + // 用户手机已加密 + tt.redirectTo({ + url: "/pages/phoneinput/phoneinput?path=index&cuserId=" + that.data.cardData.cuserId + "&couponChannelId=" + that.data.cardData.couponChannelId + "&userName=" + that.data.cardData.userName + "&coverImg=" + that.data.cardData.coverImg + "&avatarUrl=" + that.data.cardData.avatarUrl + "&couponOrderId=" + that.data.cardData.couponOrderId + "&updateDate=" + that.data.cardData.updateDate, + }); + } else { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + }, + // 券包支付 + + /** + * 发起支付 + */ + orderFunc(discount) { + let that = this; + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res => { + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }) + .then(res => { + // 发起砍价 + if (discount == 'discount') { + var data = { + couponChannelId: "" + that.data.couponChannelId, + couponId: "" + that.data.couponId, + formId: "" + that.data.formId, + press: true + } + } else if (discount == 'discount1') { + var data = { + couponChannelId: "" + that.data.couponChannelId, + couponId: "" + that.data.couponId, + formId: "" + that.data.formId, + press: false + } + } else if (that.data.couponChannelId == null) { + var data = { + couponId: "" + that.data.couponId, + formId: "" + that.data.formId, + }; + } else { + var data = { + couponChannelId: "" + that.data.couponChannelId, + couponId: "" + that.data.couponId, + formId: "" + that.data.formId, + } + } + console.log(data, "data") + let url = "" + let tempObj; + let tempArr = [] + if (that.data.data.type == 12) { + url = config.api.couponPackageSave + tempObj = { + signleOrder: { + couponChannelId: "" + that.data.couponChannelId, + couponId: "" + that.data.couponId, + formId: "" + that.data.formId, + }, + count: "1" + } + tempArr.push(tempObj) + } else { + url = config.api.orderSave + } + /** + * orderSave 下单 + */ + return Http.post({ + url: url, + data: that.data.data.type == 12 ? JSON.stringify(tempArr) : data + }); + }).catch(err => { + tt.hideLoading() + that.setData({ + showbutton: false, + showbutton1: false + }) + if (err.code == 2011) { + tt.showToast({ + title: "商户信息没找到", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 2013) { + tt.showToast({ + title: "商户信息禁用", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3000) { + tt.showToast({ + title: "库存不足", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3001) { + tt.showToast({ + title: "您已超过限购", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3002) { + tt.showToast({ + title: "订单失败", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3003) { + tt.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3004) { + tt.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 4003) { + tt.showToast({ + title: "卡券已作废", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3012) { + that.getUnPaidOrder(that.data.couponId); + } else if (err.code == 11005) { + /** + * 将值传到用户手机号授权的页面 + * + */ + tt.redirectTo({ + url: "/pages/getphoneInfo/index?couponChannelId=" + + that.data.couponChannelId + }); + } else if (err.code == 11006) { + // 用户手机已加密 + tt.redirectTo({ + url: "/pages/phoneinput/phoneinput?couponChannelId=" + + that.data.couponChannelId + }); + } else { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }).then(res => { + if (discount != 'discount') { + if (typeof (res) != "undefined") { + let orderId = "" + res.data.mainOrderId; + that.setData({ + orderId: orderId, + composeOrderType: res.data.composeOrderType + }); + if (res.data.payment > 0) { + // 支付金额不为0 + /** + * 支付订单创建 + */ + Http.post({ + url: config.api.payOrderCreate, + data: { + orderId: orderId, + composeOrderType: res.data.composeOrderType + } + }).then(res => { + var payOrderId = "" + res.data.outOrderNo; + tt.hideLoading(); + tt.pay({ + service: 5, + orderInfo: { + order_id: res.data.orderId, + order_token: res.data.token, + }, + success: res => { + tt.showLoading({ + title: '订单正在处理中...', + }) + if (res.code === 0) { + that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that, that.data.composeOrderType); + if (res.errMsg == "requestPayment:ok") { + /** + * 用户支付成功以后跳转到券包列表 + */ + if (that.data.cardType == 100) { + tt.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else if (that.data.data.type != 5 && that.data.cardType != 100) { + tt.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + } + } + else if (res.code === 1) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付超时', // 内容 + icon: "none" + }); + + } else if (res.code === 2) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付失败', // 内容 + icon: "none" + }); + } else if (res.code === 3) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付关闭', // 内容 + icon: "none" + }); + } else if (res.code === 4) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付取消', // 内容 + icon: "none" + }); + } else if (res.code === 9) { + that.setData({ + showbutton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '订单状态开发者自行获取', // 内容 + icon: "none" + }); + } + + }, + fail: res => { + tt.hideLoading(); + /** + * 支付失败,需要更新订单的状态 + */ + that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that, that.data.composeOrderType); + that.setData({ + showbutton: false + }) + return; + }, + complete: res => { } + }); + /// End payment -------- + }) + .catch(err => { + tt.hideLoading(); + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } else { + // 免费券 + that.payOrderUpdate(orderId, "0", 1, '', 'free', that, that.data.composeOrderType); + if (that.data.cardType == 100) { + tt.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else if (that.data.data.type != "5" && that.data.cardType != 100) { + tt.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + } + } + } else { + if (res) { + tt.navigateTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.mainOrderId}&composeOrderType=${res.data.composeOrderType}`, + }) + } + } + }) + }).catch(err => { + console.log(err) + if (err.code == 11004) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?fromflag=coupondetail&couponChannelIdflag=${that.data.couponChannelId}`, + }) + } else { + tt.showToast({ + title: err.message, + icon: "none", + duration: 2500 + }) + } + }) + }, + // 获得未支付的订单 + getUnPaidOrder(couponId) { + let that = this; + Http.get({ + url: config.api.getUnPaidOrder, + data: { + couponId: couponId + } + }).then(res => { + that.setData({ + disOrderNumber: res.data.orderNumber, + composeOrderType: res.data.composeOrderType + }) + + if (res.data && res.data.pressEndDate) { + that.setData({ + dispressEndDate: true + }) + } else { + that.setData({ + dispressEndDate: false + }) + } + if (that.data.dispressEndDate) { + tt.showModal({ + title: '提示', + content: "您有未支付订单,请到“我的-我的砍价”进行支付", + confirmText: "我的砍价", + success: function (res) { + if (res.confirm) { + tt.navigateTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.disOrderNumber}&composeOrderType=${that.data.composeOrderType}`, + }) + } + } + }) + } else { + tt.showModal({ + title: '提示', + content: '您有未支付订单,请先进行支付', + confirmText: "去支付", + success: function (res1) { + if (res1.confirm) { + + if (that.data.composeOrderType > 0) {//券包 + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`, + }) + } else { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`, + }) + } + + } + } + }) + } + }).catch(error => { + tt.showToast({ + title: error.message, + icon: "none", + duration: 3000 + }) + }) + }, + onShow() { + this.ifGetUser()//判断是否授权抖音 + this.setData({ + mouldType: app.globalData.mouldType, + showbutton: false, + showbutton1: false + }) + if (this.data.end_time && this.data.activityStatus != 0) { + this.countdown(this.data.end_time) + } else if (this.data.begin_time && this.data.activityStatus == 0) { + this.countdown(this.data.begin_time) + } + }, + onUnload: function () { + let that = this; + clearInterval(that.data.setInterval) + }, + onHide: function () { + let that = this; + clearInterval(that.data.setInterval) + }, + onShareAppMessage: function (options) { + app.globalData.previewFlag = true + var that = this; + console.log(options) + var shareObj = { + title: that.data.data.title, + path: `/pages/index/index?couponChannelId=${that.data.couponChannelId}`, + success: function (res) { + if (res.errMsg == 'shareAppMessage:ok') { } + }, + fail: function (err) { + // if (err.errMsg == 'shareAppMessage:fail cancel') { } else if (err.errMsg == 'shareAppMessage:fail') { } + } + }; + // 来自页面内的按钮的转发 + if (options.from == 'button'&&options.channel != 'video') { + var eData = options.target.dataset.id; + shareObj.path = `/pages/index/index?couponChannelId=${eData}&frommd=JC`; + + }else + if(options.channel == 'video'){ + // return { + // channel: 'video', // 必写 video + //     templateId: '',   // 分享的模版 id (如果未设置就是默认,下面会说如何设置) + // title: `${that.data.barTitle}`,     // 分享的标题 + // desc: `${that.data.data.dyTitle}`,     // 分享的内容介绍目前没有用 + //     path: `/pages/index/index`,  // 分享的路径 + // extra: { + // videoTopics: [ that.data.data.dyTitle] // 只有抖音才会有的属性 + // }, + // } + shareObj.channel = 'video'; + shareObj.title = `${that.data.barTitle}`; + shareObj.extra = { + videoTopics:["123"] + } + } + console.log(shareObj) + // 返回shareObj + return shareObj; + }, + + + // 下拉刷新 + onPullDownRefresh: function () { + this.getDetail(this.data.couponChannelId); + tt.stopPullDownRefresh() + }, + onReachBottom: function () { + this.setData({ + page: this.data.page + 1 + }) + + if (this.data.idList.length > 0) { + this.getCouponList(this.data.idList) + } + } +}); \ No newline at end of file diff --git a/pages/coupon/detail/index.json b/pages/coupon/detail/index.json new file mode 100644 index 0000000..e72c1ba --- /dev/null +++ b/pages/coupon/detail/index.json @@ -0,0 +1,11 @@ +{ + "usingComponents": { + "navbar": "../../../components/navbar/navbar", + "store": "../../../components/store/index", + "c-coupons": "../../../components/coupons/index", + "phoen":"../../../components/getPhoen/getPhoen" + }, + "navigationBarTitleText": "", + "backgroundColor":"#f4f4f4", + "enablePullDownRefresh": true + } \ No newline at end of file diff --git a/pages/coupon/detail/index.ttml b/pages/coupon/detail/index.ttml new file mode 100644 index 0000000..0979d80 --- /dev/null +++ b/pages/coupon/detail/index.ttml @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + 距结束 : + 距开始 : + + + 已经结束 + + + + {{day}}天: + + {{hour}}: + {{min}}: + {{sec}} + + + {{data.title}}电子卡 + {{data.subTitle}} + + + 定金: + ¥ {{salePriceStr}} + 尾款抵扣: + ¥ {{priceStr}} + + + 提货尾款: + ¥ {{tailPriceStr}} + {{origPriceStr}} + + 预购时间:{{validStartDate}}至{{validEndDate}} + + 提货时间:{{pickStartDate}}至{{pickEndDate}} + + + + + + {{data.salePriceStr}} + {{data.creditPrice}} + 积分 + + + {{data.priceStr}}元 + {{data.priceStr}}小时 + + 过期不退款 + + + + + {{data.salePriceStr}} + {{data.pressLimitNum+'人可砍至底价'}} + {{data.priceStr}}元 + + 过期不退款 + + + + + + + 自领取之日起 + {{validDays}}天内有效 + (请在有效期内使用) + + + {{validStartDate}}至{{validEndDate}} + + + 当次有效 + + + + 使用条件: + 满{{data.usePriceStr}}元可用 + + + + + 限购{{data.useLimitQuantity}}张 + (仅限新用户活动) + ({{minLimit}}-{{maxLimit}}成长值) + (大于{{minLimit}}成长值) + 剩余{{data.remainInventory}}张 + + + + + + + + + + + {{item.title}} + ¥{{item.priceStr}} + + + + + + 购买须知 + + + {{data.remark}} + + + + + + 其他活动 + + + + + + + + + +
+ + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ +
+
+ + + + + + + + + + {{questionnaire.title}} + + + + + + + + + 确定 + + + + + + + + + + + + + {{cardData.userName}} + {{cardData.userName+'送您一张消费卡'}} + 等待好友领取 + {{cardData.userName}} + + + {{statusText}} + + + + + + + + + + + + + 微信好友 + + + + 生成海报 + + + + +
+ + + + \ No newline at end of file diff --git a/pages/coupon/detail/index.ttss b/pages/coupon/detail/index.ttss new file mode 100644 index 0000000..ce6084c --- /dev/null +++ b/pages/coupon/detail/index.ttss @@ -0,0 +1,992 @@ +@import "../../../app.ttss"; + +page { + background: #f4f5f9; +} + +button::after { + border: none; +} + +.coupons { + width: 100%; + position: relative; + overflow: hidden; + padding-bottom: 170rpx; + background: #f4f5f9; +} + +.couponsL c-coupons { + width: 335rpx; + /* height: 354rpx; */ + margin-bottom: 22rpx; +} + +.couponsL c-coupons:nth-of-type(2n+1) { + float: left; +} + +.couponsL c-coupons:nth-of-type(2n) { + float: right; +} + +.banner { + position: relative; + width: 750rpx; + height: 454rpx; +} + +.banner swiper { + width: 750rpx; + height: 454rpx; +} + +.banner image { + width: 100%; + height: 454rpx; +} + +.moneyBox { + font-size: 24rpx; + overflow: hidden; +} + +.earnest { + float: left; + font-size: 28rpx; + color: #a6a6a6; +} + +.earnestNum { + float: left; + color: red; + font-size: 32rpx; +} + +.final { + float: left; + font-size: 28rpx; + color: #a6a6a6; + margin-left: 30rpx; +} + +.pickFinal_Box { + overflow: hidden; +} + +.earnestTime { + font-size: 28rpx; + color: #a6a6a6; +} + +.finalTime { + font-size: 28rpx; + color: #a6a6a6; +} + +.original { + float: left; + width: 100rpx; + margin-left: 10rpx; + text-decoration: line-through; + color: #a6a6a6; + font-size: 24rpx; + line-height: 50rpx; +} + +.dots { + position: absolute; + left: 0; + right: 0; + bottom: 50rpx; + display: flex; + justify-content: center; +} + +.dot { + margin: 0 8rpx; + width: 14rpx; + height: 14rpx; + background: #fff; + border-radius: 8rpx; + transition: all 0.6s; +} + +.home { + position: relative; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); + height: 94rpx; + width: 230rpx; + /* margin: 0 auto 30rpx; */ + margin-left: 40rpx; + float: left; + color: #fff; + font-size: 36rpx; + line-height: 94rpx; + border-radius: 21rpx; +} + +.arrive { + position: relative; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); + height: 94rpx; + width: 230rpx; + /* margin: 0 auto 30rpx; */ + margin-left: 40rpx; + float: left; + color: #fff; + font-size: 36rpx; + line-height: 94rpx; + border-radius: 21rpx; +} + +.dot.active { + width: 24rpx; + background: #f80; +} + +.refound { + border: 1rpx solid red; + padding: 3rpx 0; + display: block; + width: 130rpx; + text-align: center; + margin-left: 14rpx; +} + +.couponsL { + width: 92%; + margin: 20rpx auto; +} + +.coupons_info { + width: 92%; + padding: 0 4%; + background: #fff; + border-top-left-radius: 20rpx; + border-top-right-radius: 20rpx; + /* margin-top: -25rpx; */ +} + +.fenxiang { + position: absolute; + right: 28rpx; + top: 27rpx; + display: flex; + flex-direction: column; +} + +.fenxiang image { + width: 48rpx; + height: 48rpx; + margin: 0 auto; +} + +.gift { + color: #3c3c3c; + font-size: 20rpx; + margin: 0 auto; +} + +.user-motto { + width: 270rpx; + border: 0; + background: none; + height: 260rpx; + color: #fff; + position: fixed; +} + +.user-motto::after { + border: none; +} + +.title { + display: block; + font-weight: bold; + font-size: 32rpx; + color: #3c3c3c; + letter-spacing: 1.09rpx; + line-height: 45rpx; + width: 542rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding-top: 30rpx; +} + +.subTitle { + display: block; + width: 588rpx; + /* height: 37rpx; */ + font-size: 26rpx; + color: #a6a6a6; + letter-spacing: 1.16rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding: 6rpx 0; +} + +.rest { + font-size: 24rpx; + color: #919191; + letter-spacing: 0; + height: 50rpx; + line-height: 50rpx; + border-bottom: 1px solid #f9f9f9; +} + +.restNum { + font-size: 24rpx; + color: #999; + letter-spacing: 1.16rpx; + text-align: right; +} + +.time { + font-size: 24rpx; + color: #a6a6a6; + letter-spacing: 0; + line-height: 33rpx; + display: inline-block; +} + +.txt01 { + font-size: 24rpx; + color: #919191; + letter-spacing: 0; +} + +.price { + font-size: 24rpx; + color: #999; + letter-spacing: 0; +} + +.salePriceStr { + font-size: 24rpx; + color: #999; + letter-spacing: 0; +} + +.salePriceStr .rmb { + color: #fd782d; + font-size: 24rpx; + line-height: 40rpx; + float: left; +} + +.salePriceStr .pri01 { + font-size: 40rpx; + color: #fd782d; + letter-spacing: 0; + line-height: 40rpx; + float: left; +} + +.salePriceStr .pri01Hr { + font-size: 24rpx !important; +} + +.use { + color: #fd782d; + /* margin-left: 10rpx; */ +} + +.salePriceStr .yuan { + font-size: 24rpx; + color: #fd782d; + letter-spacing: 0; +} + +.price text { + font-size: 24rpx; + color: #333; + letter-spacing: 0; +} + +.throgh { + text-decoration: line-through; + margin-left: 10rpx; + color: #999 !important; + margin-top: 8rpx; + height: 32rpx; + line-height: 45rpx; +} + +.fl { + float: left; +} + +.fr { + float: right; +} + +.notes view:nth-child(1) { + height: 87rpx; + line-height: 87rpx; + background: #fff; + border-top: 1px solid #f9f9f9; +} + +.notes { + width: 100%; + background: #fff; + padding-bottom: 30rpx; +} + +.active { + opacity: 0.6; +} + +.notes view:nth-child(1) text { + color: #333; + letter-spacing: 0; + font-size: 30rpx; + height: 70rpx; + line-height: 70rpx; +} + +.notes view:nth-child(1) { + width: 92%; + margin: 0 auto; +} + +.notes view:nth-child(2) { + display: flex; + flex-direction: column; + width: 92%; + margin: 0 auto; +} + +.notes view:nth-child(2)>text { + font-size: 24rpx; + color: #919191; + letter-spacing: 0; + line-height: 42rpx; +} + +.buy-view { + /* background: #fff; */ + height: 92rpx; + bottom: 0; + left: 0; + right: 0; + padding-bottom: 22rpx; + padding-top: 22rpx; +} + +.buy { + position: relative; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); + height: 94rpx; + width: 560rpx; + margin-left: 170rpx; + color: #fff; + font-size: 36rpx; + line-height: 94rpx; + border-radius: 61rpx; +} + +#noBuy { + position: relative; + background-color: rgba(0, 0, 0, 0.2); + height: 94rpx; + width: 560rpx; + margin: 0 auto 30rpx; + color: #fff; + font-size: 36rpx; + line-height: 94rpx; + border-radius: 61rpx; +} + +.buyHr { + background: #cecece !important; +} + +.goback { + position: relative; + float: left; + width: 132rpx !important; + height: 96rpx; + background: rgba(255, 255, 255, 1) !important; + line-height: 95rpx; + border-radius: 32rpx; + margin-left: 20rpx; +} + +.goback image { + position: absolute; + width: 52rpx; + height: 50rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: 10rpx auto; +} + +.tel { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 50rpx; + height: 50rpx; +} + +.txt { + margin-right: 30rpx; +} + +.distance { + border: none; + border-radius: 16rpx; + width: 600rpx; + padding: 16rpx 6rpx 0 0; +} + +.distance .txt01 { + display: block; + font-size: 26rpx; + color: #ff4949; +} + +.clock { + width: 116rpx !important; + vertical-align: middle; + margin-right: 10rpx; + margin-top: -4rpx; +} + +.qiang { + position: inline-block; + width: 60rpx; + height: 40rpx; + line-height: 40rpx; + color: #ff4949; + text-align: center; + font-size: 28rpx; + margin-right: 10rpx; +} + +.times { + display: inline-block; + color: #ff4949; + font-weight: bold; + font-size: 26rpx; + text-align: center; +} + +.timess { + color: #fd782d; +} + +.times text { + display: inline-block; + margin: 6rpx; + height: 56rpx; + padding: 0 6rpx; + text-align: center; + font-size: 28rpx; + line-height: 60rpx; + border-radius: 12rpx; + color: #fff; + font-weight: bold; + background: #ff4949; +} + +.con { + position: absolute; + top: 35rpx; + right: 0; + bottom: 0; + left: 0; + margin: auto; + width: 587rpx; +} + +.con .image { + display: block; + width: 100%; +} + +.img { + margin-top: -50rpx; +} + +.question { + display: block; + width: 587rpx; + background: #fff; + border-bottom-left-radius: 22rpx; + border-bottom-right-radius: 22rpx; + overflow: hidden; +} + +.ques { + display: block; + width: 511rpx; + margin: 0 auto; + height: 95rpx; + line-height: 95rpx; + font-size: 30rpx; + color: #333; + border-bottom: 1rpx solid #eee; +} + +.titles { + width: 511rpx; + display: block; + text-align: center; + height: 50rpx; + margin: 0 auto; + padding-top: 10rpx; + padding-bottom: 20rpx; + font-size: 32rpx; + font-weight: bold; + line-height: 41rpx; + border-bottom: 1rpx solid #eee; +} + +.quessss >view:last-child { + border-bottom: 0; +} + +.wmclose { + position: relative; + z-index: 10000; + display: block; + width: 70rpx; +} + +.ques_gou { + position: absolute; + width: 20rpx; + top: 160rpx; + left: 23rpx; +} + +.btnss { + color: #f8755b; + font-weight: bold; + font-size: 30rpx !important; + text-align: center !important; +} + +.radios { + display: block; + font-size: 28rpx; + height: 95rpx; + line-height: 95rpx; + color: #333; + text-indent: 0.5em; +} + +.elecard { + display: inline-block; + margin-left: 6rpx; + color: rgba(254, 70, 20, 1); + border: 1px solid rgba(254, 70, 20, 1); + border-radius: 8rpx; + font-style: normal; + font-size: 30rpx; + line-height: 40rpx; + padding: 0 6rpx; +} + +.btns { + /* padding: 0 33rpx; */ + position: fixed; + left: 0; + right: 0; + bottom: 0; + padding-bottom: 22rpx; + padding-top: 22rpx; + z-index: 12; + /* background: #fff; */ +} + +.btnTxt { + width: 50rpx; + height: 30rpx; + line-height: 50rpx; + color: #fd782d; + font-size: 20rpx; + position: absolute; + right: 42rpx; + bottom: 15rpx; +} + +.btns .fr, .btns .fl { + width: 277rpx; + height: 95rpx; + border-radius: 48rpx; + text-align: center; +} + +.btns .fl { + margin-left: 20rpx; + color: #fff; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); +} + +.btns .fl text { + display: block; + font-size: 30rpx; + line-height: 34rpx; +} + +.btns .fl text:nth-of-type(1) { + margin-top: 12rpx; +} + +.btns .fr { + font-size: 30rpx; + color: #fff; + margin-right: 20rpx; + line-height: 95rpx; + background: linear-gradient(90deg, rgba(40, 179, 255, 1) 0%, rgba(48, 103, 255, 1) 100%); + /* box-shadow: 0px 8px 8px 1px rgba(246, 93, 51, 0.32); */ +} + +.support-tansfer { + width: 60%; + border-radius: 50rpx; + margin-top: 30rpx; + /* background: #02c0ff !important; */ + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); +} + +.shaddow { + z-index: 100; + position: fixed; + width: 100%; + height: 100%; + top: 0px; + background: rgba(0, 0, 0, 0.8); + overflow: hidden; +} + +.alert-box { + position: fixed; + top: 50%; + margin-top: -270rpx; + left: 10%; + width: 80%; + height: auto; + padding-bottom: 20rpx; + background: #fff; + z-index: 200; + border-radius: 20rpx; +} + +.user-img { + position: absolute; + top: -50rpx; + left: 250rpx; + /* margin-left: -50rpx; */ + width: 100rpx; + height: 100rpx; + z-index: 300; + border-radius: 50rpx; + background: #fff; + overflow: hidden; +} + +.user-img image { + width: 100rpx; + height: 100rpx; +} + +.close { + position: absolute; + z-index: 300; + right: 0; + top: 0; + width: 100rpx; + height: 100rpx; + overflow: hidden; +} + +.close image { + display: block; + width: 26rpx; + height: 26rpx; + margin: 20rpx 0 0 52rpx; +} + +.a-title { + text-align: center; + margin-top: 76rpx; + font-size: 36rpx; + font-family: PingFang-SC-Medium; + font-weight: 500; + color: rgba(51, 51, 51, 1); + line-height: 44rpx; +} + +.a-img { + position: relative; + width: 80%; + border-radius: 20rpx; + height: 294rpx; + overflow: hidden; + text-align: center; + margin: 30rpx auto 0; +} + +.a-received { + position: absolute; + width: 100%; + height: 294rpx; + top: 0; + left: 0; + text-align: center; + line-height: 294rpx; + z-index: 320; + background: rgba(255, 255, 255, 1); + border: 0px solid rgba(151, 57, 117, 1); + opacity: 0.91; + font-size: 36rpx; + color: rgba(255, 51, 50, 1); + font-family: PingFang-SC-Medium; +} + +.a-img image { + width: 100%; + height: 100%; +} + +.bottom { + text-align: center; + height: 70rpx; + line-height: 70rpx; + color: #999; + font-size: 32rpx; + background: #fff; + padding-top: 20rpx; +} + +.presslimit { + height: 34rpx; + line-height: 34rpx; + margin-top: 8rpx; + margin-left: 12rpx; + color: #fd782d; + font-size: 20rpx; + letter-spacing: 1.16rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +.presslimit text { + margin-left: 15rpx; + background: rgba(201, 201, 201, 0.1); +} + +checkbox-group, radio-group { + height: 400rpx; + overflow-y: scroll; +} + +.detailImg { + width: 100%; + background: #fff; + margin: auto; +} + +.detailImg image { + display: block; + width: 92%; + padding: 0 4% 0 4%; + margin-bottom: 20rpx; +} + +.content { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + background: #f3f3f3; + position: relative; +} + +.poster { + width: 100%; + height: 100%; + padding: 20rpx; + position: absolute; + top: 0; + left: 0; +} + +.bottomsave { + width: 100%; + height: 140rpx; + line-height: 140rpx; + margin: auto 0; + bottom: 0; + left: 0; + right: 0; + border-top: 1px solid #ccc; + box-shadow: 0 0rpx 150rpx #ccc; + background: #fff; +} + +.saveposter { + color: #fff; + width: 380rpx; + height: 80rpx; + border-radius: 50rpx; + background: #f08f04; + margin-top: 30rpx; + font-size: 32rpx; +} + +.modal { + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: rgba(0, 0, 0, 0.5); + overflow: hidden; + z-index: 10000; + color: #fff; +} + +.modal-content { + width: 540rpx; + height: 233rpx; + line-height: 60rpx; + overflow: hidden; + position: fixed; + top: 50%; + left: 0; + z-index: 11; + background: #f9f9f9; + margin: -16rpx 105rpx; + border-radius: 36rpx; + display: flex; +} + +.modal-content view { + display: inline-block; + flex: 1; + text-align: center; +} + +.modal-content view>text { + color: #000; + display: block; + font-size: 30rpx; +} + +.modal-content view>image { + margin-top: 40rpx; + width: 90rpx; + height: 90rpx; +} + +.tt-swiper-dots { + margin-bottom: 30rpx; +} + +.quan { + float: left; + margin: 18rpx 15rpx 0 0; + width: 12rpx; + height: 12rpx; + background: #e1e1e1; + border-radius: 50%; +} + +.swiper-box .tt-swiper-dots.tt-swiper-dots-horizontal { + margin-bottom: 2rpx; +} + +.swiper-box .tt-swiper-dot { + width: 40rpx; + display: inline-flex; + height: 6rpx; + margin-left: 10rpx; + border-radius: 6rpx; + justify-content: space-between; +} + +.swiper-box .tt-swiper-dot::before { + content: ''; + flex-grow: 1; + background: #ccc8c8; +} + +.swiper-box .tt-swiper-dot-active::before { + background: #f6792b; +} + +.jifen { + font-size: 30rpx; +} + +.childText { + color: #333; + letter-spacing: 0; + font-size: 30rpx; + height: 70rpx; + line-height: 70rpx; + background-color: #fff; + width: 92%; + padding: 0 4%; +} + +.childBox { + width: 92%; + padding: 0 4%; + display: flex; + flex-wrap: wrap; + justify-content: space-between; +} + +.childItem { + width: 48%; + background-color: #fff; + border-radius: 10rpx; + overflow: hidden; + margin: 20rpx 0; +} + +.childImg { + width: 300rpx; + height: 176rpx; + margin: 10px auto; + display: block; +} + +.childName { + margin-top: 10rpx; + margin: 10px; + font-size: 24rpx; + color: #919191; +} + +.childMoney { + color: #fd782d; + font-size: 24rpx; + margin: 10px; + text-decoration: line-through; +} + +.mount{ + width: 120rpx; + height: 120rpx; + background-color: aqua; + border-radius: 50%; + position: fixed; + right: 40rpx; + bottom: 200rpx; + z-index: 100000; +} \ No newline at end of file diff --git a/pages/detailOrder/detailOrder.js b/pages/detailOrder/detailOrder.js new file mode 100644 index 0000000..cda74fe --- /dev/null +++ b/pages/detailOrder/detailOrder.js @@ -0,0 +1,205 @@ +const app = getApp() +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const Http = require("../../utils/HttpBasics"); +let config = require("../../config/config.js"); +const util = require("../../utils/util") +Page({ + data: { + navigationBarHeight, + ifPay:true, + orderId:"", + detailObj:{}, + createDate:"", + mystatus: '', + }, + updetail(){ + Http.get({ + url:config.api.orderDetail, + data:{ + orderId: this.data.orderId + } + }).then(res=>{ + console.log(res); + let createDate = util.formatTime(res.data.createDate, "yyyy-MM-dd hh:mm:ss"); + this.setData({ + detailObj:res.data, + createDate: createDate + }) + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, // 内容 + icon: "none" + }); + }) + }, + /** + * 支付订单更新 + */ + payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType) { + let that = this; + Http.post({ + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + composeOrderId: orderId, + status: status, + reason: reason + } + }).then(res => { + tt.hideLoading(); + if(!type&&type!="free"){ + tt.showToast({ + title: "购买成功", + duration: 2000, + mask: false, + success: function () { + tt.showLoading({ + title: "加载中..." + }); + setTimeout(function () { + tt.hideLoading(); + }, 1600); + setTimeout(() => { + let url = "" + if (_this.data.orderFlag){ + tt.redirectTo({ + url: `/pages/detailOrder/detailOrder?orderId=${orderId}&dingdan=order` + }); + }else{ + tt.redirectTo({ + url: `/pages/detailOrder/detailOrder?orderId=${orderId}` + }); + } + + }, 1600); + } + }); + } else if (type == 'free'){ + tt.redirectTo({ + url: `/pages/detailOrder/detailOrder?orderId=${orderId}` + }); + } + }).catch(err => { + console.log(err); + if (!type) { + setTimeout(function () { + _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType); + }, 2000) + } + }) +}, +powerDrawer: function (e) { + let that = this; + console.log(e) + // couponOrderStatus + // 0 未使用 + // 1 已使用 + // 2 已过期 + // 3 已经退款 + if (that.data.mystatus == "" || that.data.mystatus == undefined) { + tt.navigateTo({ + url: `/pages/orderquanma/orderquanma?quancode=${ + e.currentTarget.dataset.quancode + }&title=${e.currentTarget.dataset.title}&subtitle=${ + e.currentTarget.dataset.subtitle + }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ + e.currentTarget.dataset.couponorderstatus}&validstatus=${e.currentTarget.dataset.validstatus} + &contentType=${that.data.contentType}` + }); + } else { + tt.navigateTo({ + url: `/pages/orderquanma/orderquanma?quancode=${ + e.currentTarget.dataset.quancode + }&title=${e.currentTarget.dataset.title}&subtitle=${ + e.currentTarget.dataset.subtitle + }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ + that.data.mystatus}&validstatus=${e.currentTarget.dataset.validstatus} + &contentType=${that.data.contentType}` + }); + } +}, + gotopay() { + let that = this; + Http.get({//判断是否授权抖音 + url: config.api.checkPhoneStatus, + + }).then(res => { + Http.post({ + url: config.api.payOrderCreate, + data: { + orderId: that.data.detailObj.id, + composeOrderType: that.data.detailObj.composeOrderType + } + }).then(payres => { + + tt.hideLoading(); + tt.pay({ + service: 5, + orderInfo: { + order_id: payres.data.orderId, + order_token: payres.data.token, + }, + success(suRes) { + if(suRes.code==0){ + tt.showLoading({ + title: '订单正在处理中...', + }) + that.payOrderUpdate(that.data.detailObj.id,payres.data.outOrderNo,1,"","",that,that.data.detailObj.composeOrderType) + } else if (res.code === 1) { + tt.showToast({ + title: '支付超时', // 内容 + icon: "none" + }); + + } else if (res.code === 2) { + tt.showToast({ + title: '支付失败', // 内容 + icon: "none" + }); + } else if (res.code === 3) { + tt.showToast({ + title: '支付关闭', // 内容 + icon: "none" + }); + } else if (res.code === 4) { + tt.showToast({ + title: '支付取消', // 内容 + icon: "none" + }); + } else if (res.code === 9) { + tt.showToast({ + title: '订单状态开发者自行获取', // 内容 + icon: "none" + }); + } + + }, + fail(res) { + console.log(123); + // handle fail + }, + }) + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, // 内容 + icon: "none" + }); + }) + + }) + // .catch(err => { + // if (err.code == 11005) { + // this.setData({ + // showPhoem: true + // }) + // } + // }) + }, + onLoad: function (options) { + console.log(options.orderId); + this.setData({ + orderId:options.orderId + }) + this.updetail() + } +}) \ No newline at end of file diff --git a/pages/detailOrder/detailOrder.json b/pages/detailOrder/detailOrder.json new file mode 100644 index 0000000..49f66dd --- /dev/null +++ b/pages/detailOrder/detailOrder.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "订单详情", + "usingComponents": { + "navbar": "../../components/navbar/navbar", + "store":"../../components/store/index" + } +} \ No newline at end of file diff --git a/pages/detailOrder/detailOrder.ttml b/pages/detailOrder/detailOrder.ttml new file mode 100644 index 0000000..637f702 --- /dev/null +++ b/pages/detailOrder/detailOrder.ttml @@ -0,0 +1,57 @@ + + + + + + + 支付成功 + + + + {{detailObj.title}} + + + + + {{createDate}} + + + + + + + 兑换码: + {{detailObj.couponOrderId}} + + + + + + + 订单编号: + {{detailObj.orderNumber}} + + + + + 实付金额: + {{detailObj.payment/100}}元 + + + + + + + 立即支付 + diff --git a/pages/detailOrder/detailOrder.ttss b/pages/detailOrder/detailOrder.ttss new file mode 100644 index 0000000..9f0adb5 --- /dev/null +++ b/pages/detailOrder/detailOrder.ttss @@ -0,0 +1,186 @@ +/* d:\fumaolianke\ttFmC\tt富茂C\pages\detailOrder\detailOrder.ttss */ +.ifPay{ + background-color:#2c8dff; + overflow: hidden; + color: #fff; +} +.yueImg{ + float: left; + width: 40rpx; + height: 40rpx; + /* background-color: #fff; */ + margin: 20rpx; +} +.statusPayText{ + float: left; + margin-top: 20rpx; + font-size: 30rpx; + /* font-family: PingFangSC-Regular; */ + +} +.commodityBox{ + background-color: #fff; + /* margin-top: 20rpx; */ + overflow: hidden; +} +.commodityTitle{ + margin: 20rpx; + font-size: 32rpx; +} +.imgNanText{ + overflow: hidden; +} +.commodityImgBox{ + margin: 20rpx; + width: 140rpx; + height: 140rpx; + background-color: aqua; + float: left; +} + +.commodityData{ + float: left; + /* width: 520rpx; */ + +} +.commodityName{ + margin-top: 20rpx; + font-size: 28rpx; +} +.commodityName::before{ + content: "下单时间:"; + font-size: 26rpx; + color: #999; +} +.orderBox{ + overflow: hidden; + margin-top: 20rpx; + background-color: #fff; + overflow: hidden; + border-bottom: 1rpx solid #f4f5f9; +} + +.text{ + margin: 20rpx; + float: left; + font-size: 30rpx; +} +.rqCode{ + float: left; + font-size: 30rpx; + margin-top: 20rpx; +} +.rqImg{ + float: right; + width: 50rpx; + height: 50rpx; + /* background-color: aqua; */ + margin-top: 20rpx; + margin-right: 20rpx; +} +.goQr{ + float: right; + width: 20rpx; + height: 20rpx; + /* background-color: aqua; */ + margin-top: 26rpx; + margin-right: 40rpx; +} +.orderNumBox{ + background-color: #fff; + overflow: hidden; + border-bottom: 1rpx solid #f4f5f9; +} +.orderNumBox1{ + background-color: #fff; + overflow: hidden; + +} +.orderNum{ + overflow: hidden; +} +.numText{ + margin: 20rpx; + float: left; + font-size: 30rpx; + color: #999; +} +.num{ + float: right; + font-size: 30rpx; + margin-top: 20rpx; + margin-right: 50rpx; +} +.moneyiIcn{ + margin-top: 20rpx; + color: #fd782d ; + font-size: 22rpx; + float: right; + line-height: 44rpx; + margin-right: 4rpx; +} +.money{ + float: right; + font-size: 30rpx; + margin-top: 20rpx; + margin-right: 50rpx; + color: #fd782d ; + +} +.shop{ + margin: 20rpx; + font-size: 32rpx; +} +.shopbox{ + margin-top: 60rpx; + overflow: hidden; +} +.shopImg{ + margin-left: 20rpx; + margin-bottom: 20rpx; + width: 110rpx; + height: 110rpx; + background-color: #fd782d; + float: left; +} +.shopDetailsBox{ + float: left; + margin-left: 20rpx; +} +.shopName{ + margin-top: 10rpx; + font-size: 32rpx; + +} +.floor{ + margin-top: 10rpx; + font-size: 24rpx !important; + color: #b8b8b8 !important; +} +.phoneImg{ + margin-top: 20rpx; + float:right; + margin-right: 50rpx; + width: 70rpx; + height: 70rpx; + border-radius: 50%; + background-color: #fd782d; +} +.payBtn{ + position: fixed; + width: 90%; + height: 80rpx; + left: 5%; + line-height: 80rpx; + text-align: center; + color: #fff; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); + font-size: 32rpx; + border-radius: 50rpx; + bottom: 5%; +} +.hie{ + height: 20rpx; +} + + diff --git a/pages/edit/edit.js b/pages/edit/edit.js new file mode 100644 index 0000000..914b02f --- /dev/null +++ b/pages/edit/edit.js @@ -0,0 +1,288 @@ +const navigationBarHeight = (getApp().statusBarHeight + 60) + 'px' +const util = require("../../utils/util.js"); +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +const imgurl = require("../../utils/imgurl"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + childArr:[], + navigationBarHeight, + chevronUrl: imgurl.chevron.url, + date: '1988-03-12', + dateEnd:'', + flag: 1, + flagsex: 0, + height:"", + weight:"", + items: [ + { name: 1, value: '男', checked: false }, + { name: 2, value: '女', checked: false }, + ], + username: "", + array: ['上班族', '学生', '企业高管', '个体户', '自由职业', '其他'], + array1: ['附近住户', '距离2km', '距离3km', '更远'], + index: 0, + index1: 0, + showPage:false + }, + /** + * 获得生日 + */ + bindDateChange: function (e) { + this.setData({ + date: e.detail.value, + flag: 2 + }) + }, + /** + * 职业 + */ + bindPickerChange: function (e) { + this.setData({ + index: e.detail.value + }) + }, + /** + * 生活半径 + */ + bindPickerChange1: function (e) { + this.setData({ + index1: e.detail.value + }) + }, + address: function () { + let that = this; + tt.chooseLocation({ + success: function (res) { + that.setData({ + address: res.name + '(' + res.address + ')', + addressStr: JSON.stringify(res) + }) + }, + fail: function (error) { + console.log(error) + }, + complete: function (data) { + } + }) + }, + formSubmit: function (e) { + console.log(e.detail,"formSubmit") + let that = this; + // console.log(that.data.childArr) + /** + * sex + * 0 保密 + * 1 男 + * 2 女 + */ + if (that.data.flagsex == 0) { + var sex = 0; + } else { + var sex = that.data.sex; + } + if (that.data.addressStr) { + var address = that.data.addressStr; + } + else { + var address = null; + } + if (e.detail.value.username) { + var username = e.detail.value.username; + } + else if (that.data.username) { + var username = that.data.username; + } + else { + var username = null; + } + if (that.data.flag == 2 && that.data.date) { + var birthdate = new Date(that.data.date).getTime(); + } else { + var birthdate = null; + } + if (username == null || address == null || sex == 0 || birthdate == null) { + tt.showToast({ + title: '请输入完整的用户信息', + icon:"none" + }) + } else { + let tmeparr = [] + tmeparr = JSON.parse(JSON.stringify(that.data.childArr)) + console.log(that.data.childArr) + tmeparr.map(item=>{ + item.birthdate = new Date(item.birthdate).getTime() + }) + console.log(that.data.childArr) + Http.post({ + url: config.api.updateInfo, + data: { + sex: sex, + address: address, + name: username, + birthdate: birthdate, + childrenList: tmeparr, + height: e.detail.value.height ? e.detail.value.height : that.data.height, + weight: e.detail.value.weight ? e.detail.value.weight : that.data.weight, + } + }) + .then(res => { + tt.showToast({ + title: "信息提交成功,将在3分钟内生效", + icon: 'none', + duration: 2000, + mask: false + }) + }) + .catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }) + }) + } + }, + radioChange: function (e) { + this.setData({ + sex: e.detail.value, + flagsex: 1 + }) + }, + childSex(e){ + let index = e.currentTarget.dataset.index + let tmpeObj = this.data.childArr + tmpeObj[index].sex = e.detail.value + this.setData({ + childArr: tmpeObj + }) + console.log(tmpeObj) + }, + chidBirthday(e){ + let index = e.currentTarget.dataset.index + let tmpeObj = this.data.childArr + tmpeObj[index].birthdate = e.detail.value + this.setData({ + childArr: tmpeObj + }) + }, + chidName(e){ + let index = e.currentTarget.dataset.index + let tmpeObj = this.data.childArr + tmpeObj[index].name = e.detail.value + this.setData({ + childArr: tmpeObj + }) + }, + childDel(e){ + let index = e.currentTarget.dataset.index + let tmpeObj = this.data.childArr + tmpeObj.splice(index,1) + this.setData({ + childArr: tmpeObj + }) + }, + childAdd(){ + let tmpeObj = this.data.childArr + tmpeObj.unshift({ sex:1}) + this.setData({ + childArr: tmpeObj + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let tmpeDateEnd = util.formatTime(new Date(), "yyyy-MM-dd") + let that = this; + that.setData({ + dateEnd: tmpeDateEnd + }) + Http.get({ + url: config.api.getScore, + data: {}, + }) + .then(res => {res.data + console.log(res); + if(res.code == 200){ + if (res.data.weight){ + this.setData({ + weight: res.data.weight + }) + } + if (res.data.height) { + this.setData({ + height: res.data.height + }) + } + + if (res.data.childrenList){ + let tmpeArr = res.data.childrenList + tmpeArr.map(item => { + item.birthdate = util.fmtDate(parseInt(item.birthdate)) + that.setData({ + childArr: tmpeArr + }) + }) + } + that.setData({ + showPage:true, + }) + } + var reg = RegExp(/address/); + if (res&&res.data&&res.data.address&&res.data.address.match(reg)) { + that.setData({ + address: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name, + addressStr: JSON.parse(res.data.address).address + JSON.parse(res.data.address).name + }) + }else{ + that.setData({ + address: res.data.address, + addressStr: res.data.address + }) + } + if (res.data.name) { + that.setData({ + username: res.data.name + }) + } + if (res.data.sex) { + if (res.data.sex == 1) { + var checked = 'items[' + 0 + '].checked' + that.setData({ + [checked]: true, + flagsex: 1 + }) + } else if (res.data.sex == 2) { + var checked = 'items[' + 1 + '].checked' + that.setData({ + [checked]: true, + flagsex: 1 + }) + } + that.setData({ + sex: res.data.sex + }) + } + if (res.data.birthdate) { + that.setData({ + date: util.fmtDate(parseInt(res.data.birthdate)), + flag: 2 + }) + } + }) + .catch(error=>{ + tt.showToast({ + title: error.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } +}) \ No newline at end of file diff --git a/pages/edit/edit.json b/pages/edit/edit.json new file mode 100644 index 0000000..88eeb8e --- /dev/null +++ b/pages/edit/edit.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/edit/edit.ttml b/pages/edit/edit.ttml new file mode 100644 index 0000000..d5a2c94 --- /dev/null +++ b/pages/edit/edit.ttml @@ -0,0 +1,80 @@ + + +
+ + 姓名 + + + + + 生日 + + + {{date}} + + + + + 身高 + + + + + 体重 + + + + + 性别 + + + {{item.value}} + + + + + + + 住址 + {{address}} + 请选择地址 + + + + 添加子女信息 + + + + + 姓名 + + + + + + 生日 + + + {{item.birthdate}} + + + + + + 性别 + + + + + + + + + + + + 删除 + + + + +
\ No newline at end of file diff --git a/pages/edit/edit.ttss b/pages/edit/edit.ttss new file mode 100644 index 0000000..ea25518 --- /dev/null +++ b/pages/edit/edit.ttss @@ -0,0 +1,159 @@ +.rArrow { + position: absolute; + right: 26rpx; + height: 20rpx; + width: 20rpx; + margin: auto; + bottom: 30rpx; + } + + input { + /* width:500rpx; */ + /* display: inline-block; */ + font-size: 32rpx; + vertical-align: middle; + margin: auto 10rpx; + } + + .radio-group { + display: inline-block; + } + + .section { + display: flex; + justify-content: flex-start; + height: 100rpx; + line-height: 100rpx; + width: 710rpx; + margin: 0 auto; + border-bottom: 1px solid #eee; + } + + .address { + width: 710rpx; + margin: 0 auto; + border-bottom: 1px solid #eee; + padding-bottom: 10rpx; + } + + .radio { + margin-right: 30rpx; + } + .input{ + margin-top: 20rpx; + } + .section__title, .picker, picker { + display: inline-block; + font-size: 32rpx; + color: #999; + width: 500rpx; + } + + radio { + transform: scale(0.8); + } + + .section__title { + color: #999; + } + + text{ + width: 100rpx; + /* text-align: center; */ + padding: 0 20rpx; + font-size: 32rpx; + } + + /* .section > text:nth-of-type(1) { + font-size: 32rpx; + display: inline-block; + padding: 0 20rpx; + } */ + + /* .address > text:nth-of-type(1) { + font-size: 32rpx; + display: inline-block; + margin-right: 20rpx; + padding: 0 20rpx; + } */ + + .btn { + width: 456rpx; + color: #fff; + margin-top: 200rpx; + height: 92rpx; + line-height: 92rpx; + text-align: center; + border-radius: 32rpx; + font-size: 32rpx; + } + + .active { + opacity: 0.6; + } + + .sec { + position: relative; + } + + .names { + font-size: 26rpx; + line-height: 46rpx; + color: #999; + margin-left: 20rpx; + } + + .child_add { + width: 300rpx; + line-height: 100rpx; + height: 100rpx; + border-radius: 10rpx; + text-align: center; + margin: 20rpx; + background-color: #fff; + } + + .child_box { + margin: 20rpx; + overflow: hidden; + } + + .contBox { + float: left; + width: 80%; + background-color: #fff; + } + + .contBox_section { + display: flex; + justify-content: flex-start; + height: 100rpx; + line-height: 100rpx; + /* width: 710rpx; */ + margin: 0 auto; + border-bottom: 1px solid #eee; + } + + /* .contBox_section text { + margin: 0 20rpx; + } */ + + .contBox_picker { + display: inline-block; + font-size: 32rpx; + color: #999; + /* width: 400rpx; */ + } + + .det_child_box { + float: left; + width: 16%; + height: 100rpx; + border-radius: 10rpx; + line-height: 100rpx; + background-color: #fff; + text-align: center; + margin-top: 100rpx; + margin-left: 2%; + } + \ No newline at end of file diff --git a/pages/editUser/editUser.js b/pages/editUser/editUser.js new file mode 100644 index 0000000..f8a4030 --- /dev/null +++ b/pages/editUser/editUser.js @@ -0,0 +1,35 @@ +const app = getApp() +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const util = require("../../utils/util.js"); +Page({ + data: { + navigationBarHeight, + dateVale: '1988-03-12', + dateEnd:'', + flag:1, + items: [ + { name: 1, value: '男', checked: false }, + { name: 2, value: '女', checked: false }, + ], + }, + bindDateChange(e) { + this.setData({ + dateVale: e.detail.value, + flag:2 + }) + }, + radioChange: function (e) { + this.setData({ + sex: e.detail.value, + flagsex: 1 + }) + }, + onLoad: function (options) { + let tmpeDateEnd = util.formatTime(new Date(), "yyyy-MM-dd") + let that = this; + that.setData({ + dateEnd: tmpeDateEnd, + + }) + } +}) \ No newline at end of file diff --git a/pages/editUser/editUser.json b/pages/editUser/editUser.json new file mode 100644 index 0000000..f26dd03 --- /dev/null +++ b/pages/editUser/editUser.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "编辑信息", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/editUser/editUser.ttml b/pages/editUser/editUser.ttml new file mode 100644 index 0000000..128cacc --- /dev/null +++ b/pages/editUser/editUser.ttml @@ -0,0 +1,47 @@ + + + + + 姓名 + + + + 生日 + + + {{dateVale}} + + + + 身高 + + + + 体重 + + + + 性别 + + + {{item.value}} + + + + + \ No newline at end of file diff --git a/pages/editUser/editUser.ttss b/pages/editUser/editUser.ttss new file mode 100644 index 0000000..4a46b21 --- /dev/null +++ b/pages/editUser/editUser.ttss @@ -0,0 +1,61 @@ +.section{ + height: 100rpx; + line-height: 100rpx; + width: 710rpx; + border-bottom: 1px solid #eee; + overflow: hidden; +} +.uesrName{ + font-size: 32rpx; + margin: 0 20rpx; + float: left; +} +.nameInput{ + font-size: 32rpx; + /* margin: 0 20rpx; */ + float: left; + margin-top: 24rpx; +} +.picker { + display: inline-block; + font-size: 32rpx; + color: #999; + width: 500rpx; + height: 80rpx; + margin-top: 10rpx; + line-height: 80rpx; +} +.pickerInput{ + font-size: 32rpx; + /* margin: 0 20rpx; */ + float: left; + margin-top: 16rpx; +} +.pickerView{ + font-size: 32rpx; + /* margin: 0 20rpx; */ + float: left; + height: 60rpx; +} +.radio { + margin-right: 30rpx; + } +.radio { + transform: scale(0.8); + } + .radio-group { + display: inline-block; + } + + .btn { + width: 456rpx; + color: #fff; + margin-top: 200rpx; + height: 92rpx; + line-height: 92rpx; + text-align: center; + /* border-radius: 32rpx; */ + font-size: 32rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + /* border: none; */ + } \ No newline at end of file diff --git a/pages/getPhone/getPhone.js b/pages/getPhone/getPhone.js new file mode 100644 index 0000000..dd5c05e --- /dev/null +++ b/pages/getPhone/getPhone.js @@ -0,0 +1,77 @@ +const app = getApp() +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +Page({ + data: { + navigationBarHeight, + mallImgUrl:"", + + }, + backHome(){ + tt.reLaunch({ + url: "/index/index", + success: (res) => { + app.globalData.selected = 0; + }, + fail: (res) => { + + }, + }); + }, + back: function() { + + tt.navigateBack({ + delta: 1, + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }, + bindPhone(e){ + console.log(e); + Http.post({ + url:config.api.getUserPhone, + data: { + encryptedData: e.detail.encryptedData, + iv: e.detail.iv + } + }).then(res=>{ + this.back() + }).catch(err=>{ + tt.showToast({ + title: err.message?err.message:err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + onLoad: function (options) { + + Http.get({ + url: config.api.marketicon, + data: { + appId: 'ttef6599d8705b49b101' + } + }).then(res => { + this.setData({ + mallImgUrl: res.data.mallImgUrl + }); + tt.setNavigationBarTitle({ + title: res.data.mallName + }) + }) + .catch(err => { + tt.showToast({ + title: err.message?err.message:err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } +}) \ No newline at end of file diff --git a/pages/getPhone/getPhone.json b/pages/getPhone/getPhone.json new file mode 100644 index 0000000..f42c7a6 --- /dev/null +++ b/pages/getPhone/getPhone.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/getPhone/getPhone.ttml b/pages/getPhone/getPhone.ttml new file mode 100644 index 0000000..3db7842 --- /dev/null +++ b/pages/getPhone/getPhone.ttml @@ -0,0 +1,15 @@ + + \ No newline at end of file diff --git a/pages/getPhone/getPhone.ttss b/pages/getPhone/getPhone.ttss new file mode 100644 index 0000000..43724b5 --- /dev/null +++ b/pages/getPhone/getPhone.ttss @@ -0,0 +1,70 @@ +page{ + background: #fbfbfb; + } + .login-body { + padding-top: 106rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } + .backHome{ + margin-top: 20rpx!important; + } + .login-logo { + width: 320rpx; + /* height: 320rpx; */ + padding-top: 70rpx; + } + + .login-logo>image { + display: block; + width: 320rpx; + border-radius: 16rpx; + } + + .login-btn { + padding-top: 120rpx; + width: 504rpx; + } + + .txt { + display: block; + width: 300rpx; + height: 108rpx; + margin-top: 5.8%; + font-size: 30rpx; + color: #999; + line-height: 54rpx; + text-align: center; + } + .active{ + opacity: .6; + } + .login-btn .login-btn-login { + background: #1faf0c; + border-radius: 15rpx !important; + height: 94rpx !important; + line-height: 94rpx; + padding: 0 !important; + font-family: PingFangSC-Semibold !important; + font-size: 36rpx !important; + color: #FFFFFF !important; + letter-spacing: 0.75rpx !important; + text-align: center; + } + .title{ + margin-top: 30rpx; + } + .title text{ + display: block; + text-align: center; + } + .title text:nth-of-type(1){ + font-size: 38rpx; + font-weight: bold; + } + .title text:nth-of-type(2){ + font-size: 30rpx; + margin-top: 25rpx; + } \ No newline at end of file diff --git a/pages/getuserinfo/getuserinfo.js b/pages/getuserinfo/getuserinfo.js new file mode 100644 index 0000000..4de2492 --- /dev/null +++ b/pages/getuserinfo/getuserinfo.js @@ -0,0 +1,75 @@ +const app = getApp() +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +Page({ + data: { + navigationBarHeight, + mallImgUrl:"", + + }, + backHome: function() { + + tt.navigateBack({ + delta: 1, + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }, + bindGetUserInfo(e){ + let that = this; + tt.getUserInfo({ + withCredentials:true, + success:function(res){ + console.log(res,"res"); + Http.post({ + url:config.api.getUserInfo, + data: { + encryptedData: res.encryptedData, + iv: res.iv + } + }).then(res=>{ + that.backHome() + }).catch(err=>{ + tt.showToast({ + title: err.message?err.message:err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + fail(err) { + console.log(err,` 调用失败`); + }, + }) + }, + onLoad: function (options) { + + Http.get({ + url: config.api.marketicon, + data: { + appId: 'ttef6599d8705b49b101' + } + }).then(res => { + this.setData({ + mallImgUrl: res.data.mallImgUrl + }); + tt.setNavigationBarTitle({ + title: res.data.mallName + }) + }) + .catch(err => { + tt.showToast({ + title: err.message?err.message:err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } +}) \ No newline at end of file diff --git a/pages/getuserinfo/getuserinfo.json b/pages/getuserinfo/getuserinfo.json new file mode 100644 index 0000000..f42c7a6 --- /dev/null +++ b/pages/getuserinfo/getuserinfo.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/getuserinfo/getuserinfo.ttml b/pages/getuserinfo/getuserinfo.ttml new file mode 100644 index 0000000..1dffef8 --- /dev/null +++ b/pages/getuserinfo/getuserinfo.ttml @@ -0,0 +1,15 @@ + + \ No newline at end of file diff --git a/pages/getuserinfo/getuserinfo.ttss b/pages/getuserinfo/getuserinfo.ttss new file mode 100644 index 0000000..43724b5 --- /dev/null +++ b/pages/getuserinfo/getuserinfo.ttss @@ -0,0 +1,70 @@ +page{ + background: #fbfbfb; + } + .login-body { + padding-top: 106rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } + .backHome{ + margin-top: 20rpx!important; + } + .login-logo { + width: 320rpx; + /* height: 320rpx; */ + padding-top: 70rpx; + } + + .login-logo>image { + display: block; + width: 320rpx; + border-radius: 16rpx; + } + + .login-btn { + padding-top: 120rpx; + width: 504rpx; + } + + .txt { + display: block; + width: 300rpx; + height: 108rpx; + margin-top: 5.8%; + font-size: 30rpx; + color: #999; + line-height: 54rpx; + text-align: center; + } + .active{ + opacity: .6; + } + .login-btn .login-btn-login { + background: #1faf0c; + border-radius: 15rpx !important; + height: 94rpx !important; + line-height: 94rpx; + padding: 0 !important; + font-family: PingFangSC-Semibold !important; + font-size: 36rpx !important; + color: #FFFFFF !important; + letter-spacing: 0.75rpx !important; + text-align: center; + } + .title{ + margin-top: 30rpx; + } + .title text{ + display: block; + text-align: center; + } + .title text:nth-of-type(1){ + font-size: 38rpx; + font-weight: bold; + } + .title text:nth-of-type(2){ + font-size: 30rpx; + margin-top: 25rpx; + } \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js new file mode 100644 index 0000000..aed44cb --- /dev/null +++ b/pages/index/index.js @@ -0,0 +1,587 @@ + +const Http = require("../../utils/HttpBasics"); +const imgurl = require("../../utils/imgurl"); +const config = require("../../config/config"); +let app = getApp(); +Page({ + /** + * 页面的初始数据 + */ + data: { + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + console.log("我是中转页面") + let that = this; + console.log(options); + tt.showToast({ + title: '加载中...', + icon: "loading", + duration: 2000 + }) + + /** + * 根据接收到的参数的值,判断跳转到哪个页面 + */ + if (options && options.type) { + app.globalData.type = options.type; + } + if (decodeURIComponent(options.scene) == "undefined") { + that.setData({ + scene: 0 + }) + app.globalData.scene = 0; + } else { + that.setData({ + scene: decodeURIComponent(options.scene) + }); + app.globalData.scene = decodeURIComponent(options.scene) + that.setData({ + newArr: this.data.scene.split(':') + }) + //// 大屏-二维码-start + if (this.data.newArr[0] == 'JC') { + // 跳转券详情 + options.couponChannelId = this.data.newArr[1]; + } else if (this.data.newArr[0] == 'JG') { + // 跳转拼团详情 + options.couponChannelId = this.data.newArr[1]; + options.path = 'daping' + } else if (this.data.newArr[0] == 't') { + // 普通二维码 + options.type = this.data.newArr[1]; + app.globalData.type = options.type; + if (options.type == 'cd') { + options.couponChannelId = this.data.newArr[2]; + } else if (options.type == 'bd') { + options.bt = this.data.newArr[2]; + options.id = this.data.newArr[3]; + } else if (options.type == 'gm') { + options.id = this.data.newArr[2]; + } else if (options.type == 'sd') { + options.couponChannelId = this.data.newArr[2]; + } else if (options.type == 'td') { + // 专题活动页 + options.id = this.data.newArr[2]; + } else if (options.type == 'md') { + // 门店详情 + options.id = this.data.newArr[2]; + } else if (options.type == 'ra') { + //活动详情 + options.id = this.data.newArr[2]; + } else if (options.type == 'si') { + //活动签到 + options.id = this.data.newArr[2]; + } else if (options.type == 'wj') { + options.id = this.data.newArr[2]; + } else if (options.type == 'ts') { + options.id = this.data.newArr[2]; + } + } + } + + tt.setStorageSync('options', JSON.stringify(options)) + tt.setStorageSync('imgurl', imgurl); + + if (app.globalData.token) { + + + this.updateUserInfo(); + if (options.couponChannelId || options.orderId || options.id) { + that.userStatus(options); + } else { + that.userStatus(); + } + } else { + // 由于 token 是网络请求,可能会在 Page.onLoad 之后才返回 + // 所以此处加入 callback 以防止这种情况 + app.tokenCallback = token => { + this.updateUserInfo(); + if (options.couponChannelId || options.orderId || options.id) { + that.userStatus(options); + } else { + that.userStatus(); + } + } + } + }, + + /** + * 检查用户的状态 + */ + userStatus: function(options) { + + var that = this; + if (options && (options.couponChannelId || options.orderId || options.id)) { + that.checkuserstatus(options); + } else { + that.checkuserstatus(); + } + }, + /** + * 获取手机信息 + */ + updateUserInfo() { + tt.getSystemInfo({ + success: function (res) { + Http.post({ + url: config.api.updateUserInfo, + data: { + systemInfo: JSON.stringify(res) + } + }).then(res => { + console.log(res) + }) + } + }) + }, + checkuserstatus(options) { + let that = this; + + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }) + .then(res => { + // res = JSON.parse('{"code":11004,"message":"用户昵称未授权,请跳转到用户昵称授权页!","data":{}}') + //参与拼团 + if (options && options.orderGroupId) { + tt.redirectTo({ + url: `/pages/joinFrDpell/index?couponId=${options.couponId}&orderGroupId=${options.orderGroupId}&couponChannelId=${options.couponChannelId}&orderId=${options.orderId}&avatarUrl=${options.avatarUrl}&nickName=${options.nickName}` + }) + } + //来自大屏的跳转拼团券详情 + else if (options && options.couponChannelId && options.path == 'daping') { + /** + * 主要是为了拿couponId + */ + Http.get({ + url: config.api.couponDetail, + data: { + couponChannelId: options.couponChannelId + } + }).then(res => { + let data = res.data; + tt.redirectTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${options.couponChannelId}&couponId=${data.couponId}` + }) + }) + } else if (options && options.couponChannelId && !options.spellGroup && app.globalData.type != 'sd') { + console.log(3333333333333333) + // 转赠判断 + if (options.cuserId) { + tt.redirectTo({ + url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}&cuserId=${options.cuserId}&coverImg=${options.coverImg}&userName=${options.userName}&avatarUrl=${options.avatarUrl}&couponOrderId=${options.couponOrderId}&updateDate=${options.updateDate}`, + }) + } else { + // 跳转普通券/消费卡/限时秒杀/砍价详情 + tt.redirectTo({ + url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}`, + }) + } + } + // 拼团详情页(只有通过扫码进入才可能进入拼团详情页面,只有这一个入口) + else if ((options && options.couponChannelId && app.globalData.type == 'sd') || (options && options.couponChannelId && options.spellGroup)) { + tt.redirectTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${options.couponChannelId}`, + }) + } + // 游戏页面 + else if (options && options.id && app.globalData.type == 'gm') { + that.getGameOne(app.globalData.token, options.id) + } + // 报名活动页面 + else if (options && options.id && app.globalData.type == 'ra') { + tt.redirectTo({ + url: `/pages/radetail/index?id=${options.id}`, + }) + } + //活动签到 + else if (options && options.id && app.globalData.type == 'si') { + tt.redirectTo({ + url: `/pages/acSignIn/index?id=${options.id}`, + }) + } + //答题问卷 + else if (options && options.id && app.globalData.type == 'wj') { + tt.redirectTo({ + url: `/pages/questionnaire/questionnaire?id=${options.id}`, + }) + } + //投诉建议 + else if (app.globalData.type == 'ts') { + tt.redirectTo({ + url: `/pages/complaint/complaint`, + }) + } + // 宣传页详情 + else if (options && options.bt && options.id && app.globalData.type == 'bd') { + if (options.bt == '2') { + // 自由图文 + tt.redirectTo({ + url: `/pages/freeBannerDetail/index?id=${options.id}`, + }) + } else { + // 标准格式 + tt.redirectTo({ + url: `/pages/bannerdetail/index?id=${options.id}`, + }) + } + } + // 专题 + else if (options && options.id && app.globalData.type == 'td') { + tt.redirectTo({ + url: `/pages/topicDetail/index?id=${options.id}` + }); + } + // 门店详情 + else if (options && options.id && app.globalData.type == 'md') { + tt.redirectTo({ + url: `/pages/index/searchbar/detail/index?id=${options.id}` + }); + } + // 参与砍价 + else if (options && options.orderId) { + tt.redirectTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${options.orderId}&from=${"discount"}&composeOrderType=${options.composeOrderType}`, + }) + } + // 我的 + else if (app.globalData.type == 'uc') { + tt.navigateTo({ + url: '/index/user' + }); + } + // 积分 + else if (app.globalData.type == 'jf') { + tt.redirectTo({ + url: '/pages/integralmall/index' + }); + } + // 首页 + else if (app.globalData.type == 'in') { + tt.reLaunch({ + url: '/index/index' + }); + } + // 停车 + else if (app.globalData.type == 'pc') { + // 停车 + tt.navigateTo({ + url: '/index/passCar' + }); + } + // 我的券包 + else if (app.globalData.type == 'mc') { + // 我的券包 + tt.redirectTo({ + url: '/pages/couponorder/index/index' + }); + } + // 我的订单 + else if (app.globalData.type == 'mo') { + // 我的订单 + tt.redirectTo({ + url: '/pages/order/index/index?id=all' + }); + } + // 我的卡包 + else if (app.globalData.type == 'ca') { + // 我的卡包 + tt.redirectTo({ + url: '/pages/cardorder/index/index' + }); + } + // 特享礼遇 + else if (app.globalData.type == 'sc') { + // 特享礼遇 + tt.redirectTo({ + url: '/pages/specialcourtesy/specialcourtesy' + }); + } + // 限时秒杀 + else if (app.globalData.type == 'rb') { + // 限时秒杀 + tt.redirectTo({ + url: '/pages/rushToBuy/index' + }) + } + // 砍价专场 + else if (app.globalData.type == 'bl') { + // 砍价专场 + tt.redirectTo({ + url: '/pages/bargain/bargain' + }) + } + // 我的砍价 + else if (app.globalData.type == 'mb') { + // 我的砍价 + tt.redirectTo({ + url: '/pages/bargain/bargain?from=myhtml' + }) + } + // 拼团专场 + else if (app.globalData.type == 'sl') { + // 拼团专场 + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup' + }) + } + // 我的拼团 + else if (app.globalData.type == 'ms') { + // 我的拼团 + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup?from=myhtml' + }) + } + // 消费卡 + else if (app.globalData.type == 'dc') { + // 消费卡 + tt.redirectTo({ + url: '/pages/discountCardList/discountCardList' + }) + } + //直播 + else if (app.globalData.type == 'zb') { + tt.redirectTo({ + url: `/pages2/live/livelist/index` + }); + } + //活动日历 + else if (app.globalData.type == 'arl') { + tt.redirectTo({ + url: `/pages/dateLsit/dateLsit` + }); + } + //每日签到 + else if (app.globalData.type == 'qd') { + tt.redirectTo({ + url: `/pages/activityCalendar/activityCalendar` + }); + } + // 门店 + else if (app.globalData.type == 'ml') { + tt.navigateTo({ + url: '/index/searchbar' + }) + } + // 兑换 + else if (app.globalData.type == 'ec') { + tt.redirectTo({ + url: '/pages/exchange/exchange' + }) + } + // 通过分享进入的门店详情 + else if (options && options.id && options.frommd == 'md' && app.globalData.type == 'md') { + tt.redirectTo({ + url: `/pages/index/searchbar/detail/index?id=${options.id}` + }); + } else { + // 主页 + tt.reLaunch({ + url: '/index/index' + }) + } + }) + .catch(err => { + tt.showToast({ + title: err, + icon: "loading", + duration: 2000 + }) + if (err.code == 11004) { + // 用户昵称未授权 + if (options && options.orderGroupId) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponId=${options.couponId}&orderGroupId=${options.orderGroupId}&couponChannelId=${options.couponChannelId}&orderId=${options.orderId}&avatarUrl=${options.avatarUrl}&nickName=${options.nickName}` + }) + } + /** + * spellGroup + * 区分是通过拼团详情分享过来的还是从普通券分享过来的 + * 注意:拼团券和普通券是两个页面 + */ + if (options && options.couponChannelId && !options.cuserId && !options.spellGroup) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}` + }) + } else if (options && options.couponChannelId && !options.cuserId && options.spellGroup) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}&spellGroup=${options.spellGroup}` + }) + } else if (options && options.couponChannelId && options.cuserId) { + /** + * 转赠判断 + */ + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}&cuserId=${options.cuserId}&coverImg=${options.coverImg}&userName=${options.userName}&avatarUrl=${options.avatarUrl}&couponOrderId=${options.couponOrderId}&updateDate=${options.updateDate}` + }) + } else if (options && options.orderId) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?orderId=${options.orderId}&from='${"discount"}` + }) + } + // 报名活动页面 + else if (options && options.id && app.globalData.type == 'ra') { + tt.redirectTo({ + url: `/pages/radetail/index?id=${options.id}`, + }) + } + // 通过分享进入的门店详情 + else if (options && options.id && options.frommd == 'md' && app.globalData.type == 'md') { + tt.redirectTo({ + url: `/pages/getuserinfo/index?id=${options.id}&frommd=md` + }); + }// 门店详情 + else if (options && options.id && app.globalData.type == 'md') { + tt.redirectTo({ + url: `/pages/index/searchbar/detail/index?id=${options.id}` + }); + } else if (app.globalData.type == 'uc') { + tt.navigateTo({ + url: '/index/user' + }); + } + // 积分 + else if (app.globalData.type == 'jf') { + tt.redirectTo({ + url: '/pages/integralmall/index' + }); + } + // 首页 + else if (app.globalData.type == 'in') { + tt.reLaunch({ + url: '/index/index' + }); + } + // 停车 + else if (app.globalData.type == 'pc') { + // 停车 + tt.navigateTo({ + url: '/index/passCar' + }); + } + // 我的券包 + else if (app.globalData.type == 'mc') { + // 我的券包 + tt.redirectTo({ + url: '/pages/couponorder/index/index' + }); + } + // 我的订单 + else if (app.globalData.type == 'mo') { + // 我的订单 + tt.redirectTo({ + url: '/pages/order/index/index?id=all' + }); + } + // 我的卡包 + else if (app.globalData.type == 'ca') { + // 我的卡包 + tt.redirectTo({ + url: '/pages/cardorder/index/index' + }); + } + // 特享礼遇 + else if (app.globalData.type == 'sc') { + // 特享礼遇 + tt.redirectTo({ + url: '/pages/specialcourtesy/specialcourtesy' + }); + } + // 限时秒杀 + else if (app.globalData.type == 'rb') { + // 限时秒杀 + tt.redirectTo({ + url: '/pages/rushToBuy/index' + }) + } + // 砍价专场 + else if (app.globalData.type == 'bl') { + // 砍价专场 + tt.redirectTo({ + url: '/pages/bargain/bargain' + }) + } + // 我的砍价 + else if (app.globalData.type == 'mb') { + // 我的砍价 + tt.redirectTo({ + url: '/pages/bargain/bargain?from=myhtml' + }) + } + // 拼团专场 + else if (app.globalData.type == 'sl') { + // 拼团专场 + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup' + }) + } + // 我的拼团 + else if (app.globalData.type == 'ms') { + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup?from=myhtml' + }) + } + // 消费卡 + else if (app.globalData.type == 'dc') { + // 消费卡 + tt.redirectTo({ + url: '/pages/discountCardList/discountCardList' + }) + } + // 兑换 + else if (app.globalData.type == 'ec') { + tt.redirectTo({ + url: '/pages/exchange/exchange' + }) + } + // 门店 + else if (app.globalData.type == 'ml') { + tt.navigateTo({ + url: '/index/searchbar' + }) + } else { + tt.reLaunch({ + url: '/index/index', + }) + } + } + }) + }, + + getGameOne: function(token, id) { + let _this = this; + Http.get({ + url: config.api.getOneGame, + data: { + token: token, + id: id + } + }).then(res => { + tt.redirectTo({ + url: '/pages/game/index?url=' + res.data.url + "&id=" + res.data.id + "&gameId=" + res.data.gameId, + }) + }) + .catch(err => { + tt.showModal({ + title: '提示', + content: err.message, + showCancel: false, + success: function(res) { + // 如果游戏下架或者找不到,重启首页 + if (res.confirm) { + tt.reLaunch({ + url: '/pages/index/index', + }) + } + } + }) + this.alphaClick(); + }) + }, +}) \ No newline at end of file diff --git a/pages/index/index.json b/pages/index/index.json new file mode 100644 index 0000000..64c01a5 --- /dev/null +++ b/pages/index/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "首页", + "navigationBarBackgroundColor": "#fff" +} \ No newline at end of file diff --git a/pages/index/index.ttml b/pages/index/index.ttml new file mode 100644 index 0000000..e69de29 diff --git a/pages/index/index.ttss b/pages/index/index.ttss new file mode 100644 index 0000000..e69de29 diff --git a/pages/index/searchbar/detail/index.js b/pages/index/searchbar/detail/index.js new file mode 100644 index 0000000..dd5987f --- /dev/null +++ b/pages/index/searchbar/detail/index.js @@ -0,0 +1,247 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +const Http = require("../../../../utils/HttpBasics"); +const imgurl = require("../../../../utils/imgurl"); +const config = require("../../../../config/config"); +const util = require("../../../../utils/util"); +let app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + noMerchant: imgurl.noMerchant.url, + noCoupon: imgurl.noCoupon.url, + poterbg: imgurl.poterbg.url, + teljpgUrl: imgurl.teljpg.url, + fenxiang: imgurl.fenxiang1.url, + actUrl: imgurl.act.url, + wmhome: imgurl.wmhome.url, + page: 1, + imglist: null, + shopVoList: [], + couponList: [], //活动劵列表 + qrCodeL: '', //小程序码 + currentTab: 0, + isshare: false, + showpost: false, + imgHeight: 0, + id: null, + windowWidth: tt.getSystemInfoSync().windowWidth, + windowHeight: tt.getSystemInfoSync().screenHeight, + totalHeight: 0, + canvasScale: 1.0, // 画布放大的倍数,因为如果保存的是一倍的分享图片的话,分享图会有点虚。所以保存的时候,canvasScale设置为2.0,wxss 里面的left: 500%;打开注释。就可保存两倍的分享图 + }, + //关闭海报 + closePoste: function() { + this.setData({ + showpost: false + }) + }, + goback: function () { + tt.reLaunch({ + url: '/index/index', + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + let that = this; + if (options && options.id) { + this.setData({ + id: options.id + }); + that.getList(options.id); + that.getCouponList(options.id); + this.setData({ + currentTab: 0 + }) + } + }, + /** + * 拨打电话 + */ + phone: function(e) { + let that = this; + tt.makePhoneCall({ + phoneNumber: e.target.dataset.merchantlinkphone + }); + }, + /** + * 显示分享弹框 + */ + showshare: function() { + this.setData({ + isshare: true, + }) + }, + /** + * 隐藏分享弹框 + */ + hidemodal: function() { + this.setData({ + isshare: false, + }) + }, + //滑动切换 + swiperTabView: function(e) { + this.setData({ + currentTab: e.detail.current + }); + }, + /** + * 显示分享海报 + */ + /* showPoster: function() { + //跳转到海报生成页 + tt.navigateTo({ + url: `/pages/canvas/index?merchantId=${this.data.id}` + }) + }, */ + showPoster: function() { + //跳转到海报生成页 + let that = this; + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res => { + tt.navigateTo({ + url: `/pages/canvas/index?merchantId=${that.data.id}` + }) + }).catch(err => { + console.log(err) + if (err.code == 11004) { + // 用户昵称未授权 + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${that.data.id}&fromflag=poster` + }) + + } + }) + + }, + //点击切换 + clickTab: function(e) { + if (this.data.currentTab === e.target.dataset.current) { + return false; + } else { + this.setData({ + currentTab: e.target.dataset.current + }) + } + }, + /** + * 获取商户详情 + */ + getList: function(id) { + let that = this; + let data; + data = { + pageNum: that.data.page, + pageSize: 15, + id: id + } + Http.get({ + url: config.api.merchantList, + data: data + }).then(res => { + if (res.data.list.length==0){ + tt.showModal({ + title: '提示', + content: '此商户已经停用', + confirmText: "返回", + showCancel:false, + success: function (res) { + if (res.confirm) { + tt.navigateBack({ + url: '/index/searchbar', + }) + } + } + }) + } + let imgList = []; + imgList.push(res.data.list[0].merchantImgUrl) + that.setData({ + data: res.data.list[0], + shopVoList: res.data.list[0].shopVoList, + imglist: res.data.list[0].coverPicture == '[]' ? imgList : JSON.parse(res.data.list[0].coverPicture), + }) + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + /** + * 获取商户活动信息 券类型(1.满减券,2.代金券,3.团购券,4.礼品券,5.停车券,6.多商户券,8.砍价券,9.团购券,50.积分券,51.积分停车券 100.消费卡) + * 投放频道:(1.列表, 2.限时抢购, 3. banner图 4. 游戏 5.卡频道 6.砍价频道 7.拼团频道 8专题) + */ + getCouponList: function(id) { + let that = this; + let data; + data = { + status: 0, + merchantId: id, + pageNum: that.data.page, + pageSize: 15, + } + Http.post({ + url: config.api.listByMerchant, + data: data + }).then(res => { + that.setData({ + couponList: res.data.page.list, + }) + + // if (res.data && res.data.qrCode){ + // that.setData({ + // qrCode: res.data.qrCode, + // }) + // } + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + /** + * 获取多商铺列表 + */ + onShareAppMessage: function(res) { + app.globalData.previewFlag = true + let that = this; + let shareObj = { + title: that.data.data.merchantName, + path: `/pages/index/index?id=${that.data.id}&frommd=md&type=md`, + success: function(res) { + if (res.errMsg == 'shareAppMessage:ok') {} + }, + fail: function(error) { + if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {} + } + }; + console.log(`/pages/index/index?id=${that.data.id}&frommd=md`); + // 来自页面内的按钮的转发 + if (res.from === 'button') { + console.log(res) + var eData = res.target.dataset.id; + console.log(eData) + shareObj.path = `/pages/index/index?id=${eData}&frommd=md&type=md`; + } + // 返回shareObj + return shareObj; + } +}) \ No newline at end of file diff --git a/pages/index/searchbar/detail/index.json b/pages/index/searchbar/detail/index.json new file mode 100644 index 0000000..cc0cec1 --- /dev/null +++ b/pages/index/searchbar/detail/index.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "商户详情", + "navigationBarBackgroundColor": "#F4F5F9", + "navigationBarTextStyle": "black", + "usingComponents": { + "c-banner": "../../../../components/banner/index", + "c-coupons": "../../../../components/coupons/index", + "navbar": "../../../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/index/searchbar/detail/index.ttml b/pages/index/searchbar/detail/index.ttml new file mode 100644 index 0000000..5b2e1ac --- /dev/null +++ b/pages/index/searchbar/detail/index.ttml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + {{data.merchantName}} + {{data.title}} + + + + + + + + + 商户位置: + + + + {{item.buildingName}}{{item.floorName}}--{{item.shopNumber}} + + + + + + + + + 客服电话: + + + + {{data.linkLinePhone}} + {{data.merchantLinkPhone}} + + + + + + + + + 商户活动: + + + {{data.actionDesc}} + + + + + + + + 优惠信息 + + + + 商家简介 + + + + + + + + + + + + 请您敬请期待 + 我们正在筹备一大波优惠活动 + + + + {{content}} + + {{loadingtext}} + + + + + {{data.introduction}} + 信息完善中,敬请期待~ + + + + + + + + + + + + + 微信好友 + + + + 生成海报 + + + + + + \ No newline at end of file diff --git a/pages/index/searchbar/detail/index.ttss b/pages/index/searchbar/detail/index.ttss new file mode 100644 index 0000000..3ae4aff --- /dev/null +++ b/pages/index/searchbar/detail/index.ttss @@ -0,0 +1,365 @@ +@import "../../../../app.ttss"; +page{ + background: #F4F5F9; +} +.index-slide, swiper-item + .index-slide-image { + display: block; + width: 750rpx; + margin: 0 auto; + overflow: hidden; + position: relative; + height: 450rpx; + +} + +.index-slide-view .dots { + position: absolute; + left: 0; + right: 0; + bottom: 20rpx; + display: flex; + justify-content: center; +} + +.index-slide-view .dots .dot { + margin: 0 8rpx; + width: 12rpx; + height: 12rpx; + background: #b6b6b7; + border-radius: 50%; + transition: all 0.6s; +} + +.index-slide-view .dots .dot.active { + background: #02c0ff; + width: 30rpx; + height: 12rpx; + border-radius: 10rpx; + opacity: 1; +} + +.merchant-detail { + width: 100%; + background: #fff; + border-top-left-radius: 20rpx; + border-top-right-radius: 20rpx; +} + +.merchant-brand, .merchant-shop, .merchant-phone { + width: 100%; + background: #fff; +} + +.merchant-brand view:nth-child(1) { + width: 88%; + display: flex; + flex-direction: column; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.merchant-brand view:nth-child(1) text:nth-child(1){ + font-size:32rpx; + font-family:PingFangSC-Regular; + font-weight:400; + color:rgba(60,60,60,1); + margin-top: 20rpx; +} +.merchant-shop text, .merchant-phone text { + font-size: 30rpx; +} +.merchant-shop .fl{ + color: #A6A6A6; +} +.merchant-phone view { + color: #A6A6A6; +} +.merchant-activity view{ + color: #333; + margin-top: 20rpx; +} + +.merchant-activity view:nth-child(2) { + font-size: 26rpx; + display:flex; + flex-direction:column; +} +.merchant-shop view:nth-child(2) { + font-size: 30rpx; + color: #A6A6A6; + line-height: 26rpx; +} +.merchant-activity view:nth-child(1) { + font-size:30rpx; +} +.merchant-activity view:nth-child(2) text { + font-size:28rpx; + color:#919191; + letter-spacing:0; + line-height:45rpx; +} + +.merchant-info { + display: block !important; + color: #999; + font-size: 28rpx; +} + +.merchant-phones { + padding: 20rpx 0; + display: block; + font-size: 30rpx; + background: #F4F5F9; +} + +.merchants text { + display: inline-block; + font-size: 26rpx; + color: #A6A6A6; + line-height: 22rpx; + margin-right: 10rpx; +} +.posi{ + color: #FD832D!important; +} +.wz{ + color: #A6A6A6; + font-size: 24rpx; +} +.notes view{ + color: #A6A6A6; +} +.merchant-brand { + border: none !important; + width: 92%; + margin: 0 auto 20rpx; +} +.merchant-brand view:nth-child(2) text:nth-child(1) { + margin-top: 20rpx; + font-size: 32rpx; +} + +.title{ + font-size: 26rpx; + color: #A6A6A6; + width: 530rpx; + height: 40rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} +.merchant-shop,.merchant-phone,.merchant-activity{ + width: 92%; + margin: 0 auto; +} +.shopHr{ + margin-bottom: 20rpx; +} +.tabs-item.selected { + color: rgba(171, 149, 109, 0.8); + border-bottom: 2px solid rgba(171, 149, 109, 0.8); +} + +.tabs-item { + width: 33.3%; + color: #c7c7cb; + font-size: 28rpx; + display: flex; + align-items: center; + justify-content: center; + border-bottom: 1rpx solid #d0d0d7; +} + +.swiper-tab { + text-align: left; + width: 70%; + display: flex; + flex-flow: row; + justify-content: space-around; + height: 88rpx; + line-height: 88rpx; + margin-bottom: 30rpx; + padding: 0 15%; + background: #FFF; +} + +.swiper-tab-item { + color: #434343; + font-size: 30rpx; + margin-right: 50rpx; + position: relative; +} + +.active-tab { + color: #FD782D; + display: block; + width: 72%; + height: 8rpx; + background: 0 0; + position: absolute; + bottom: 0; + left: 15%; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius: 100px; +} +.fenxiang { + position: absolute; + right:0; + top: 27rpx; + display: flex; + flex-direction: column; +} + +.fenxiang image { + width: 48rpx; + height: 48rpx; + margin: 0 auto; +} +.gift{ + color: #3C3C3C; + font-size: 20rpx; + margin: 0 auto; +} +.user-motto { + width: 270rpx; + border: 0; + background: none; + height: 260rpx; + color: #fff; + position: fixed; +} + +.user-motto::after { + border: none; +} + +.coupons c-coupons { + width: 335rpx; + /* height: 354rpx; */ + margin-bottom: 22rpx; +} + +.coupons c-coupons:nth-of-type(2n+1) { + float: left; +} + +.coupons c-coupons:nth-of-type(2n) { + float: right; +} + +.loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; +} + +.dingdan text { + display: block; + text-align: center; + color: #999; +} +.have{ + text-align: left!important; +} + +.swiperactive { + min-height: 400rpx; + padding-bottom: 44rpx; + padding:0 4% 10rpx; + +} +.swiperactive image{ + display: block; + width: 300rpx; + margin: 30rpx auto 0; +} +.modal { + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: rgba(0, 0, 0, 0.5); + overflow: hidden; + z-index: 10000; + color: #fff; +} + +.modal-content { + width: 540rpx; + height: 233rpx; + line-height: 60rpx; + overflow: hidden; + position: fixed; + top: 50%; + left: 0; + z-index: 11; + background: #f9f9f9; + margin: -130rpx 105rpx; + border-radius: 36rpx; + display: flex; +} + +.modal-content view { + display: inline-block; + flex: 1; + text-align: center; +} + +.modal-content view>text { + color: #000; + display: block; + font-size: 30rpx; + height: 80rpx; + line-height: 80rpx; +} + +.modal-content view>image { + margin-top: 30rpx; + width: 90rpx; + height: 90rpx; +} + +/*分享海报样式*/ +.canvas-content { + display: flex; + top: 0; + left: 0; + /* left: 500%; 分享图不显示在页面上面,就将画布设置在页面之外*/ +} + +.dingdan image { + display: block; + width: 300rpx; + margin: 30rpx auto 0; +} + +button::after{ border: none; } +.goback{ + position: fixed; + right: 20rpx; + bottom: 60rpx; + width:100rpx!important; + height:100rpx; + z-index: 100; + background:rgba(255,255,255,1); + line-height: 95rpx; + border:1rpx solid rgba(227,227,227,1); + border-radius:50%; +} +.goback image{ + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} +.frHr{ + float: left; + margin-left: 12rpx; + margin-top:18rpx; +} \ No newline at end of file diff --git a/pages/integralmall/index.js b/pages/integralmall/index.js new file mode 100644 index 0000000..fbe1794 --- /dev/null +++ b/pages/integralmall/index.js @@ -0,0 +1,359 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +var config = require("../../config/config.js"); +const Http = require("../../utils/HttpBasics"); +const imgurl = require("../../utils/imgurl"); +const QR = require("../../utils/memberqrcode.js"); +Page({ + /** + * 页面的初始数据 + */ + data: { + rightHr: imgurl.rightHr.url, + navigationBarHeight, + erweima: imgurl.erweima.url, + bannerUrl: imgurl.banner.url, + loadingUrl: imgurl.loading.url, + nodata: imgurl.noCoupon.url, + wmhome: imgurl.wmhome.url, + barcode: imgurl.barcode.url, + list: [], + lists: [], + arrays:[], + myLists: [], + page: 1, // 设置加载的第几次,默认是第一次 + pageSize: 10, //返回数据的个数 + searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏 + allow_load: true, // 是否允许继续加载标识 默认 true 允许,false 加载完成 + myorder: false, + actUrl: imgurl.act.url, + loading: true, + content: '数据正在加载中', + reloadIf: false, + creditAmount: '', + score: '0', + sort:'', + hidden:false, + userCredit:'', + sortColumn:'', + sortOrder:'' + }, + qrcodeH: function () { + var that = this; + let memberId = that.data.memberId; + if (memberId) { + tt.navigateTo({ + url: '/pages/specialcourtesy/specialcourtesy' + }) + } + }, + goback: function () { + tt.reLaunch({ + url: '/index/index', + }) + }, + onLoad: function (options) { + console.log("我劲来了"); + let that = this; + var todayDate = new Date().getTime(); + that.getPoints(); + that.setData({ + optionsData: options, + todayDate: todayDate + }) + if (options && options.from == 'myhtml') { + that.getmyList(); + } + else { + that.getList(1); + that.setData({ + lists: null + }) + } + }, + onShow() { + let that = this; + if (this.data.reloadIf) { + tt.setNavigationBarTitle({ + title: '积分商城' + }) + that.getList(1); + that.setData({ + lists: null + }) + }; + Http.get({ + url: config.api.getScore, + data: {} + }).then(res => { + if (res.data.address && res.data.name && res.data.sex && res.data.birthdate) { + that.setData({ + showEdit: true + }) + } + that.setData({ + score: res.data.score, + levelName: res.data.levelName, + upgradePercent: res.data.upgradePercent, + upgradeScore: res.data.upgradeScore, + ismember: true, + memberId: res.data.id + }) + var size = this.setCanvasSize(); + var initUrl = JSON.stringify({ + flagid: res.data.id + }); + that.createQrCode(initUrl, "mycanvas1", size.w, size.h); + }) + .catch(err => { + tt.showModal({ + title: '提示', + content: err.message, + showCancel: false + }) + }) + }, + //适配不同屏幕大小的canvas + setCanvasSize: function () { + var size = {}; + try { + var res = tt.getSystemInfoSync(); + var scale = 750 / 500; + //不同屏幕下canvas的适配比例;设计稿是750宽 + var width = res.windowWidth / scale; + var height = width; + //canvas画布为正方形 + size.w = width; + size.h = height; + } catch (e) { + // Do something when catch error + console.log("获取设备信息失败" + e); + } + return size; + }, + createQrCode: function (url, canvasId, cavW, cavH) { + //调用插件中的draw方法,绘制二维码图片 + QR.api.draw(url, canvasId, cavW, cavH); + }, + qrcode: function (e) { + var that = this; + that.setData({ + showQrcode: true + }) + tt.showToast({ + title: '生成中...', + icon: 'loading', + duration: 2000 + }); + var st = setTimeout(function () { + tt.hideToast() + var size = that.setCanvasSize(); + var url = JSON.stringify({ + END: "C", + TYPE: "memberCode", + ID: that.data.memberId, + }) + that.createQrCode(url, "mycanvas1", size.w, size.h); + that.setData({ + maskHidden: true + }); + clearTimeout(st); + }, 1000) + }, + // 获得积分,渲染页面 + getPoints(){ + let that = this; + Http.get({ + url: config.api.integralList, + data: { + pageNum: 1, + pageSize: 1, + } + }).then(res => { + tt.stopPullDownRefresh(); + that.setData({ + creditAmount: res.data.list[0].creditAmount, + }); + }) + .catch(err => { + tt.stopPullDownRefresh(); + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + gotojifen(){ + tt.navigateTo({ + url: '/pages/integralmall/integraHistory/index', + }) + }, + //我可换购 + canSort(){ + let that = this; + if (that.data.creditAmount !== 0){ + that.setData({ + allow_load:true, + userCredit: that.data.creditAmount, + page:1 + }) + that.getList(1) + } + if (that.data.creditAmount == 0){ + tt.showToast({ + title: '快去补充积分吧!', + icon: 'none', + duration: 2000, + mask: false + }); + } + }, + //所需积分 + need: function () { + var that = this; + var hid = this.data.hidden; + if (hid == true) { + hid = false; + that.setData({ + allow_load:true, + sort :imgurl.up.url, + sortOrder: 'desc', + sortColumn: 'creditPrice', + page: 1 + }) + that.getList(1) + } + else { + hid = true; + that.setData({ + sort: imgurl.down.url, + sortOrder: 'asc', + sortColumn: 'creditPrice', + allow_load: true, + page:1 + }) + that.getList(1) + } + this.setData({ + hidden: hid // 改变状态 + }) + }, + getList(pageNum) { + var that = this; + if (that.data.allow_load) { + that.setData({ + loading: true, + content: '小主,我在玩命加载中...' + }) + var param = { + pageNum: pageNum, + pageSize: 10, + targetAd: 50, + sortColumn: that.data.sortColumn, + sortOrder: that.data.sortOrder, + userCredit: that.data.userCredit + }; + var url = config.api.couponChannelList; + // 请求接口 + Http.get({ + url: url, + data: param, + }).then(res => { + console.log(res) + /** + * 加载完成 + */ + if (pageNum >= res.data.pages) { + if (res.data.pages == 0 || res.data.pages == 1) { + that.setData({ + allow_load: true, + loading: false, + content: "" + }); + } else { + that.setData({ + allow_load: false, + loading: true, + content: "——— 再拉裤子就掉了啦 ———", + }); + } + } + if (pageNum == 1) { + that.setData({ + lists: [], + }) + } + var tmpArr = that.data.lists; + // tmpArr = [...tmpArr, ...res.data.list]; + tmpArr.push.apply(tmpArr, res.data.list); + that.setData({ + lists: tmpArr + }) + tt.stopPullDownRefresh(); + }) + .catch(err => { + tt.stopPullDownRefresh(); + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400); + } else { + that.setData({ + loading: true, + content: "——— 再拉裤子就掉了啦 ———" + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400) + } + }, + /** + * + * @param goto拼团券详情 + */ + invite: function (e) { + let couponChannelId = e.currentTarget.dataset.id; + let couponId = e.currentTarget.dataset.couponid; + if (couponChannelId && couponId) { + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}` + }) + } + }, + //加载更多 + onReachBottom: function () { + let that = this; + that.data.page++; + that.setData({ + page: that.data.page + }); + that.getList(that.data.page, that.data.flag); + }, + /** + * 刷新 + */ + onPullDownRefresh: function (e) { + let that = this; + that.setData({ + sort: '', + sortColumn: '', + sortOrder: '', + userCredit: '', + page:1, + allow_load: true, + }) + that.getList(1); + that.getPoints(); + } +}) \ No newline at end of file diff --git a/pages/integralmall/index.json b/pages/integralmall/index.json new file mode 100644 index 0000000..08931fd --- /dev/null +++ b/pages/integralmall/index.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "积分商城", + "navigationBarBackgroundColor": "#FD832D", + "navigationBarTextStyle": "white", + "enablePullDownRefresh": true, + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/integralmall/index.ttml b/pages/integralmall/index.ttml new file mode 100644 index 0000000..27c5a9e --- /dev/null +++ b/pages/integralmall/index.ttml @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + {{levelName}} + + + + + 还需{{upgradeScore}}成长值升级 + + + + + + {{creditAmount}} + + 积分详情 + + + + + + + + + + + 我可换购 + + 所需积分 + + + + + + 暂无数据 + + + + + + + + {{item.title}} + + + + {{item.creditPrice}} + 积分 + + {{'原价 '+item.priceStr+'元'}} + + + + + 立即购买 + 立即换购 + 立即换购 + + + + + {{item.subTitle}} + 剩余{{item.remainInventory}}张 + + + + + {{content}} + + \ No newline at end of file diff --git a/pages/integralmall/index.ttss b/pages/integralmall/index.ttss new file mode 100644 index 0000000..b8c45d9 --- /dev/null +++ b/pages/integralmall/index.ttss @@ -0,0 +1,506 @@ +/* pages/spellGroup/spellGroup.wxss */ + +.topbg { + /* margin-bottom: 20rpx; */ + width:100%; + height:234rpx; + background:linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%); +} +.topbg-top{ + width:100%; + height: 50%; + display: inline-block +} +.topbg-btom{ + width:84%; + height: 40%; + margin: 0 auto; +} +.user-avatar { + width: 20%; + height: 100%; + float: left; +} +.user-box { + width: 82rpx; + height: 82rpx; + border-radius: 50%; + overflow: hidden; + margin: 26rpx 0 0 60rpx; +} +.user-avatar open-data { + display: block; + width: 100%; + height: 100%; +} +.name{ + float: left; + color: #FFFFFF; + font-size:32rpx; + font-family:PingFangSC-Medium; + font-weight:500; + margin:0 20rpx; +} +.usre_level{ + height:32rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius:9px 9px 9px 0px; + font-family:PingFangSC-Regular; + font-weight:400; + color:rgba(255,255,255,1); + line-height:28rpx; + float: left; + margin-top: 8rpx; +} +.chengzhang { + font-size: 24rpx; + font-weight: 400; + color: #FFFFFF; + padding: 0 8rpx; +} +.myName{ + float: left; + font-size: 32rpx; + margin-top:36rpx; +} +.bot{ + display: flex; + flex-direction: column; +} +.view{ + height: 40rpx; + display: block; +} +progress{ + margin: 14rpx 8rpx 0 20rpx; + float: left; + width:230rpx; + border-radius:60rpx; + overflow:hidden; +} +.msg{ + float: left; + font-size:10px!important; + font-family:PingFangSC-Regular; + font-weight:400; + color:rgba(255,255,255,1); +} +.btoml{ + float: left; + height: 100%; + width: 50%; +} +.jifen{ + font-size: 26rpx; + font-weight: 500; + color: #FFFFFF; + height:30rpx; + line-height: 30rpx; + margin-top: 20rpx; +} +.jifen image{ + width: 10rpx; + height: 22rpx; + margin-left: 5rpx; +} +.topbg .score{ + font-size: 40rpx; + font-weight: 500; + float: left; + color: #FFFFFF; + margin-right: 10rpx; +} + +.qrcode{ + width: 84rpx; + height: 84rpx; + float: right; + /* margin-right: 48rpx; */ +} +.qrcode image { + margin: auto; + width: 84rpx; +} +page { + height: auto; + overflow: auto; + background: #f7f7f7; + background-size: cover; + background-repeat: no-repeat; +} +.content-box{ + height: auto; + padding-bottom: 200rpx; +} +.loading { + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #666; +} + +.loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; +} +.banner{ + margin-bottom: 20rpx; + background: none; + border-radius: 16rpx; +} +.banner .bg { + display: block; + width: 100%; +} +image{ + padding: 0; + margin: 0; +} +.banner .bannerbg image{ + display: none!important; + height: 0; + overflow: hidden; +} +.bannerimg { + display: block; + width: 710rpx; + height: 260rpx; + border-radius: 15rpx; + margin: -132rpx auto 0; +} +.banner .index-slide-view { + margin: -132rpx auto 0; +} +.top{ + position: absolute; + top: 30rpx; + width: 710rpx; + height: 260rpx; + background: #fff; + left: 20rpx; + border-radius: 16rpx; + overflow: hidden; +} +.content .sepll-list{ + width: 714rpx; + height: 230rpx; + background: #fff; + border-radius: 30rpx; + margin: 0 auto 30rpx; +} +.content .spell-bot{ + width: 674rpx; + float: left; + font-size: 24rpx; + height: 60rpx; + line-height: 60rpx; + border-top: 1rpx #E1E1E1 dashed; + margin: 0 20rpx; +} +.spell-bot .botMsg{ + width: 40%; + height: 100%; + float: left; + /* margin-left: 20rpx; */ + color: #A6A6A6; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.spell-bot .botNum{ + width: 40%; + height: 100%; + float: right; + text-align: right; + margin-right: 24rpx; + color: #FD782D; +} +.content .spell-left{ + width: 170rpx; + height: 170rpx; + float: left; +} +.content .spell-left image{ + width: 120rpx; + height: 120rpx; + margin: 25rpx; + border-radius: 8rpx; +} +.content .spell-center{ + float: left; + width: 380rpx; + height: 170rpx; +} +.content .tilte{ + margin-top: 20rpx; + font-size:32rpx; + font-family:PingFang-SC-Bold; + font-weight:bold; + color:#3C3C3C; + line-height:44rpx; + padding-top: 16rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.content .remark{ + width:304rpx; + font-size:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(140,140,140,1); + line-height:44rpx; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.content .spell-num{ + width: 95rpx; + border:1px solid rgba(255,50,50,1); + border-radius:10rpx; + font-size:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,50,50,1); + line-height:30rpx; + margin: 10rpx 0; + text-align: center; +} +.content .price{ + overflow: hidden; + margin-top: 20rpx; +} +.content .price01{ + font-size:40rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:#FD832D; + line-height:44rpx; +} +.content .price02{ + display: inline; + font-size: 24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + text-decoration:line-through; + color:rgba(140,140,140,1); +} +.content .price-num{ + display: inline; +} +.more{ + display: inline; + margin-left: -10rpx; +} +.content .price-unit{ + display: inline; + font-size:24rpx; + margin-right: 10rpx; +} +.content .spell-right{ + float: right; + width: 156rpx; +} +.right-button{ + width:140rpx; + height:52rpx; + font-size:26rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius:20rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + text-align: center; + color:rgba(255,255,255,1); + line-height:52rpx; + margin: 88rpx 24rpx 0 0; + margin-top: 90rpx; +} +.right-text{ + font-size:22rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(140,140,140,1); + line-height:60rpx; + text-align: center; +} +.bottom{ + width: 690rpx; + height: 85rpx; + position: fixed; + bottom: 26rpx; + left: 30rpx; + /* background:rgba(243,69,58,1); */ + border:1px solid rgba(255, 222, 67, 1); + border-radius:40px; + color: #fff; + overflow: hidden; +} +.bottom-left{ + width: 50%; + float: left; + margin-left: -1rpx; + text-align: center; + line-height: 85rpx; + font-size:30rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,253,245,1); + border-right:1px solid rgba(255, 222, 67, 1); + opacity: 1; +} +.bottom-right{ + width: 50%; + float: left; + text-align: center; + line-height: 85rpx; + font-size:30rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,253,245,1); + opacity: 1; +} +.spell-bottom{ + overflow: hidden; +} +.spell-top{ + height: auto; + margin: 0 30rpx; + overflow: hidden; + box-sizing: border-box; + border-bottom: 1rpx solid #EEEEEE; +} +.spell-top-left{ + float: left; + width: 60%; +} +.spell-top-right{ + float: left; + width: 40%; +} +.top-title{ + display: inline; + font-size:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(51,51,51,1); + line-height:64rpx; +} +.top-num{ + display: inline; + font-size:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:#FF3232; + line-height:64rpx; + padding-left: 8rpx; +} +.spell-top-right{ + text-align: right; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,50,50,1); + line-height:64rpx; +} +.no-data01{ + width: 690rpx; + padding-top: 174rpx; + height: calc(100vh - 460rpx); + background: #fff; + margin: 0 auto; + border-radius:15rpx; + box-sizing: border-box; + margin-top: 20rpx; +} +.no-data{ + width: 690rpx; + padding-top: 174rpx; + height: calc(100vh - 160rpx); + background: #fff; + margin: 0 auto; + border-radius:15rpx; + box-sizing: border-box; + margin-top:20rpx; +} +.no-data01 image{ + width: 261rpx; + height: 272rpx; + display: block; + margin: 0 auto; +} +.no-data image{ + width: 261rpx; + height: 272rpx; + display: block; + margin: 0 auto; +} +.no-data-text{ + text-align: center; + font-size:34rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(0,0,0,1); +} + +button::after{ border: none; } +.goback{ + position: fixed; + right: 50rpx; + bottom: 60rpx; + width:100rpx!important; + height:100rpx; + z-index: 100; + background:rgba(255,255,255,1); + line-height: 95rpx; + border:1rpx solid rgba(227,227,227,1); + border-radius:50%; +} +.goback image{ + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} +.remainInventory{ + background: #ccc; +} +.sort{ + width:94%; + height:90rpx; + background:#fff; + margin:0 auto 20rpx; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 3% +} +.sort view{ + width: 180rpx; + line-height: 60rpx; + color: #fff; + font-size: 28rpx; + text-align: center; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius: 20rpx; +} +.need{ + justify-content: center;/*水平居中*/ + align-items: center; /*垂直居中*/ + display: flex; +} +.need image{ + margin-left:5rpx; + width: 40rpx; + height: 40rpx; +} +.btn-hover{ + position: relative; + top: 3rpx; + box-shadow:0px 0px 8px #999 inset; +} \ No newline at end of file diff --git a/pages/integralmall/integraHistory/index.js b/pages/integralmall/integraHistory/index.js new file mode 100644 index 0000000..f2fb0f3 --- /dev/null +++ b/pages/integralmall/integraHistory/index.js @@ -0,0 +1,107 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +var config = require("../../../config/config.js"); +var app = getApp(); +const Http = require("../../../utils/HttpBasics"); +let util = require("../../../utils/util"); +const imgurl = require("../../../utils/imgurl"); +const {creditType} = require("../../../utils/creditType"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + score: 10, + pageNum: 1, + list: [], + showcontent: false, + loadingUrl: imgurl.loading.url, + bgg: imgurl.bgg.url, + allow_load: true, + creditAmount:0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + gotorule: function () { + tt.navigateTo({ + url: '/pages/grade/grade', + }) + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this; + that.record(1, 15); + }, + record(pageNum) { + var that = this; + if (that.data.allow_load) { + Http.get({ + url: config.api.integralList, + data: { + pageNum: pageNum, + pageSize: 20, + } + }).then(res => { + tt.stopPullDownRefresh(); + res.data.list.map(file => { + creditType.map((item,index)=>{ + if (file.creditType==item.value){ + file.creditTypeName = item.name; + } + }) + file.createDate = util.formatTime( + file.createDate, + "yyyy-MM-dd hh:mm:ss" + ); + }); + if (pageNum >= res.data.pages) { + that.setData({ + allow_load: false, + }); + } + that.data.list = that.data.list.concat(res.data.list); + that.setData({ + list: that.data.list, + creditAmount: that.data.list[0].creditAmount + }); + }) + .catch(err => { + tt.stopPullDownRefresh(); + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }, + /** + * 刷新 + */ + onPullDownRefresh: function (e) { + let that = this; + that.setData({ + pageNum: 1, + list:[], + allow_load:true + }); + that.record(1); + }, + onReachBottom: function () { + var that = this; + that.data.pageNum++; + that.setData({ + pageNum: that.data.pageNum + }); + that.record(that.data.pageNum); + } +}) \ No newline at end of file diff --git a/pages/integralmall/integraHistory/index.json b/pages/integralmall/integraHistory/index.json new file mode 100644 index 0000000..afc611d --- /dev/null +++ b/pages/integralmall/integraHistory/index.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "积分变更记录", + "enablePullDownRefresh": true, + "usingComponents": { + "navbar": "../../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/integralmall/integraHistory/index.ttml b/pages/integralmall/integraHistory/index.ttml new file mode 100644 index 0000000..8f1f520 --- /dev/null +++ b/pages/integralmall/integraHistory/index.ttml @@ -0,0 +1,26 @@ + + + + 当前 + {{creditAmount+'分'}} + + + + + 积分明细 + + + + {{item.changePurpose?item.changePurpose:item.creditTypeName}} + {{item.createDate}} + + + +{{item.creditNum}}分 + {{item.creditNum}}分 + + + + + 暂无数据 + + \ No newline at end of file diff --git a/pages/integralmall/integraHistory/index.ttss b/pages/integralmall/integraHistory/index.ttss new file mode 100644 index 0000000..f04ef63 --- /dev/null +++ b/pages/integralmall/integraHistory/index.ttss @@ -0,0 +1,128 @@ +/* pages/czdetail/czdetail.wxss */ + +.head { + height: 232rpx; + padding-top: 20rpx; + background: #fc5b24; + position: relative; + } + + .rule { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 124rpx; + height: 48rpx; + line-height: 48rpx; + text-align: center; + background: #fff; + font-size: 28rpx; + font-weight: 400; + color: rgba(2, 192, 255, 1); + border-bottom-left-radius: 50rpx; + border-top-left-radius: 50rpx; + } + + .head text { + display: block; + text-align: center; + color: #fff; + } + + .head text:nth-of-type(1) { + font-size: 28rpx; + font-family: PingFang-SC-Regular; + font-weight: 400; + color: rgba(255, 255, 255, 1); + } + + .head text:nth-of-type(2) { + font-size: 70rpx; + font-family: PingFang-SC-Bold; + font-weight: bold; + color: rgba(255, 255, 255, 1); + } + + .bg { + position: absolute; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 55rpx; + z-index: 100; + } + + .content { + position: relative; + padding: 0 35rpx; + height: 155rpx; + border-bottom: 1px solid #eaeaea; + } + + .content>view:nth-of-type(2n+1) text { + display: block; + } + + .content>view:nth-of-type(2n+1) text:nth-of-type(1) { + margin-top: 24rpx; + font-size: 30rpx; + } + + .content>view:nth-of-type(2n+1) text:nth-of-type(2) { + margin-top: 10rpx; + font-size: 26rpx; + font-family: PingFang-SC-Bold; + color: rgba(153, 153, 153, 1); + } + + .content>view:nth-of-type(2n+1) { + float: left; + width: 60%; + height: 150rpx; + overflow: hidden; + } + + .content>view:nth-of-type(2n) { + width: 38%; + float: right; + text-align: right; + height: 145rpx; + line-height: 145rpx; + overflow: hidden; + } + + .title { + display: block; + text-align: center; + font-size: 30rpx; + font-family: PingFang-SC-Regular; + font-weight: 400; + color: rgba(51, 51, 51, 1); + } + .fr text{ + color: #FF3535; + font-size: 30rpx; + } + .loading { + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #999; + } + + .loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; + } + .nonecontent{ + text-align: center; + font-size: 30rpx; + color: #999; + margin-top: 30rpx; + } \ No newline at end of file diff --git a/pages/integralmall/payIntegcouponStatus/index.js b/pages/integralmall/payIntegcouponStatus/index.js new file mode 100644 index 0000000..18e8615 --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.js @@ -0,0 +1,101 @@ +// pages/integralmall/payIntegcouponStatus/index.js +// pages/spellGroup/mySpellGroup/index.js +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'; +var config = require("../../../config/config.js"); +const Http = require("../../../utils/HttpBasics"); +const imgurl = require("../../../utils/imgurl"); +const utils = require("../../../utils/util.js") +let app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + teljpgUrl: imgurl.teljpg.url, + goHomeUrl: "", + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + formData:options, + goHomeUrl: app.globalData.goHomeUrl, + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + /** + * 去使用 + */ + gotoUse(){ + if(this.data.formData.type=='50'){ + tt.navigateTo({ + url: '/pages/ticket/ticket', + }) + }else{ + tt.navigateTo({ + url: '/pages/passCar/couponList/couponList', + }) + } + }, + /** + * 返回首页 + */ + gotoIndex(){ + let this_ = this + tt.navigateTo({ + url: this_.data.goHomeUrl, + }) + }, + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/integralmall/payIntegcouponStatus/index.json b/pages/integralmall/payIntegcouponStatus/index.json new file mode 100644 index 0000000..f7ac2f0 --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "积分兑换结果", + "navigationBarTextStyle": "white", + "navigationBarBackgroundColor": "#F13C42", + "enablePullDownRefresh": true, + "usingComponents": { + "navbar": "../../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/integralmall/payIntegcouponStatus/index.ttml b/pages/integralmall/payIntegcouponStatus/index.ttml new file mode 100644 index 0000000..9a9b54e --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.ttml @@ -0,0 +1,15 @@ + + + + 兑换成功 + + + + + {{'会员积分兑换'+formData.title}} + + 已存入"我的券包"请您查看使用 + {{'剩余积分:'+formData.remainingPoints}} + + + diff --git a/pages/integralmall/payIntegcouponStatus/index.ttss b/pages/integralmall/payIntegcouponStatus/index.ttss new file mode 100644 index 0000000..45f9f95 --- /dev/null +++ b/pages/integralmall/payIntegcouponStatus/index.ttss @@ -0,0 +1,74 @@ +/* pages/integralmall/payIntegcouponStatus/index.wxss */ +page{ + background: #F4F5F9; + } + .tilte{ + text-align: center; + height:50rpx; + font-size:40rpx; + font-family:PingFang-SC-Bold; + font-weight:bold; + color:#FD782D; + line-height:50rpx; + margin: 70rpx auto; + } + .coupon{ + overflow: hidden; + width:690rpx; + padding: 20rpx 0; + margin: 0 auto; + box-shadow:0px 10rpx 27rpx 0rpx rgba(15,15,15,0.09); + border-radius:20rpx; + background: #fff; + } + .c-left{ + width: 160rpx; + padding-left: 30rpx; + height: auto; + float: left; + box-sizing: border-box; + padding-top: 18rpx; + } + .c-left image{ + width: 120rpx; + } + .c-right{ + width: 510rpx; + float: left; + line-height: 50rpx; + color: #3C3C3C; + font-size: 32rpx; + margin-top: 10rpx; + } + .detail-text{ + font-size:30rpx; + padding-left: 30rpx; + line-height: 40rpx; + margin-top: 30rpx; + color:rgba(85,85,85,1); + } + .detail-num{ + font-size:30rpx; + padding-left: 30rpx; + line-height: 40rpx; + margin-top: 10rpx; + color:#A6A6A6; + } + .button01{ + width:456rpx; + height:94rpx; + line-height: 94rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + /* border-radius:32rpx; */ + color: #fff; + margin-top: 100rpx; + } + .button02{ + width:456rpx; + height:94rpx; + line-height: 94rpx; + background:#E1E1E1; + /* border-radius:32rpx; */ + color: #fff; + margin-top: 30rpx; + } \ No newline at end of file diff --git a/pages/integralmall/payIntegcoupondetail/index.js b/pages/integralmall/payIntegcoupondetail/index.js new file mode 100644 index 0000000..441f65c --- /dev/null +++ b/pages/integralmall/payIntegcoupondetail/index.js @@ -0,0 +1,283 @@ +// pages/spellDetail/index.js +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'; +var config = require("../../../config/config.js"); +const Http = require("../../../utils/HttpBasics"); +const imgurl = require("../../../utils/imgurl"); +const { spellStatus } = require("../../../utils/spell"); +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + tuanzhang: imgurl.tuanzhang.url, + spellBg: imgurl.spellBg.url, + position: imgurl.position.url, + close03: imgurl.close03.url, + home: imgurl.wmhome.url, + paramData: null, + data: null, + showErr: false, + showAlert: false, + remainingPoints:0, + submitAble:true + }, + getUserInfo: function () { + let that = this; + // 获取用户信息 + Http.get({ + url: config.api.getScore, + data: {} + }) + .then(res => { + console.log(res) + that.setData({ + remainingPoints: Number(res.data.credit) - Number(that.data.data.creditPrice), + userInfo:res.data + }) + }) + }, + cannotPay(){ + tt.showToast({ + title: "您的积分不足", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + }, + gotoIndex() { + tt.reLaunch({ + url: '/pages/index/index', + }) + }, + gotoSearch() { + tt.navigateTo({ + url: `/pages/spellGroup/spellGroup`, + }) + }, + onShow:function(){ + this.setData({ + submitAble: true + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + paramData: options + }) + this.getDetail(options.couponChannelId); + + // 关闭来自于左上角的分享 + tt.hideShareMenu() + }, + /** + * 发起支付 + */ + gotoPay() { + var that = this; + that.setData({ + submitAble: false + }) + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }) + .then(res => { + var data = { + couponChannelId: "" + that.data.paramData.couponChannelId, + couponId: "" + that.data.paramData.couponId + } + /** + * orderSave 下单 + */ + return Http.post({ + url: config.api.orderSave, + data: data + }); + }) + .catch(err => { + console.log(err); + that.setData({ + submitAble: true + }) + if (err.code == 2011) { + tt.showToast({ + title: "商户信息没找到", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 2013) { + tt.showToast({ + title: "商户信息禁用", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3000) { + tt.showToast({ + title: "库存不足", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3001) { + tt.showToast({ + title: "您已超过限购", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3002) { + tt.showToast({ + title: "订单失败", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3003) { + tt.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3004) { + tt.showToast({ + title: "订单不存在", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 4003) { + tt.showToast({ + title: "卡券已作废", + image: './../../../assets/images/fail.png', + duration: 2000, + mask: false + }); + } else if (err.code == 3012) { + tt.showModal({ + title: '提示', + content: '您有未支付订单,请先进行支付', + confirmText: "去支付", + success: function (res) { + console.log(res.confirm) + if (res.confirm) { + tt.navigateTo({ + url: '/pages/order/index/index?id=all', + }) + } + } + }) + } else if (err.code == 11005) { + /** + * 将值传到用户手机号授权的页面 + * + */ + tt.redirectTo({ + url: "/pages/getphoneInfo/index?couponChannelId=" + + that.data.paramData.couponChannelId + "&couponId=" + that.data.paramData.couponId +"&path=jifen" + }); + } else if (err.code == 11006) { + // 用户手机已加密 + tt.redirectTo({ + url: "/pages/phoneinput/phoneinput?couponChannelId=" + + that.data.paramData.couponChannelId + "&couponId=" + that.data.paramData.couponId + "&path=jifen" + }); + } else { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + } + }) + .then(res => { + console.log(res) + if (typeof (res) != "undefined") { + let orderId = "" + res.data.mainOrderId; + that.setData({ + orderId: orderId + }); + // console.log(that.data.type) + // 免费券 + that.payOrderUpdate(orderId, "0", 1, '',that); + // that.payOrderUpdate(that.data.orderId, '', 1, '', that); + if (that.data.cardType == 100) { + tt.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else if (that.data.data.type != "5") { + tt.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + } + }) + }, + /** + * 支付订单更新 + */ + payOrderUpdate: (orderId, payOrderId, status, reason, _this) => { + let that = this; + // 支付成功 + Http.post({ + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + composeOrderId: orderId, + status: status, + reason: reason + } + }) + .then(res => { + wx.hideLoading() + wx.navigateTo({ + url: '/pages/integralmall/payIntegcouponStatus/index?title=' + _this.data.data.title + '&coverImg=' + _this.data.data.coverImg + '&remainingPoints=' + _this.data.remainingPoints + '&type=' + _this.data.data.type, + }) + }) + .catch(err => { + if (err.code != 12002) { + setTimeout(function () { + _this.payOrderUpdate(orderId, payOrderId, status, reason, _this); + }, 2000) + } + }) + }, + /** + * 获取券详情信息 + */ + getDetail(couponChannelId) { + let that = this; + Http.get({ + url: config.api.couponDetail, + data: { + couponChannelId: couponChannelId + } + }).then(res => { + tt.stopPullDownRefresh(); + that.getUserInfo() + let data = res.data; + that.setData({ + data + }); + }); + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + this.getDetail(this.data.paramData.couponChannelId); + this.setData({ + submitAble: true + }) + } +}) \ No newline at end of file diff --git a/pages/integralmall/payIntegcoupondetail/index.json b/pages/integralmall/payIntegcoupondetail/index.json new file mode 100644 index 0000000..08b564a --- /dev/null +++ b/pages/integralmall/payIntegcoupondetail/index.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "积分换礼", + "navigationBarBackgroundColor": "#F13C42", + "navigationBarTextStyle": "white", + "enablePullDownRefresh": true, + "usingComponents": { + "navbar": "../../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/integralmall/payIntegcoupondetail/index.ttml b/pages/integralmall/payIntegcoupondetail/index.ttml new file mode 100644 index 0000000..fa5008a --- /dev/null +++ b/pages/integralmall/payIntegcoupondetail/index.ttml @@ -0,0 +1,42 @@ + + + + + + + + + + + + {{data.title}} + {{data.subTitle}} + {{'价值:'+data.priceStr+'元'}} + + + {{data.creditPrice}}积分 + 积分售价 + + + + + + + + 当前积分总额 + {{userInfo.credit}} + + + 兑换使用积分 + {{data.creditPrice}} + + + 剩余积分 + {{remainingPoints}} + + + + + + + diff --git a/pages/integralmall/payIntegcoupondetail/index.ttss b/pages/integralmall/payIntegcoupondetail/index.ttss new file mode 100644 index 0000000..015f732 --- /dev/null +++ b/pages/integralmall/payIntegcoupondetail/index.ttss @@ -0,0 +1,458 @@ +/* pages/spellDetail/index.wxss */ +page { + height: auto; + overflow: auto; + background: #F4F5F9; + /* background-image: url('https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/cimg/spelldetail-bg.png'); */ + background-size: cover; + background-repeat: no-repeat; + } + .container{ + margin-bottom:40rpx; + } + .status{ + width: 690rpx; + padding:0 28rpx; + margin: 0 auto; + box-sizing: border-box; + background:rgba(255,255,255,1); + border-radius:15rpx; + } + .edit{ + position: fixed; + width: 750rpx; + height: 185rpx; + bottom: 60rpx; + left: 0; + } + .status-top{ + width: 100%; + height: 75rpx; + box-sizing: border-box; + border-bottom: 1rpx solid #F9F9F9; + /* overflow: hidden; */ + } + .p-status{ + float: left; + width: 260rpx; + font-size:32rpx; + font-family:PingFang-SC-Bold; + font-weight:bold; + color:rgba(243,69,58,1); + line-height: 75rpx; + } + .p-time{ + float: right; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(243,69,58,1); + width: 38rpx; + height: 30rpx; + margin-top: 22rpx; + background:rgba(252,220,221,1); + border-radius:10rpx; + line-height: 30rpx; + text-align: center; + margin: 22rpx 6rpx; + } + .p-mao{ + float: right; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(243,69,58,1); + line-height: 75rpx; + } + .p-text{ + float: right; + font-size:26rpx; + font-family:PingFang-SC-Regular; + font-weight:400; + color:rgba(51,51,51,1); + line-height:75rpx; + } + .status-center{ + width: 100%; + overflow: hidden; + padding: 20rpx 0; + text-align: center; + border-bottom: 1rpx solid #F9F9F9; + } + .tuanzhang{ + float: left; + width: 120rpx; + height: 120rpx; + position: relative; + box-sizing:border-box; + } + .touxiangitems{ + padding: 20rpx; + margin: 0; + overflow: hidden; + } + .touxiang{ + width: 80rpx; + height: 80rpx; + border-radius: 40rpx; + overflow: hidden; + } + .no-touxiang{ + width: 80rpx; + height: 80rpx; + overflow: hidden; + background:rgba(252,220,221,1); + border:1rpx solid rgba(243,69,58,1); + border-radius:50%; + box-sizing: border-box; + line-height: 78rpx; + text-align: center; + font-size:32rpx; + font-family:PingFang-SC-Regular; + font-weight:400; + color:rgba(243,69,58,1); + margin: 0; + padding: 0; + } + .touxiang image{ + width: 80rpx; + height: 80rpx; + } + .tuan-icon{ + position: absolute; + bottom:20rpx; + left:28rpx; + width: 64rpx; + height: 27rpx; + } + .tuan-icon image{ + display: block; + width: 64rpx; + height: 27rpx; + } + .status-bottom{ + width: 100%; + height: auto; + overflow: hidden; + } + .position-icon{ + width: 38rpx; + float: left; + } + .position-icon image{ + width: 27rpx; + height: 37rpx; + margin-top: 17rpx; + } + .position{ + font-size:28rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(51,51,51,1); + line-height: 72rpx; + } + .detail{ + position: relative; + width: 690rpx; + padding:0 28rpx; + margin: 30rpx auto 0; + box-sizing: border-box; + background:rgba(255,255,255,1); + border-radius:15rpx; + } + /* .return-index{ + position: absolute; + right: 30rpx; + top: 30rpx; + width: 50rpx; + height: 50rpx; + } + .return-index image{ + display: block; + width: 50rpx; + height: 50rpx; + } */ + .return-index{ + position: fixed; + right: 50rpx; + top: 60rpx; + width:100rpx!important; + height:100rpx; + z-index: 100; + background:rgba(255,255,255,1); + line-height: 95rpx; + border:1rpx solid rgba(227,227,227,1); + border-radius:50%; +} +.return-index image{ + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} + .detail-top{ + width: 100%; + height: auto; + overflow: hidden; + padding-bottom: 12rpx; + } + .detail-top01{ + float: left; + width: 180rpx; + } + .detail-top01 image{ + width: 180rpx; + height: 180rpx; + margin-top: 33rpx; + } + .detail-top02{ + width: 208rpx; + float: left; + margin-left: 16rpx; + } + .title{ + font-size:30rpx; + font-family:PingFang-SC-Bold; + font-weight:bold; + color:rgba(51,51,51,1); + line-height:44rpx; + margin-top: 30rpx; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + } + .des{ + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(134,134,134,1); + line-height:40rpx; + overflow:hidden; + text-overflow:ellipsis; + white-space:nowrap; + } + .detail-top03{ + float: left; + padding-top: 180rpx; + width: 230rpx; + } + .detail-p-name{ + float: right; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:#FD782D; + line-height:44rpx; + } + .detail-p-price{ + float: right; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:#FD782D; + line-height:44rpx; + } + .detail-bottom{ + border-top: 1rpx solid #F9F9F9; + width: 100%; + overflow: hidden; + height: 86rpx; + } + .b-unit{ + float: right; + font-size:24rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(237,63,46,1); + margin-top: 36rpx; + } + .b-price{ + float: right; + font-size:40rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(237,63,46,1); + margin-top: 18rpx; + } + .b-name{ + float: right; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(51,51,51,1); + margin-right: 6rpx; + margin-top: 34rpx; + } + .order{ + width: 690rpx; + padding:10rpx 28rpx; + margin: 30rpx auto 0; + box-sizing: border-box; + background:rgba(255,255,255,1); + border-radius:15rpx; + } + .order-list{ + height: 55rpx; + } + .order-title{ + line-height: 55rpx; + float: left; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(51,51,51,1); + } + .order-text{ + float: right; + text-align: right; + line-height: 55rpx; + font-size:26rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:#FD782D; + } + .user-motto { + border: 0; + width:650rpx; + height:85rpx; + background:linear-gradient(90deg,rgba(248,85,45,1) 0%,rgba(241,60,66,1) 0%,rgba(248,86,46,1) 100%); + border-radius:43rpx; + font-size:36rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(254,254,254,1); + line-height: 85rpx; + margin-top: 100rpx; + } + .user-enough{ + border: 0; + width:650rpx; + height:85rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius:43rpx; + font-size:36rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(254,254,254,1); + line-height: 85rpx; + margin-top: 100rpx; + } + .user-motto::after { + border: none; + } + .button button:nth-of-type(1){ + width:520rpx; + height:95rpx; + margin: 30rpx auto 38rpx; + background:linear-gradient(90deg,rgba(248,85,45,1) 0%,rgba(241,60,66,1) 0%,rgba(248,86,46,1) 100%); + border-radius:47rpx; + color: #fff; + } + .button button:nth-of-type(2){ + width:520rpx; + height:95rpx; + background:rgba(255,255,255,1); + border:1rpx solid rgba(190,190,190,1); + border-radius:47rpx; + color:#333333; + margin-bottom: 50rpx; + } + .alert-bg{ + width: 100%; + height: 100vh; + position: fixed; + opacity: 0.7; + background: #000; + top: 0; + left: 0; + z-index: 200; + } + .alert-box{ + width: 600rpx; + height: 332rpx; + position: fixed; + z-index: 300; + background: #fff; + top: 50vh; + margin-top: -162rpx; + left: 85rpx; + border-radius:15rpx; + } + .alert-close{ + position: absolute; + width: 47rpx; + height: 98rpx; + top: -98rpx; + right: 0; + } + .alert-close image{ + width: 47rpx; + height: 98rpx; + } + .alert-title{ + text-align: center; + font-size:30rpx; + line-height: 30rpx; + margin-top: 79rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(51,51,51,1); + } + .alert-button .share{ + width:500rpx; + height:95rpx; + background:linear-gradient(90deg,rgba(248,85,45,1) 0%,rgba(241,60,66,1) 0%,rgba(248,86,46,1) 100%); + border-radius:47rpx; + margin-top: 79rpx; + } + .al-bg{ + position: fixed; + width: 100%; + height: 100vh; + top: 0; + left: 0; + background:rgba(0,0,0,1); + opacity:0.65; + z-index: 200; +} +.al-content{ + background: #fff; + position: fixed; + width: 545rpx; + z-index: 300; + top: 200rpx; + left: 102rpx; + border-radius: 15rpx; +} +.al-top{ + width: 100%; +} +.al-top image{ + position: relative; + height: 298rpx; + margin-top: -96rpx; + width: 545rpx; +} +.al-center{ + padding: 80rpx 30rpx; + font-size:30rpx; + font-family:PingFang-SC-Regular; + font-weight:400; + color:rgba(51,51,51,1); +} +.al-bottom{ + width:462rpx; + height:95rpx; + background:linear-gradient(90deg,rgba(248,85,45,1) 0%,rgba(241,60,66,1) 0%,rgba(248,86,46,1) 100%); + border-radius:47rpx; + font-size:30rpx; + font-family:PingFang-SC-Medium; + font-weight:500; + color:rgba(255,255,255,1); + text-align: center; + line-height: 95rpx; + margin: 0 auto 43rpx; +} \ No newline at end of file diff --git a/pages/main/coupons/index.js b/pages/main/coupons/index.js new file mode 100644 index 0000000..7a9498a --- /dev/null +++ b/pages/main/coupons/index.js @@ -0,0 +1,225 @@ +// pages/index/sw/index.js +let config = require("../../../config/config.js"); +let Http = require("../../../utils/HttpBasics"); +let app = getApp(); +const imgurl = require("../../../utils/imgurl"); +// 请求数据 +Component({ + /** + * 组件的属性列表 + */ + properties: { + loading: { + type: Boolean, + value: '' + }, + loadingtext: { + type: String, + value: '' + }, + }, + + /** + * 组件的初始数据 + */ + data: { + actUrl: imgurl.act.url, + loadingUrl: imgurl.loading.url, + tabs: [], + list: [], + flag: "", + loading: true, //"上拉加载"的变量,默认false,隐藏 + content: "", + return_list: [], + current: 0, + current_scroll: 0, + pageNum: 1, // 设置加载的第几次,默认是第一次 + pageSize: 10, //返回数据的个数 + searchLoadingComplete: false, //“没有数据”的变量,默认false,隐藏 + allow_load: true, // 是否允许继续加载标识 默认 true 允许,false 加载完成 + }, + /** + * 组件的方法列表 + */ + methods: { + handleChange({ + detail + }) { + this.setData({ + current: detail.key + }); + }, + + handleChangeScroll({ + detail + }) { + let that = this; + // 切换tab时重新初始化下list 和 allow_load + that.setData({ + current_scroll: detail.key, + flag: "click", + list: [], + allow_load: true + }); + this.getList(detail.key, 1); + var val = detail.key; + //通过这个传递数据 + var myEventDetail = { + val: val, + pageNum: 1 + }; + // detail对象,提供给事件监听函数 + this.triggerEvent("myevent", myEventDetail); + }, + + getList(key, pageNum, from) { + var that = this; + console.log("pageNum------>"+pageNum); + /** + * from==refresh + * 表示是从下拉刷新进来的 + */ + app.couponListCallback = token => { + Http.setToken(token); + // 券list获取 + if (from == 'refresh') { + that.setData({ + allow_load: true, + list: [], + }) + console.log(that.data.list); + } + if (that.data.allow_load) { + that.setData({ + loading: true, + content: '小主,我在玩命加载中...' + }) + // 根据 key == 0 区分全部或其它tab,决定是否传参数 business + if (key == 0) { + var param = { + pageNum: pageNum, + pageSize: 6, + targetAd: 1 + }; + } else { + var param = { + pageNum: pageNum, + pageSize: 6, + business: key, + targetAd: 1 + }; + } + // 请求接口 + Http.get({ + url: config.api.couponChannelList, + data: param + }).then(res => { + /** + * 加载完成 + */ + if (pageNum >= res.data.pages) { + if (res.data.pages == 0 || res.data.pages == 1) { + that.setData({ + allow_load: true, + loading: false, + content: "" + }); + } + else { + that.setData({ + allow_load: false, + loading: true, + content: "——— 再拉裤子就掉了啦 ———", + }); + } + } + if (pageNum == 1) { + that.setData({ + list: [], + }) + } + + var tmpArr = that.data.list; + tmpArr.push.apply(tmpArr, res.data.list); + that.setData({ + list: tmpArr + }) + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400); + } + else { + that.setData({ + loading: true, + content: "——— 再拉裤子就掉了啦 ———" + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400) + } + }; + + if (app.globalData.token && app.globalData.token != null) { + app.couponListCallback(app.globalData.token); + } + } + }, + ready() { + let that = this; + app.businessListCallback = token => { + Http.setToken(token); + // business获取 + Http.get({ + url: config.api.businessList, + data:{ + filter:2 + } + }).then(res => { + that.setData({ + tabs: [{ id: 0, title: "全部", type: 1 }].concat(res.data) + }); + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }; + if (app.globalData.token && app.globalData.token != null) { + app.businessListCallback(app.globalData.token); + } + that.setData({ + list: [] + }) + that.getList(0, 1); + } +}); +function compare(pro) { + return function (obj2, obj1) { + var val1 = obj1[pro]; + var val2 = obj2[pro]; + if (val1 < val2) { + return 1; + } else if (val1 > val2) { + return -1; + } else { + return 0; + } + } +} \ No newline at end of file diff --git a/pages/main/coupons/index.json b/pages/main/coupons/index.json new file mode 100644 index 0000000..e698a78 --- /dev/null +++ b/pages/main/coupons/index.json @@ -0,0 +1,10 @@ +{ + "component": true, + "usingComponents": { + "c-coupons": "../../../components/coupons/index", + "i-sticky": "../../../dist//sticky/index", + "i-sticky-item": "../../../dist/sticky-item/index", + "i-tabs": "../../../dist/tabs/index", + "i-tab": "../../../dist/tab/index" + } +} \ No newline at end of file diff --git a/pages/main/coupons/index.ttml b/pages/main/coupons/index.ttml new file mode 100644 index 0000000..bbba761 --- /dev/null +++ b/pages/main/coupons/index.ttml @@ -0,0 +1,15 @@ + + + + + + + + + + 请您敬请期待 + 我们正在筹备一大波优惠活动 + + {{content}} + {{loadingtext}} + \ No newline at end of file diff --git a/pages/main/coupons/index.ttss b/pages/main/coupons/index.ttss new file mode 100644 index 0000000..30ba0ab --- /dev/null +++ b/pages/main/coupons/index.ttss @@ -0,0 +1,65 @@ +@import "../../../app.ttss"; +.index-coupons { + padding: 0 20rpx; + /* margin-top: 40rpx; */ + /* background:linear-gradient(0deg,rgba(235,235,235,1) 0%,rgba(255,255,255,0.8) 100%); */ +} + i-tabs i-tabs-scroll { + background: #F4F5F9!important; + } +.loading { + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #999; +} +.coupons c-coupons{ + height: 354rpx; + margin-bottom: 34rpx; +} +.coupons c-coupons:nth-of-type(2n+1){ + float: left; +} +.coupons c-coupons:nth-of-type(2n){ + float: right; +} +.loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; +} + +/* .dingdan { + margin-top: 33rpx; +} */ + +.dingdan text:nth-of-type(1) { + display: block; + font-size: 34rpx; + color: #333; + letter-spacing: 0; + text-align: center; +} + +.dingdan text:nth-of-type(2) { + display: block; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: center; +} + +.dingdan image { + display: block; + width: 300rpx; + height: 300rpx; + margin: 0 auto 16rpx; +} +.loadingtext{ + text-align: center; + color: #888; + font-size: 30rpx; + margin-top:30rpx; +} diff --git a/pages/main/index.js b/pages/main/index.js new file mode 100644 index 0000000..93a9b95 --- /dev/null +++ b/pages/main/index.js @@ -0,0 +1,569 @@ + +const Http = require("../../utils/HttpBasics"); +const imgurl = require("../../utils/imgurl"); +const config = require("../../config/config"); +let app = getApp(); +Page({ + /** + * 页面的初始数据 + */ + data: {}, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + let that = this; + console.log(options, "跳转地址栏"); + tt.showToast({ + title: '加载中', + icon: "loading", + duration: 1000 + }) + /** + * 根据接收到的参数的值,判断跳转到哪个页面 + */ + if (options && options.type) { + app.globalData.type = options.type; + } + if (decodeURIComponent(options.scene) == "undefined") { + that.setData({ + scene: 0 + }) + app.globalData.scene = 0; + } else { + that.setData({ + scene: decodeURIComponent(options.scene) + }); + app.globalData.scene = decodeURIComponent(options.scene) + that.setData({ + newArr: this.data.scene.split(':') + }) + + //// 大屏-二维码-start + if (this.data.newArr[0] == 'JC') { + // 跳转券详情 + options.couponChannelId = this.data.newArr[1]; + } else if (this.data.newArr[0] == 'JG') { + // 跳转拼团详情 + options.couponChannelId = this.data.newArr[1]; + options.path = 'daping' + } else if (this.data.newArr[0] == 't') { + // 普通二维码 + options.type = this.data.newArr[1]; + app.globalData.type = options.type; + if (options.type == 'cd') { + options.couponChannelId = this.data.newArr[2]; + } else if (options.type == 'bd') { + options.bt = this.data.newArr[2]; + options.id = this.data.newArr[3]; + } else if (options.type == 'gm') { + options.id = this.data.newArr[2]; + } else if (options.type == 'sd') { + options.couponChannelId = this.data.newArr[2]; + } else if (options.type == 'td') { + // 专题活动页 + options.id = this.data.newArr[2]; + } else if (options.type == 'md') { + // 门店详情 + options.id = this.data.newArr[2]; + } else if (options.type == 'ra') { + //活动详情 + options.id = this.data.newArr[2]; + } else if (options.type == 'si') { + //活动签到 + options.id = this.data.newArr[2]; + } else if (options.type == 'wj') { + options.id = this.data.newArr[2]; + } + } + } + + tt.setStorageSync('options', JSON.stringify(options)) + tt.setStorageSync('imgurl', imgurl); + + if (app.globalData.token) { + // this.updateUserInfo(); + if (options.couponChannelId || options.orderId || options.id) { + that.userStatus(options); + } else { + that.userStatus(); + } + } else { + // 由于 token 是网络请求,可能会在 Page.onLoad 之后才返回 + // 所以此处加入 callback 以防止这种情况 + app.tokenCallback = token => { + // this.updateUserInfo(); + if (options.couponChannelId || options.orderId || options.id) { + that.userStatus(options); + } else { + that.userStatus(); + } + } + } + }, + + /** + * 检查用户的状态 + */ + userStatus: function(options) { + var that = this; + if (options && (options.couponChannelId || options.orderId || options.id)) { + that.checkuserstatus(options); + } else { + that.checkuserstatus(); + } + }, + /** + * 获取手机信息 + */ + // updateUserInfo() { + // tt.getSystemInfo({ + // success: function(res) { + // Http.post({ + // url: config.api.updateUserInfo, + // data: { + // systemInfo: JSON.stringify(res) + // } + // }).then(res => { + // console.log(res) + // }) + // } + // }) + // }, + + checkuserstatus(options) { + let that = this; + + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }) + .then(res => { + // res = JSON.parse('{"code":11004,"message":"用户昵称未授权,请跳转到用户昵称授权页!","data":{}}') + //参与拼团 + if(options && options.orderId && app.globalData.type == 'dt'){ + //订单详情 + tt.redirectTo({ + url: `/pages/order/detail/index?orderId=${options.orderId}` + }) + }else if (options && options.orderGroupId) { + tt.redirectTo({ + url: `/pages/joinFrDpell/index?couponId=${options.couponId}&orderGroupId=${options.orderGroupId}&couponChannelId=${options.couponChannelId}&orderId=${options.orderId}&avatarUrl=${options.avatarUrl}&nickName=${options.nickName}` + }) + } + //来自大屏的跳转拼团券详情 + else if (options && options.couponChannelId && options.path == 'daping') { + /** + * 主要是为了拿couponId + */ + Http.get({ + url: config.api.couponDetail, + data: { + couponChannelId: options.couponChannelId + } + }).then(res => { + let data = res.data; + tt.redirectTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${options.couponChannelId}&couponId=${data.couponId}` + }) + }) + } else if (options && options.couponChannelId && !options.spellGroup && app.globalData.type != 'sd') { + // 转赠判断 + if (options.cuserId) { + tt.redirectTo({ + url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}&cuserId=${options.cuserId}&coverImg=${options.coverImg}&userName=${options.userName}&avatarUrl=${options.avatarUrl}&couponOrderId=${options.couponOrderId}&updateDate=${options.updateDate}`, + }) + } else { + // 跳转普通券/消费卡/限时秒杀/砍价详情 + tt.redirectTo({ + url: `/pages/coupon/detail/index?couponChannelId=${options.couponChannelId}`, + }) + } + } + // 拼团详情页(只有通过扫码进入才可能进入拼团详情页面,只有这一个入口) + else if ((options && options.couponChannelId && app.globalData.type == 'sd') || (options && options.couponChannelId && options.spellGroup)) { + tt.redirectTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${options.couponChannelId}`, + }) + } + // 游戏页面 + else if (options && options.id && app.globalData.type == 'gm') { + that.getGameOne(app.globalData.token, options.id) + } + // 报名活动页面 + else if (options && options.id && app.globalData.type == 'ra') { + tt.redirectTo({ + url: `/pages/radetail/index?id=${options.id}`, + }) + } + //活动签到 + else if (options && options.id && app.globalData.type == 'si') { + tt.redirectTo({ + url: `/pages/acSignIn/index?id=${options.id}`, + }) + } + //问卷答题 + else if (options && options.id && app.globalData.type == 'wj') { + tt.redirectTo({ + url: `/pages/questionnaire/questionnaire?id=${options.id}`, + }) + } + // 宣传页详情 + else if (options && options.bt && options.id && app.globalData.type == 'bd') { + if (options.bt == '2') { + // 自由图文 + tt.redirectTo({ + url: `/pages/freeBannerDetail/index?id=${options.id}`, + }) + } else { + // 标准格式 + tt.redirectTo({ + url: `/pages/bannerdetail/index?id=${options.id}`, + }) + } + } + // 专题 + else if (options && options.id && app.globalData.type == 'td') { + tt.redirectTo({ + url: `/pages/topicDetail/index?id=${options.id}` + }); + } + // 门店详情 + else if (options && options.id && app.globalData.type == 'md') { + tt.redirectTo({ + url: `/pages/index/searchbar/detail/index?id=${options.id}` + }); + } + // 参与砍价 + else if (options && options.orderId) { + tt.redirectTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${options.orderId}&from=${"discount"}`, + }) + } + // 我的 + else if (app.globalData.type == 'uc') { + tt.navigateTo({ + url: '/index/user' + }); + } + // 积分 + else if (app.globalData.type == 'jf') { + tt.redirectTo({ + url: '/pages/integralmall/index' + }); + } + // 首页 + else if (app.globalData.type == 'in') { + tt.reLaunch({ + url: '/index/index' + }); + } + // 停车 + else if (app.globalData.type == 'pc') { + // 停车 + tt.navigateTo({ + url: '/index/passCar' + }); + } + // 我的券包 + else if (app.globalData.type == 'mc') { + // 我的券包 + tt.redirectTo({ + url: '/pages/couponorder/index/index' + }); + } + // 我的订单 + else if (app.globalData.type == 'mo') { + // 我的订单 + tt.redirectTo({ + url: '/pages/order/index/index?id=all' + }); + } + // 我的卡包 + else if (app.globalData.type == 'ca') { + // 我的卡包 + tt.redirectTo({ + url: '/pages/cardorder/index/index' + }); + } + // 特享礼遇 + else if (app.globalData.type == 'sc') { + // 特享礼遇 + tt.redirectTo({ + url: '/pages/specialcourtesy/specialcourtesy' + }); + } + // 限时秒杀 + else if (app.globalData.type == 'rb') { + // 限时秒杀 + tt.redirectTo({ + url: '/pages/rushToBuy/index' + }) + } + // 砍价专场 + else if (app.globalData.type == 'bl') { + // 砍价专场 + tt.redirectTo({ + url: '/pages/bargain/bargain' + }) + } + // 我的砍价 + else if (app.globalData.type == 'mb') { + // 我的砍价 + tt.redirectTo({ + url: '/pages/bargain/bargain?from=myhtml' + }) + } + // 拼团专场 + else if (app.globalData.type == 'sl') { + // 拼团专场 + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup' + }) + } + // 我的拼团 + else if (app.globalData.type == 'ms') { + // 我的拼团 + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup?from=myhtml' + }) + } + // 消费卡 + else if (app.globalData.type == 'dc') { + // 消费卡 + tt.redirectTo({ + url: '/pages/discountCardList/discountCardList' + }) + } + // 门店 + else if (app.globalData.type == 'ml') { + tt.navigateTo({ + url: '/index/searchbar' + }) + } + // 兑换 + else if (app.globalData.type == 'ec') { + tt.redirectTo({ + url: '/pages/exchange/exchange' + }) + } + // 通过分享进入的门店详情 + else if (options && options.id && options.frommd == 'md') { + tt.redirectTo({ + url: `/pages/index/searchbar/detail/index?id=${options.id}` + }); + } else { + // 主页 + tt.reLaunch({ + url: '/index/index' + }) + } + }) + .catch(err => { + console.log(err) + if (err.code == 11004) { + // 用户昵称未授权 + if (options && options.orderGroupId) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponId=${options.couponId}&orderGroupId=${options.orderGroupId}&couponChannelId=${options.couponChannelId}&orderId=${options.orderId}&avatarUrl=${options.avatarUrl}&nickName=${options.nickName}` + }) + } + /** + * spellGroup + * 区分是通过拼团详情分享过来的还是从普通券分享过来的 + * 注意:拼团券和普通券是两个页面 + */ + if (options && options.couponChannelId && !options.cuserId && !options.spellGroup) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}` + }) + } else if (options && options.couponChannelId && !options.cuserId && options.spellGroup) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}&spellGroup=${options.spellGroup}` + }) + } else if (options && options.couponChannelId && options.cuserId) { + /** + * 转赠判断 + */ + tt.redirectTo({ + url: `/pages/getuserinfo/index?couponChannelId=${options.couponChannelId}&cuserId=${options.cuserId}&coverImg=${options.coverImg}&userName=${options.userName}&avatarUrl=${options.avatarUrl}&couponOrderId=${options.couponOrderId}&updateDate=${options.updateDate}` + }) + } else if (options && options.orderId) { + tt.redirectTo({ + url: `/pages/getuserinfo/index?orderId=${options.orderId}&from='${"discount"}` + }) + } + // 通过分享进入的门店详情 + else if (options && options.id && options.frommd == 'md') { + tt.redirectTo({ + url: `/pages/getuserinfo/index?id=${options.id}&frommd=md` + }); + } // 门店详情 + else if (options && options.id && app.globalData.type == 'md') { + tt.redirectTo({ + url: `/pages/index/searchbar/detail/index?id=${options.id}` + }); + } + // 答题问卷 + else if (options && options.id && app.globalData.type == 'wj') { + tt.redirectTo({ + url: `/pages/questionnaire/questionnaire?id=${options.id}`, + }) + } + // 报名活动页面 + else if (options && options.id && app.globalData.type == 'ra') { + tt.redirectTo({ + url: `/pages/radetail/index?id=${options.id}`, + }) + } else if (app.globalData.type == 'uc') { + tt.navigateTo({ + url: '/index/user' + }); + } + // 积分 + else if (app.globalData.type == 'jf') { + tt.redirectTo({ + url: '/pages/integralmall/index' + }); + } + // 专题 + else if (options && options.id && app.globalData.type == 'td') { + tt.redirectTo({ + url: `/pages/topicDetail/index?id=${options.id}` + }); + } + // 首页 + else if (app.globalData.type == 'in') { + tt.reLaunch({ + url: '/index/index' + }); + } + // 停车 + else if (app.globalData.type == 'pc') { + // 停车 + tt.navigateTo({ + url: '/index/passCar' + }); + } + // 我的券包 + else if (app.globalData.type == 'mc') { + // 我的券包 + tt.redirectTo({ + url: '/pages/couponorder/index/index' + }); + } + // 我的订单 + else if (app.globalData.type == 'mo') { + // 我的订单 + tt.redirectTo({ + url: '/pages/order/index/index?id=all' + }); + } + // 我的卡包 + else if (app.globalData.type == 'ca') { + // 我的卡包 + tt.redirectTo({ + url: '/pages/cardorder/index/index' + }); + } + // 特享礼遇 + else if (app.globalData.type == 'sc') { + // 特享礼遇 + tt.redirectTo({ + url: '/pages/specialcourtesy/specialcourtesy' + }); + } + // 限时秒杀 + else if (app.globalData.type == 'rb') { + // 限时秒杀 + tt.redirectTo({ + url: '/pages/rushToBuy/index' + }) + } + // 砍价专场 + else if (app.globalData.type == 'bl') { + // 砍价专场 + tt.redirectTo({ + url: '/pages/bargain/bargain' + }) + } + // 我的砍价 + else if (app.globalData.type == 'mb') { + // 我的砍价 + tt.redirectTo({ + url: '/pages/bargain/bargain?from=myhtml' + }) + } + // 拼团专场 + else if (app.globalData.type == 'sl') { + // 拼团专场 + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup' + }) + } + // 我的拼团 + else if (app.globalData.type == 'ms') { + tt.redirectTo({ + url: '/pages/spellGroup/spellGroup?from=myhtml' + }) + } + // 消费卡 + else if (app.globalData.type == 'dc') { + // 消费卡 + tt.redirectTo({ + url: '/pages/discountCardList/discountCardList' + }) + } + // 兑换 + else if (app.globalData.type == 'ec') { + tt.redirectTo({ + url: '/pages/exchange/exchange' + }) + } + // 门店 + else if (app.globalData.type == 'ml') { + tt.navigateTo({ + url: '/index/searchbar' + }) + } else { + tt.reLaunch({ + url: '/index/index', + }) + } + } + }) + }, + + getGameOne: function(token, id) { + let _this = this; + Http.get({ + url: config.api.getOneGame, + data: { + token: token, + id: id + } + }).then(res => { + tt.redirectTo({ + url: '/pages/game/index?url=' + res.data.url + "&id=" + res.data.id + "&gameId=" + res.data.gameId, + }) + }) + .catch(err => { + tt.showModal({ + title: '提示', + content: err.message, + showCancel: false, + success: function(res) { + // 如果游戏下架或者找不到,重启首页 + if (res.confirm) { + tt.reLaunch({ + url: '/pages/index/index', + }) + } + } + }) + this.alphaClick(); + }) + }, +}) \ No newline at end of file diff --git a/pages/main/index.json b/pages/main/index.json new file mode 100644 index 0000000..9440201 --- /dev/null +++ b/pages/main/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "首页", + "navigationBarBackgroundColor": "#fff" + } \ No newline at end of file diff --git a/pages/main/index.ttml b/pages/main/index.ttml new file mode 100644 index 0000000..e69de29 diff --git a/pages/main/index.ttss b/pages/main/index.ttss new file mode 100644 index 0000000..da48ae3 --- /dev/null +++ b/pages/main/index.ttss @@ -0,0 +1,7 @@ +Page{ + height: 100%; + width: 100%; + background:#fff; + opacity: 0; + } + \ No newline at end of file diff --git a/pages/mainOrder/mainOrder.js b/pages/mainOrder/mainOrder.js new file mode 100644 index 0000000..7fc6076 --- /dev/null +++ b/pages/mainOrder/mainOrder.js @@ -0,0 +1,125 @@ +const app = getApp() +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const Http = require("../../utils/HttpBasics"); +let config = require("../../config/config.js"); +const util = require("../../utils/util") +Page({ + data: { + navigationBarHeight, + boatLsit:[ + { + name:"全部", + value:"all" + }, + { + name:"待付款", + value:"0" + }, + { + name:"已完成", + value:"1" + }, + ], + boatFlag:"all", + content:"", + loading: false, //"上拉加载"的变量,默认false,隐藏 + pageNum:1, + allow_load: true, + list:[] + }, + setBoatFlag(e){ + let index = e.currentTarget.dataset.index + console.log(index); + this.setData({ + boatFlag:index, + pageNum:1, + allow_load: true, + }) + this.getList() + }, + getList(){ + let that = this + if (that.data.allow_load) { + that.setData({ + loading: true, + content: '小主,我在玩命加载中...' + }) + + Http.get({ + url:config.api.orderList, + data:{ + pageNum:that.data.pageNum, + pageSize: 10, + orderStatus:that.data.boatFlag=="all"?"":that.data.boatFlag, + paymentType: 0, + + } + }).then(res=>{ + if(that.data.pageNum==1){ + that.setData({ + list: [] + }) + } + + let tempArr= that.data.list + tempArr.map(item=>{ + item.createDate = util.formatTime(item.createDate, "yyyy-MM-dd hh:mm:ss"); + }) + if(that.data.pageNum>=res.data.pages){ + that.setData({ + allow_load: false + }) + } + + if(that.data.pageNum>1){//分页 + that.setData({ + list:[...tempArr ,...res.data.list], + loading:false + }) + }else{ + let tempLsit = res.data.list + tempLsit.map(item=>{ + item.createDate = util.formatTime(item.createDate, "yyyy-MM-dd hh:mm:ss"); + }) + + that.setData({ + list: tempLsit, + loading:false + }) + } + }).catch(err => { + that.setData({ + loading:false + }) + tt.showToast({ + title: err.message ? err.message : err.data, // 内容 + icon: "none" + }); + }) + }else { + that.setData({ + loading: true, + content: "——— 再拉裤子就掉了啦 ———" + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400) + } + + }, + onLoad: function (options) { + // this.getList() + }, + onReachBottom(){//触底 + console.log(111); + this.setData({ + pageNum:this.data.pageNum+1 + }) + this.getList() + }, + onShow:function(){ + this.getList() + } +}) \ No newline at end of file diff --git a/pages/mainOrder/mainOrder.json b/pages/mainOrder/mainOrder.json new file mode 100644 index 0000000..106ce81 --- /dev/null +++ b/pages/mainOrder/mainOrder.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "我的订单", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/mainOrder/mainOrder.ttml b/pages/mainOrder/mainOrder.ttml new file mode 100644 index 0000000..699f657 --- /dev/null +++ b/pages/mainOrder/mainOrder.ttml @@ -0,0 +1,64 @@ + + + + + + + {{item.name}} + + + + + + + + + {{item.title}} + + 等待付款 + + 待退款 + 交易关闭 + + + + + + + + 已退款 + 退款失败 + + 免费领取 + + 付款成功 + + + + + + + + {{item.subTitle}} + {{item.price/100}}元 + {{item.createDate}} + + + + + 实付金额: + {{item.payment/100}}元 + 去查看 + 去支付 + + + + + + 您还没有相关订单 + 再忙,也要记得买点什么犒赏自己~ + + + {{content}} + + \ No newline at end of file diff --git a/pages/mainOrder/mainOrder.ttss b/pages/mainOrder/mainOrder.ttss new file mode 100644 index 0000000..07c6442 --- /dev/null +++ b/pages/mainOrder/mainOrder.ttss @@ -0,0 +1,221 @@ +.boatBox{ + width: 100% !important; + height: 96rpx; + display: flex; + justify-content: space-around; + background-color: #fff; +} +.boatBoxf{ + width: 100% !important; + position: fixed; + top: 0; + left: 0; +} +.boatTitle{ + font-size: 30rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + color: #999; +} +.boatTitleA{ + font-size: 32rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-weight: 500; + +} +.boatA{ + width: 80rpx; + height: 6rpx; + background-color: #fb3e5c; + margin: 0 auto; + border-radius: 10rpx; +} +.orderListBox{ + width: 100%; + margin-top: 20rpx; + background-color: #fff; +} +.titleBox{ + overflow: hidden; + font-size: 30rpx; +} +.orderName{ + float: left; + margin: 20rpx; +} +.payStatus{ + float: right; + margin: 20rpx; +} +.stayPay{ + float: right; + color: #FD832D; + margin: 20rpx; +} +.orderDetail{ + overflow: hidden; +} +.orderImgBox{ + float: left; + width: 140rpx; + height: 140rpx; + background-color: #fb3e5c; + border-radius: 12rpx; + margin-left: 20rpx; +} +.orderDataBox{ + float: left; + width: 520rpx; + margin-left: 20rpx; + font-size: 28rpx; +} +.fTitle{ + height: 46rpx; + height: 46rpx; +} +.face{ + height: 46rpx; + height: 46rpx; +} +.face::before{ + content: "面额:"; + font-size: 26rpx; + color: #999; +; +} +.creationDate{ + height: 46rpx; + height: 46rpx; +} +.creationDate::before{ + content: "下单时间:"; + font-size: 26rpx; + color: #999; +} +.practicalPayBox{ + /* height: 60rpx; */ + overflow: hidden; + line-height: 70rpx; + + font-size: 28rpx; + border-top: #e6e6e6 1rpx solid; + margin-top: 10rpx; +} + +.practicalText{ + font-size: 26rpx; + float: left; + margin-left: 20rpx; +} +.practicalPay{ + color: #fb3e5c; + float: left; + font-size: 28rpx; +} +.orderLook{ + float: right; + margin-right: 20rpx; + height: 50rpx; + color: #fff; + line-height: 50rpx; + border-radius: 40rpx; + background: linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%); + margin-top: 10rpx; + margin-bottom: 10rpx; + padding: 0 20rpx; +} +.goPay{ + float: right; + margin-right: 20rpx; + height: 50rpx; + color: #fff; + line-height: 50rpx; + border-radius: 40rpx; + background: linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + margin-bottom: 10rpx; + margin-top: 10rpx; + padding: 0 20rpx; +} +.loading { + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #999; + } + + .loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; + } + + .dingdan { + margin-top: 33rpx; + } + + .dingdan text:nth-of-type(1) { + display: block; + font-size: 34rpx; + color: #333; + letter-spacing: 0; + text-align: center; + } + + .dingdan text:nth-of-type(2) { + display: block; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: center; + } + + .dingdan image { + display: block; + width: 300rpx; + height: 300rpx; + margin: 0 auto 16rpx; + } + .wait{ + display: inline-block; + width: 123rpx !important; + overflow: visible!important; + font-size: 28rpx; + color: #FD832D; + letter-spacing: 0; + text-align: right; + line-height: 28rpx!important; + float: right; + margin: 20rpx; + } + + .sucess { + display: inline-block; + width: 123rpx !important; + /* overflow: hidden; */ + font-family:PingFangSC-Regular; + font-size: 28rpx; + font-weight:400; + color: #2C8DFF; + letter-spacing: 0; + text-align: right; + line-height: 26px; + float: right; + margin: 20rpx; + } + .close { + display: inline-block; + width: 123rpx !important; + overflow: hidden; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: right; + line-height: 28rpx; + float: right; + margin: 20rpx; + } \ No newline at end of file diff --git a/pages/mallInfo/mallInfo.js b/pages/mallInfo/mallInfo.js new file mode 100644 index 0000000..002c924 --- /dev/null +++ b/pages/mallInfo/mallInfo.js @@ -0,0 +1,69 @@ +// pages/mallInfo.js +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'; +var config = require("../../config/config.js"); +var app = getApp(); +const Http = require("../../utils/HttpBasics"); + +const util = require("../../utils/util"); +Page({ + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + weekName:[], + times:[], + dateArr:[ + { name: "星期一", value: "0" }, + { name: "星期二", value: "1" }, + { name: "星期三", value: "2" }, + { name: "星期四", value: "3" }, + { name: "星期五", value: "4" }, + { name: "星期六", value: "5" }, + { name: "星期天", value: "6" } + ], + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this; + console.log("渲染开始") + Http.get({ + url: config.api.getMallInfo, + }) + .then(res => { + if (res.data.businessHours){ + let businessHours = JSON.parse(res.data.businessHours) + businessHours.map((item, index) => { + item.weekName = [that.data.dateArr.filter(e => e.value == item.week[0])[0].name, that.data.dateArr.filter(e => e.value == item.week[1])[0].name].toString().replace(/\,/g, ' -- '), + item.time = [util.convertUTCTimeToLocalTime(item.time[0]), util.convertUTCTimeToLocalTime(item.time[1])].toString().replace(/\,/g, ' -') + }) + console.log(businessHours, 222) + that.setData({ + name: res.data.name, + servicePhone: res.data.servicePhone, + img: res.data.img, + introduction: res.data.introduction, + parkPlaceNumber: res.data.parkPlaceNumber, + businessHoursH: businessHours, + }) + } + }) + .catch(err => { + tt.showModal({ + title: '提示', + content: err.message, + showCancel: false + }) + }) + }, + phone: function (e) { + let that = this; + if (e.currentTarget.dataset.merchantlinkphone) { + tt.makePhoneCall({ + phoneNumber: e.currentTarget.dataset.merchantlinkphone + }) + } + }, +}) \ No newline at end of file diff --git a/pages/mallInfo/mallInfo.json b/pages/mallInfo/mallInfo.json new file mode 100644 index 0000000..d19bed2 --- /dev/null +++ b/pages/mallInfo/mallInfo.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "关于我们", + "navigationBarBackgroundColor": "#FD832D", + "navigationBarTextStyle": "white", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/mallInfo/mallInfo.ttml b/pages/mallInfo/mallInfo.ttml new file mode 100644 index 0000000..d93d5f3 --- /dev/null +++ b/pages/mallInfo/mallInfo.ttml @@ -0,0 +1,29 @@ + + + + + + + + {{name}} + {{introduction}} + + 营业时间 : + + + {{item.time}}({{item.weekName}}) + + + + + 停车位 : + {{parkPlaceNumber}} + + + 热线电话 : + + {{servicePhone}} + + + + diff --git a/pages/mallInfo/mallInfo.ttss b/pages/mallInfo/mallInfo.ttss new file mode 100644 index 0000000..f86d3cb --- /dev/null +++ b/pages/mallInfo/mallInfo.ttss @@ -0,0 +1,106 @@ + +page{ + background:linear-gradient(180deg,#FD832D 0%,#FE4A16 100%); +} +.codeBox{ + background:linear-gradient(180deg,#FD832D 0%,#FE4A16 100%); + height: 100%; + overflow: auto; +} +.none { + font-size: 24rpx; + text-align: center; + margin-top: 38rpx; + color: #FFFFFF; + float: none !important; +} + +.fl { + float: left; +} + +.fr { + float: right; +} + +.goback { + position: fixed; + right: 50rpx; + bottom: 60rpx; + width: 100rpx !important; + height: 100rpx; + z-index: 100; + background: rgba(255, 255, 255, 1); + line-height: 95rpx; + border: 1rpx solid rgba(227, 227, 227, 1); + border-radius: 50%; +} + +.goback image { + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} + +.code { + width: 690rpx; + background: #fff; + margin: 20rpx auto; + border-radius: 10rpx; + padding-top: 20rpx; + padding-bottom: 20rpx; +} +.code image{ + display:block; + margin: auto ; +} +.info{ + width: 650rpx; + background: #fff; + margin: 20rpx auto; + border-radius: 10rpx; + padding: 20rpx; +} +.title{ + margin: 20rpx 0; + text-align: center; + font-size: 50rpx; +} +.phone{ + overflow: hidden; +} +.phone,.park,.introduction{ + font-size: 30rpx; + line-height:40rpx; + margin: 20rpx 0; +} +.time{ + margin: 20rpx 0; + font-size: 30rpx; + display: flex; +} +.timesBox{ + display: flex; + flex-direction: column; +} +.times{ + margin-left: 10rpx; +} +.times text{ + line-height: 40rpx; +} +.park > text:nth-child(2) ,.phone > text:nth-child(2){ + margin-left: 10rpx; +} +.tel { + margin: 10rpx 10rpx 0 10rpx; + width: 30rpx; + height: 30rpx; +} +.phoneNum{ + color:#FD832D; +} \ No newline at end of file diff --git a/pages/order/detail/index.js b/pages/order/detail/index.js new file mode 100644 index 0000000..39ff45e --- /dev/null +++ b/pages/order/detail/index.js @@ -0,0 +1,501 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +let config = require("../../../config/config.js"); +let util = require("../../../utils/util"); +let Http = require("../../../utils/HttpBasics"); +let app = getApp(); +const imgurl = require("../../../utils/imgurl"); +Page({ + /** + * 页面的初始数据 + */ + data: { + showFlag: false, + navigationBarHeight, + succUrl: imgurl.succ.url, + spcodeUrl: imgurl.spcode.url, + chevronUrl: imgurl.chevron.url, + teljpgUrl: imgurl.teljpg.url, + newUrl: imgurl.new1.url, + weixinTitle: imgurl.weixinTitle.url, + showModalStatus: false, + flag: 0, + order: null, + orderId: null, + //存储计时器 + setInter: "", + mystatus: '', + staticGamedata: {}, + showIf: false, + showPage: false, + showButton: false, + cardDetail: null, + supportTransfer: '', + cardIf: false, + contentType: 0, + orderFlag: false, //判断是不是线上配送 + }, + copeCode(e) { + let code = e.currentTarget.dataset.text + tt.setClipboardData({ + data: code, + success: function() { + tt.showToast({ + title: '复制成功', + icon: "none" + }) + } + }) + }, + gokuaidi(e) { + let nu = e.currentTarget.dataset.nu + tt.navigateToMiniProgram({ + appId: 'wx6885acbedba59c14', + path: `pages/result/result?nu=${nu}&com=&querysource=third_xcx` + }) + }, + + setShow() { + this.setData({ + showFlag: true + }) + }, + hieShow() { + this.setData({ + showFlag: false + }) + }, + //刷新订单 + updetail() { + let that = this + let url = config.api.orderDetail + + Http.get({ + url: url, + data: { + orderId: this.data.orderId + } + }).then(res => { + tt.hideLoading(); + var createDate = util.formatTime(res.data.orders[0].createDate, "yyyy-MM-dd hh:mm:ss"); + let tempData = res.data.orders[0] + tempData.deliveryInfo = tempData.deliveryInfo ? JSON.parse(tempData.deliveryInfo) : "" + that.setData({ + order: tempData, + showPage: true, + createDate: createDate, + composeOrderType: tempData.composeOrderType, + contentType: tempData.contentType?tempData.contentType:0, + orderFlag: tempData.type==11? true:false //判断是不是线上配送 + }) + }) + .catch(error => { + tt.hideLoading(); + tt.showModal({ + title: '提示', + content: error.errMsg, + showCancel: false + }) + }) + }, + //确认收货 + verify() { + Http.post({ + url: config.api.verify, + data: { + couponOrderId: this.data.order.couponOrderId + } + }).then(res => { + tt.showToast({ + title: '签收成功', + icon: "none" + }) + this.updetail() + }).catch(err => { + tt.showModal({ + title: '提示', + content: err.message ? err.message : err.data, + showCancel: false + }) + }) + }, + phone: function(e) { + let that = this; + console.log(e); + tt.makePhoneCall({ + phoneNumber: e.currentTarget.dataset.merchantlinkphone + }); + }, + /** + * 跳转到门店列表的详情页面 + */ + gotoDetail(e) { + tt.navigateTo({ + url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}` + }) + }, + getUserInfo: function() { + let that = this; + // 获取用户信息 + Http.get({ + url: config.api.getScore, + data: {} + }) + .then(res => { + console.log(res) + that.setData({ + userName: res.data.nickName, + avatarUrl: res.data.avatarUrl + }) + }) + }, + onShareAppMessage: function(res) { + app.globalData.previewFlag = true + if (res.from === 'button') { + console.log(res, 3333333333333333333333) + // 来自页面内转发按钮 + let _this = this; + return { + title: _this.data.userName + '赠送您一张' + _this.data.order.title, + path: '/pages/index/index?couponChannelId=' + this.data.order.couponChannelId + '&cuserId=' + this.data.order.cuserId + '&couponId=' + this.data.order.productId + '&coverImg=' + this.data.order.coverImg + '&userName=' + this.data.userName + '&avatarUrl=' + this.data.avatarUrl + '&couponOrderId=' + this.data.order.couponOrderId + '&updateDate=' + this.data.order.updateDate, + imageUrl: this.data.order.coverImg, + success: function(res) { + // 转发成功 + }, + fail: function(res) { + // 转发失败 + } + } + } else { + console.log(res, 444444444444444444) + } + }, + + + powerDrawer: function(e) { + let that = this; + console.log(e) + // couponOrderStatus + // 0 未使用 + // 1 已使用 + // 2 已过期 + // 3 已经退款 + if (that.data.mystatus == "" || that.data.mystatus == undefined) { + tt.navigateTo({ + url: `/pages/orderquanma/index?quancode=${ + e.currentTarget.dataset.quancode + }&title=${e.currentTarget.dataset.title}&subtitle=${ + e.currentTarget.dataset.subtitle + }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ + e.currentTarget.dataset.couponorderstatus}&validstatus=${e.currentTarget.dataset.validstatus} + &contentType=${that.data.contentType}` + }); + } else { + tt.navigateTo({ + url: `/pages/orderquanma/index?quancode=${ + e.currentTarget.dataset.quancode + }&title=${e.currentTarget.dataset.title}&subtitle=${ + e.currentTarget.dataset.subtitle + }&remark=${e.currentTarget.dataset.remark}&couponorderstatus=${ + that.data.mystatus}&validstatus=${e.currentTarget.dataset.validstatus} + &contentType=${that.data.contentType}` + }); + } + }, + gotogame: function() { + let that = this; + tt.redirectTo({ + url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + }) + }, + // 买完卡跳转到立即使用页面 + gotoUse: function() { + tt.navigateTo({ + url: '/pages/cardorder/index/index' + }) + }, + // 获取游戏 + getStaticGame(token) { + let _this = this; + Http.get({ + url: config.api.getGame, + data: { + triggleAction: 3 // 购买触发 + } + }).then(res => { + if (res.data.id) { + _this.setData({ + showIf: true + }) + } + _this.setData({ + staticGamedata: res.data + }) + }) + .catch(err => { + console.log(err); + }) + }, + + + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + + let that = this; + // if (options.dingdan && options.dingdan == "order") { + + // } + that.setData({ + orderId: options.orderId, + + }); + tt.hideShareMenu() + if (options.cardIf) {//转赠 展示不需 + that.setData({ + cardIf: true + }) + } + tt.showLoading({ + title: "加载中" + }); + + that.updetail() + + }, + onShow: function() { + let that = this; + that.setData({ + showButton: false + }) + }, + /** + * 去拼团 + */ + goToOrderGroup(orderId, orderGroupId, _this) { + let that = this; + // 支付成功 + Http.post({ + url: config.api.toOrderGroup, + data: { + id: orderGroupId, + orderId, + couponId: _this.data.order.productId + } + }) + .then(res => { + tt.redirectTo({ + url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.order.productId}&orderGroupId=${res.data.orderGroupId}` + }); + }) + .catch(err => { + console.log(err); + }) + // return; + }, + /** + * 发起支付 + */ + orderFunc(e) { + var that = this; + that.setData({ + showButton: true + }) + tt.showLoading({ + title: "加载中..." + }); + + const orderId = "" + that.data.orderId; + if (that.data.order.payment > 0) { + // 支付金额不为0 + Http.post({ + url: config.api.payOrderCreate, + data: { + orderId: orderId, + composeOrderType: that.data.composeOrderType + } + }).then(res => { + var payOrderId = "" + res.data.outOrderNo; + tt.hideLoading(); + tt.pay({ + service: 5, + orderInfo: { + order_id: res.data.orderId, + order_token: res.data.token, + }, + success: res => { + tt.showLoading({ + title: '订单正在处理中...', + }) + if (res.code == 0) { + setTimeout(function () { + tt.hideLoading() + }, 5000) + that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that); // 支付成功 + if (res.errMsg == "requestPayment:ok") { + if (that.data.order.type == 100) { + tt.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else if (that.data.order.type != 5) { + tt.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + } + }else if (res.code === 1) { + that.setData({ + showButton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付超时', // 内容 + icon: "none" + }); + + } else if (res.code === 2) { + that.setData({ + showButton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付失败', // 内容 + icon: "none" + }); + + } else if (res.code === 3) { + that.setData({ + showButton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付关闭', // 内容 + icon: "none" + }); + } else if (res.code === 4) { + that.setData({ + showButton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '支付取消', // 内容 + icon: "none" + }); + } else if (res.code === 9) { + that.setData({ + showButton: false + }) + tt.hideLoading(); + tt.showToast({ + title: '订单状态开发者自行获取', // 内容 + icon: "none" + }); + } + }, + fail: res => { + that.setData({ + showButton: false + }) + that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that); + return; + }, + }); + }).catch(err => { + tt.hideLoading(); + that.setData({ + showButton: false + }) + tt.showModal({ + title: "抱歉", + content: err.message, + showCancel: false + }) + }); + } else { + // 免费券 + that.payOrderUpdate(orderId, "0", 1, '', 'free') // 支付成功 + if (that.data.order.type == 100) { + tt.setStorage({ + key: 'couponNum2', + data: "couponNum2" + }) + } else if (that.data.order.type != "5") { + tt.setStorage({ + key: 'couponNum', + data: "couponNum" + }) + } + tt.showToast({ + title: "支付成功", + duration: 2000, + image: imgurl.success.url, + }); + } + }, + /** + * 支付订单更新 + */ + payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => { + // 支付成功 + Http.post({ + url: config.api.payOrderUpdate, + data: { + payOrderId: payOrderId, + composeOrderId: orderId, + status: status, + reason: reason + } + }) + .then(res => { + tt.hideLoading(); + _this.setData({ + showButton: false + }) + if (!type && type != 'free') { + tt.showToast({ + title: "购买成功", + duration: 2000, + image: imgurl.success.url, + mask: false, + success: function() { + tt.showLoading({ + title: "加载中..." + }); + setTimeout(function() { + tt.hideLoading(); + }, 1600); + setTimeout(() => { + let url = "" + if (_this.data.orderFlag) { + tt.redirectTo({ + url: `/pages/order/detail/index?orderId=${orderId}&dingdan=order` + }); + } else { + tt.redirectTo({ + url: `/pages/order/detail/index?orderId=${orderId}` + }); + } + + }, 1600); + } + }); + } else if (type == 'free') { + tt.redirectTo({ + url: `/pages/order/detail/index?orderId=${orderId}` + }); + } + }) + .catch(err => { + console.log(err) + if (!type) { + setTimeout(function() { + _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this); + }, 1500) + } + }); + }, +}); \ No newline at end of file diff --git a/pages/order/detail/index.json b/pages/order/detail/index.json new file mode 100644 index 0000000..616741a --- /dev/null +++ b/pages/order/detail/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "navbar": "../../../components/navbar/navbar", + "store": "../../../components/store/index" + } + } \ No newline at end of file diff --git a/pages/order/detail/index.ttml b/pages/order/detail/index.ttml new file mode 100644 index 0000000..be7e184 --- /dev/null +++ b/pages/order/detail/index.ttml @@ -0,0 +1,134 @@ + + + + + + + 交易成功 + + + + 付款成功 + + + + + + {{order.title}} + + + + + + {{order.subTitle}} + + + 下单时间:{{createDate}} + + + + + + + + + 兑换码: + {{order.couponOrderId}} + + + + + + + + + 订单编号: + {{order.orderNumber}} + + + 物流状态: + {{(order.shippingStatus==10||order.shippingStatus==14)?"待自提":order.shippingStatus==15?"已自提":order.shippingStatus==20?"待发货":order.shippingStatus==24?"待收货":order.shippingStatus==25?"已收货":""}} + + + 物流公司: + {{order.deliveryInfo.courierInput}} + + + 快递单号: + + {{order.deliveryInfo.expressageIdInput}} + + 复制 + 查询物流 + + + + + 实付金额: + + ¥ + {{order.payment/100}} + + + + + + + + 礼券: + + + + + + {{item.title}} + 面额:{{item.priceStr}}元 + + + + + + + + + + + + + + + 签收 + + + + 是否确认收到商品? + 签收后将完成订单 + + 确认签收 + 取消 + + + \ No newline at end of file diff --git a/pages/order/detail/index.ttss b/pages/order/detail/index.ttss new file mode 100644 index 0000000..209efbd --- /dev/null +++ b/pages/order/detail/index.ttss @@ -0,0 +1,708 @@ +@import "../../../app.ttss"; + +button::after { + border: none; +} + +page { + height: auto !important; + background: #f4f5f9; +} + +.order { + width: 100%; + padding-bottom: 160rpx; +} + +.success { + vertical-align: middle; + width: 40rpx; + margin-right: 10rpx; + float: left; +} + +.tips { + width: 92%; + height: 70rpx; + background: #2c8dff; + color: #fff; + padding: 20rpx 4% 0; +} + +.merchantName { + color: #3c3c3c !important; + /* margin-left: 160rpx; */ + font-size: 28rpx; + float: left; + margin-left: 30rpx; + height: 100%; + line-height: 90rpx; +} + +.tips view:nth-child(2) { + font-size: 32rpx; + padding-left: 16rpx; + width: 100%; +} + +.tips view:nth-child(1) { + width: 100%; + height: 32rpx; + background: #fff; + border-radius: 50%; + color: #00c0ff; + text-align: center; + font-size: 28rpx; +} + +.msg text:nth-child(1) { + width: 90%; + font-size: 28rpx; + float: left; +} + +.msg text:nth-child(2) { + font-size: 24rpx; + float: left; + margin-left: 35rpx; +} + +.section { + /* margin-top: 2%; */ + background: #fff; +} + +.detail_msg { + width: 92%; + display: flex; + margin: 0 4%; + margin-top: 10rpx; + padding-bottom: 42rpx; + border-bottom: 1rpx solid #eee; +} + +.logo { + display: block; + width: 120rpx; + height: 120rpx; + border-radius: 16rpx; +} + +.logo image { + width: 120rpx; + height: 120rpx; + border-radius: 16rpx; +} + +.sectionTit { + padding-top: 30rpx; + width: 92%; + margin: 0 4%; + font-size: 30rpx; + color: #3c3c3c; +} + +.info view:nth-child(1) { + padding: 0 4%; + width: 80%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.info { + width: 100%; +} + +.info view:nth-child(1) text { + font-size: 30rpx; + color: #000; + letter-spacing: 0; +} + +.info view:nth-child(1) text:nth-child(2) { + color: #ffae00; + font-size: 24rpx; +} + +.info view:nth-child(2), .info view:nth-child(3) { + font-size: 24rpx; + padding-left: 4%; + color: #919191; + letter-spacing: 0; +} + +.info view:nth-child(2) text, .info view:nth-child(3) text { + font-size: 22rpx; + color: #b8b8b8; +} + +.payment { + width: 92%; + height: 120rpx; + line-height: 120rpx; + padding: 0 4%; + display: flex; + justify-content: space-between; + border-bottom: 20rpx solid #ededed; +} + +.payment view:nth-child(2) text:nth-child(1) { + font-size: 36rpx; + color: #ff3434; + font-weight: bold; +} + +.payment view:nth-child(2) text:nth-child(2) { + font-size: 24rpx; + color: #b4b4b4; + padding-left: 18rpx; + text-decoration: line-through; +} + +.dhCode { + position: relative; + height: 96rpx; + line-height: 96rpx; + border-bottom: 1rpx solid #f4f5f9; + padding-left: 5%; + padding-right: 5%; +} + +.classif { + background: #fff; + width: 100%; + margin-top: 20rpx; +} + +.wuliu { + height: 96rpx; + line-height: 96rpx; + border-bottom: 1rpx solid #f4f5f9; + padding-left: 5%; + padding-right: 5%; + overflow: hidden; +} + +.left { + float: left; +} + +.sign { + width: 160rpx; + height: 60rpx; + line-height: 60rpx; + text-align: center; + background-color: #00c0ff; + color: #fff; + border-radius: 12rpx; + margin: 40rpx auto; + padding: 12rpx 20rpx; + font-size: 28rpx; +} + +.left { + float: left; + font-size: 26rpx; + color: #a6a6a6; +} + +.copeCode { + float: left; + margin: 20rpx 10rpx; + padding: 10rpx; + height: 30rpx; + line-height: 30rpx; + border-radius: 8rpx; + color: #df3502; + border:1rpx #a6a6a6 solid; + font-size: 28rpx; + +} + +.goInquire { + float: left; + margin: 20rpx 10rpx; + padding: 10rpx; + height: 30rpx; + line-height: 30rpx; + border:1rpx #a6a6a6 solid; + border-radius: 8rpx; + color: #3cc51f; + font-size: 28rpx; + +} + +/* +.classifShop{ + background: #FFFFFF; + width: 100%; + margin-top: 20rpx; + padding-bottom: 20rpx; +} +.classifShop >view{ + font-size: 28rpx; + color: #A6A6A6; + position: relative; + display: flex; + justify-content: space-between; + padding-left: 5%; + padding-right: 5%; + margin-bottom: 20rpx; +} +.classifShop >view:nth-child(1){ + height: 88rpx!important; + line-height:94rpx; +} */ + +.classif > view:nth-child(2), .classif > view:nth-child(3) { + position: relative; + height: 94rpx; + line-height: 94rpx; + display: flex; + justify-content: space-between; + padding-left: 5%; + padding-right: 5%; + /* border-bottom: 1rpx solid #eee; */ +} + +.classif > view text:nth-child(2) { + font-size: 28rpx; + /* color: #3c3c3c; */ +} + +.classif > view text:nth-child(1) { + font-size: 28rpx; + color: #a6a6a6; + float: left; +} + +.classif > view:nth-child(1) { + display: block; +} + +.classif > view:nth-child(6) text:nth-child(2) { + color: #666; +} + +.spcode { + position: absolute; + right: 70rpx; + bottom: 0; + top: 0; + margin: auto; + width: 50rpx; + z-index: 1; +} + +.rArrow { + position: absolute; + right: 26rpx; + height: 20rpx; + width: 20rpx; + margin: auto; + bottom: 30rpx; +} + +/*mask*/ + +.drawer_screen { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 1000; + background: #000; + opacity: 0.5; + overflow: hidden; +} + +.drawer_box { + width: 650rpx; + position: fixed; + overflow: hidden; + top: 50%; + left: 0; + z-index: 1001; + margin: -150px 50rpx 0 50rpx; + border-radius: 3px; +} + +.drawer_title { + padding: 15px; + font: 20px "microsoft yahei"; + text-align: center; +} + +.drawer_content { + height: 210px; + overflow-y: scroll; /*超出父盒子高度可滚动*/ +} + +.btn_ok { + padding: 10px; + font: 20px "microsoft yahei"; + text-align: center; + border-top: 1px solid #e8e8ea; + color: #3cc51f; +} + +.top { + padding-top: 8px; +} + +.bottom { + padding-bottom: 8px; +} + +.title { + height: 30px; + line-height: 30px; + width: 160rpx; + text-align: center; + display: inline-block; + font: 300 28rpx/30px "microsoft yahei"; +} + +.input_base { + border: 2rpx solid #ccc; + padding-left: 10rpx; + margin-right: 50rpx; +} + +.input_h30 { + height: 30px; + line-height: 30px; +} + +.input_h60 { + height: 60px; +} + +.input_view { + font: 12px "microsoft yahei"; + background: #fff; + color: #000; + line-height: 30px; +} + +input { + font: 12px "microsoft yahei"; + background: #fff; + color: #000; +} + +radio { + margin-right: 20px; +} + +.grid { + display: -webkit-box; + display: box; +} + +.col-0 { + -webkit-box-flex: 0; + box-flex: 0; +} + +.col-1 { + -webkit-box-flex: 1; + box-flex: 1; +} + +.fl { + float: left; + color: #3c3c3c !important; +} + +.fr { + float: left; +} + +.clearfix:after { + content: "."; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +.panel { + width: 600rpx; + border-radius: 10rpx; + background-color: #fff; + margin: 30rpx auto 0; + padding: 30rpx 0; + position: relative; + z-index: 10000000000; +} + +.pane2 { + background: #fff; + opacity: 0.6; +} + +.pane2 image { + width: 500rpx; + display: block; + margin: 40rpx auto 0; +} + +.barcode { + height: 100rpx; + width: 500rpx; + margin: 0 auto; +} + +.barnum { + width: 88%; + height: 46rpx; + line-height: 46rpx; + font-size: 32rpx; + text-align: center; + letter-spacing: 2rpx; + white-space: nowrap; + color: #999; +} + +.barnum text { + color: #333; +} + +.barcode > canvas { + width: 500rpx; + height: 100rpx; +} + +.qrcode { + height: 340rpx; + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: center; +} + +.qrcode > canvas { + width: 350rpx; + height: 350rpx; +} + +.left { + float: left; +} + +.right { + float: right; +} + +.RMB { + color: #fd782d !important; + font-size: 24rpx !important; + float: right; +} + +.jine { + color: #fd782d !important; + font-size: 36rpx !important; + font-weight: 400 !important; + float: right; + margin-left: 10rpx; +} + +.jine1 { + color: #b8b8b8 !important; + font-size: 30rpx !important; + font-weight: 400 !important; +} + +.buy-view { + /* background: #fff; */ + position: fixed; + padding-top: 30rpx; + height: 94rpx; + bottom: 0; + left: 0; + right: 0; + z-index: 100; + padding-bottom: 30rpx; +} + +.buy { + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%); + height: 94rpx; + width: 670rpx; + margin: 0 auto; + color: #fff; + font-size: 32rpx; + line-height: 94rpx; + border-radius: 61rpx; +} + +.active { + opacity: 0.6; +} + +.game-entry { + width: 690rpx; + height: 140rpx; + margin: 20rpx auto 0; +} + +.gameimg { + display: block; + width: 100%; + height: 140rpx; +} + +/* +.merchantVoList { + width: 100%; +} + +.merchantVoList .tel { + width: 50rpx; + height: 50rpx; + float: right; + z-index: 10; + margin-top: 30rpx; +} */ + +.btns { + background: #00c0ff; + height: 94rpx; + width: 670rpx; + margin: 0 auto 30rpx; + color: #fff; + font-size: 36rpx; + line-height: 94rpx; + border-radius: 61rpx; +} + +/* .merchantImgUrl{ + width: 90rpx; + float: left; + border-radius: 10rpx; + z-index: 10; + margin: 0 auto; +} */ + +.support-tansfer { + width: 690rpx; + border-radius: 50rpx; + margin-top: 60rpx; + background: linear-gradient(127deg, rgba(252, 177, 74, 1) 0%, rgba(254, 70, 20, 1) 100%) !important; +} + +.share { + width: 40rpx; + height: 40rpx; + margin-right: 20rpx; +} + +.showT { + width: 100%; + height: 100vh; + background-color: rgba(0, 0, 0, 0.1); + position: fixed; + top: 0; + left: 0; + overflow: hidden; +} + +.titleBxo { + width: 70%; + margin: 300rpx auto; + background-color: #fff; + border-radius: 12rpx; + overflow: hidden; +} + +.titleBxo .text { + margin: 40rpx auto 20rpx auto; + text-align: center; + font-size: 36rpx; +} + +.titleBxo .p { + margin-top: 10rpx auto 30rpx auto; + font-size: 22rpx; + text-align: center; +} + +.btnBox { + overflow: hidden; + margin-top: 40rpx; + margin-bottom: 20rpx; + display: flex; + justify-content: space-around; +} + +.le { + width: 40%; + height: 60rpx; + line-height: 60rpx; + border-radius: 10rpx; + background-color: #00c0ff; + text-align: center; + color: #fff; +} + +.ri { + width: 40%; + height: 60rpx; + line-height: 60rpx; + border-radius: 10rpx; + text-align: center; + border: 1rpx solid #919191; +} + +.childList { + padding-left: 5%; + padding-right: 5%; + overflow: hidden; +} + +.childTitle { + font-size: 28rpx; + color: #a6a6a6; + margin-top: 20rpx; +} + +.childItme { + border-radius: 12rpx; + overflow: hidden; + background-color: #fff; + margin: 20rpx; +} + +.orderName { + margin: 20rpx; + font-size: 26rpx; +} + +.chaildDetBox { + margin: 20rpx; + overflow: hidden; +} + +.chaildImg { + float: left; + width: 100rpx; + height: 100rpx; + border-radius: 10rpx; +} + +.childDataBox { + float: left; + width: 50%; + margin-left: 20rpx; +} + +.childPriceStr { + font-size: 24rpx; + color: #919191; + letter-spacing: 0; + margin-left: 20rpx; +} diff --git a/pages/order/index/index.js b/pages/order/index/index.js new file mode 100644 index 0000000..7ef7309 --- /dev/null +++ b/pages/order/index/index.js @@ -0,0 +1,299 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +let config = require("../../../config/config.js"); +let Http = require("../../../utils/HttpBasics"); +const util = require("../../../utils/util"); +let app = getApp(); +const imgurl = require("../../../utils/imgurl"); +Page({ + data: { + showBox: false,//显示授权手机框 + phFlag:false,//是否授权手机号 + navigationBarHeight, + noOrdersUrl: imgurl.noOrders.url, + loadingUrl: imgurl.loading.url, + wmhome: imgurl.wmhome.url, + wmdiscount: imgurl.wmdiscount.url, + wmgive: imgurl.wmgive.url, + boatFlag: "all", + tabs: [{ + key: "all", + name: "全部" + }, + { + key: 0, + name: "待付款" + }, + { + key: 1, + name: "已完成" + } + ], + list: [], + current: "", + loading: true, //"上拉加载"的变量,默认false,隐藏 + current_scroll: "1", + allow_load: true, + page: 1, + content: "", + }, + + setPhone(paramData) {//子组件调用这个方法说明手机号已经授权成功 + this.setData({ + showBox: paramData.detail, + phFlag:true + }) + this.getList('all', 1) + tt.showToast({ + title: '授权成功', // 内容 + icon: 'none', // 图标 + success: (res) => { + }, + fail: (res) => { + + }, + }); + }, + + setBox(paramData) { + this.setData({ + showBox: paramData.detail, + phFlag:false + }) + tt.showToast({ + title: '取消授权', // 内容 + icon: 'none', // 图标 + success: (res) => { + + }, + fail: (res) => { + + }, + }); + }, + + goback: function () { + tt.reLaunch({ + url: '/index/index', + }) + }, + onLoad(e) { + + + // this.getList(e.id, 1); + this.setData({ + current_scroll: e.id + }); + }, + onShow() { + + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + this.setData({ + showBox: false, + phFlag:true, + }) + this.getList('all', 1) + }).catch(err => { + this.setData({ + showBox: true, + phFlag: false, + }) + // tt.navigateTo({ + // url: '/pages/getPhone/getPhone', + // }); + }) + + + + + }, + /** + * 砍价中的状态 + * 跳转到砍价详情页面 + */ + gotoDiscount: function (e) { + tt.navigateTo({ + url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${e.currentTarget.dataset.id}` + }) + }, + gotopay: function (e) { + let level = e.currentTarget.dataset.level + if (level == 0) { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&flag='pay'` + }) + } else { + tt.navigateTo({ + url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&dingdan=order&flag='pay'` + }) + } + + + }, + //再次购买 + gotopayAgain: function (e) { + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.couponchannelid + }&couponId=${e.currentTarget.dataset.couponid}` + }); + }, + // gotoSpellPay(e) { + // console.log(e, 333) + // let data = e.currentTarget.dataset.data + // tt.navigateTo({ + // url: `/pages/spellGroup/paySpellGroup/index?orderId=${data.orderId}&couponId=${data.couponId}&orderGroupId=${data.orderGroupId}&couponChannelId=${data.couponChannelId}`, + // }) + // }, + getList(key, pageNum) { + let that = this; + if (key == undefined) { + key = 'all' + } + /** + * key==0 + * 不发送该字段 + */ + if (key == 'all') { + var variable = { + pageNum: pageNum, + pageSize: 15, + paymentType: 0 + }; + } else { + var variable = { + pageNum: pageNum, + pageSize: 15, + orderStatus: key, + paymentType: 0 + }; + } + + if (that.data.allow_load) { + that.setData({ + loading: true, + content: '小主,我在玩命加载中...' + }) + + Http.get({ + url: config.api.orderList, + data: variable + }).then(res => { + if (pageNum >= res.data.pages) { + that.setData({ + allow_load: false + }); + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400); + } + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400); + if (pageNum == 1) { + that.setData({ + list: [] + }) + } + var tmpArr = that.data.list; + tmpArr.push.apply(tmpArr, res.data.list); + // 将砍价的状态过滤出来 + console.log(tmpArr) + tmpArr.map(item => { + + item.orders.map(itemChild => { + itemChild.createDate = util.formatTime(itemChild.createDate, "yyyy-MM-dd hh:mm:ss"); + }) + }) + + that.setData({ + list: tmpArr + }) + for (let i = 0; i < that.data.list.length; i++) { + var createDate1 = util.formatTime(that.data.list[i].createDate, "yyyy-MM-dd hh:mm:ss"); + /** + * 修改list的endtime + * 渲染到页面 + */ + var createDate = 'list[' + i + '].createDate' + that.setData({ + [createDate]: createDate1 + }); + } + }) + .catch(err => { + tt.showModal({ + title: '提示', + content: err.message ? err.message : err.data, + showCancel: false + }) + }) + } + else { + that.setData({ + loading: true, + content: "——— 再拉裤子就掉了啦 ———" + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400) + } + }, + handleChange({ + detail + }) { + this.setData({ + current: detail.key + }); + }, + + setBoatFlag(e) { + if (this.data.phFlag) { + let index = e.currentTarget.dataset.index + console.log(index); + this.setData({ + boatFlag: index, + pageNum: 1, + allow_load: true, + }) + this.getList(index, 1) + } else { + this.setData({ + showBox: true + }) + } + + }, + + + + handleChangeScroll({ + detail + }) { + this.setData({ + list: [], + allow_load: true, + current_scroll: detail.key, + page: 1 + }) + this.getList(detail.key, 1); + }, + onReachBottom: function () { + var that = this; + if (that.data.phFlag) { + that.data.page++; + that.setData({ + page: that.data.page + }); + that.getList(that.data.current_scroll, that.data.page); + } + + }, +}); \ No newline at end of file diff --git a/pages/order/index/index.json b/pages/order/index/index.json new file mode 100644 index 0000000..5468f95 --- /dev/null +++ b/pages/order/index/index.json @@ -0,0 +1,10 @@ +{ + "usingComponents": { + "i-tab": "../../../dist/tab/index", + "i-tabs": "../../../dist/tabs/index", + "navbar": "../../../components/navbar/navbar", + "phoen":"../../../components/getPhoen/getPhoen" + }, + "navigationBarTitleText": "我的订单", + "navigationBarBackgroundColor": "#F4F5F9" + } \ No newline at end of file diff --git a/pages/order/index/index.ttml b/pages/order/index/index.ttml new file mode 100644 index 0000000..b0d302c --- /dev/null +++ b/pages/order/index/index.ttml @@ -0,0 +1,110 @@ + + + + + + + + + {{item.name}} + + + + + + + + + + 订单id:{{item.id}} + + + + + + 等待付款 + 拼团中 + 待退款 + 交易关闭 + 砍价中 + 砍价成功 + 砍价失败 + 砍价取消 + 拼团已过期 + 拼团失败 + 砍价失败 + 已退款 + 退款失败 + 拼团成功 + 免费领取 + 积分兑换 + 付款成功 + + + + + + + + {{child.title}} + 价格: + {{(child.salePrice)/100}}元 x {{child.couponNumber}} + + 运费:{{child.freightPriceStr}} + 下单时间: + {{child.createDate}} + + + + 去查看 + + + 砍价详情 + + + 去支付 + + + 退款失败 + + + + + + + + + + 订单总金额: + {{item.payment/100}}元 + + + + + + + + + + + + + + + 您还没有相关订单 + 再忙,也要记得买点什么犒赏自己~ + + + + + {{content}} + + + + + \ No newline at end of file diff --git a/pages/order/index/index.ttss b/pages/order/index/index.ttss new file mode 100644 index 0000000..dbc31fe --- /dev/null +++ b/pages/order/index/index.ttss @@ -0,0 +1,434 @@ + +.boatBox{ + width: 100% !important; + height: 96rpx; + display: flex; + justify-content: space-around; + background-color: #fff; +} +.boatBoxf{ + width: 100% !important; + position: fixed; + top: 0; + left: 0; + z-index: 10000; +} +.boatTitle{ + font-size: 30rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + color: #999; +} +.boatTitleA{ + font-size: 32rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-weight: 500; + +} +.boatA{ + width: 80rpx; + height: 6rpx; + background-color: #fb3e5c; + margin: 0 auto; + border-radius: 10rpx; +} + + +.market { + width: 100%; + height: 100%; + background: #F4F5F9; + margin-top: 20rpx; +} +.tabs { + position: fixed; + width: 100% !important; + height: 96rpx; + /* top: 0; */ + left: 0; + right: 0; + text-align: center; + z-index: 10000000; + font-size: 26rpx; + background: #FFF; +} + +.i-tab { + width: 30% !important; + display: inline-block; +} +.section{ + background: #FFFFFF; + overflow: hidden; +} +.detail_msg { + position: relative; + width: 92%; + background: #fff; + display: flex; + margin: 0 30rpx; + padding-bottom: 20rpx; + padding-top: 20rpx; + /* border-bottom: 1rpx solid #eee; */ +} +.sendImg{ + position: absolute; + width: 100rpx; + top: 100rpx; + right: 6rpx; +} + +.logo { + display: block; + width: 120rpx; + height: 120rpx; + border: 1px solid #f8f8f8; + border-radius: 20rpx; +} + +.logo image { + display: block; + width: 120rpx; + height: 120rpx; + border-radius: 20rpx; +} +.detail_top{ + width: 100%; + height: 40rpx; + line-height: 40rpx; + font-size: 30rpx; + padding-top: 30rpx; +} +.detail_top view:nth-child(1) { + display: flex; + justify-content: space-between; + padding: 0 4% 0 4%; +} + +.info { + width: 100%; +} + +.sub { + font-size: 24rpx !important; + color: #919191 !important; + letter-spacing: 0; + line-height: 33rpx; + padding-left: 4%; + height: 33rpx; + overflow: hidden; + white-space: wrap; + text-overflow: ellipsis; +} + +.info view:nth-child(1) text { + display: inline-block; + width: 300rpx; + font-size: 30rpx; + letter-spacing: 0; + height: 42rpx; + overflow: hidden; + line-height: 42rpx; + white-space: nowrap; + text-overflow: ellipsis; +} +.discount{ + position: absolute; + width: 100rpx; + top:86rpx; + right:2rpx; +} + +.detail_top .sucess { + display: inline-block; + width: 123rpx !important; + /* overflow: hidden; */ + font-family:PingFangSC-Regular; + font-size: 28rpx; + font-weight:400; + color: #2C8DFF; + letter-spacing: 0; + text-align: right; + line-height: 26px; +} + +.wait { + display: inline-block; + width: 123rpx !important; + overflow: visible!important; + font-size: 28rpx; + color: #FD832D; + letter-spacing: 0; + text-align: right; + line-height: 28rpx!important; +} + +.close { + display: inline-block; + width: 123rpx !important; + overflow: hidden; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: right; + line-height: 28rpx; +} + +/* +.info view:nth-child(2), +.info view:nth-child(3), +.info view:nth-child(4) { + color: #333; + font-size: 24rpx; + +} */ + +.value { + font-size: 24rpx; + color: #999; + letter-spacing: 0; + padding-left: 4%; + line-height: 33rpx; +} + +.value text { + font-size: 24rpx; + color: #333; + letter-spacing: 0; + line-height: 33rpx; +} + +.info view:nth-child(3) { + margin-top: 16rpx; +} +.info view:nth-child(2) { + margin-top: 16rpx; +} +.payment { + position: relative; + width: 92%; + height: 80rpx; + line-height: 88rpx; + padding: 0 4%; + display: flex; + justify-content: space-between; + border-bottom: 8rpx solid #eee; + border-top: 1rpx solid #eee; + +} + +.payment view:nth-child(1) text:nth-child(1) { + font-size: 24rpx; + color: #1f2d3d; + letter-spacing: 0; +} + +.payment view:nth-child(1) text:nth-child(2) { + font-size: 28rpx; + color: #ff4949; + letter-spacing: 0; + margin-left: 10rpx; +} + +.payment view:nth-child(1) text:nth-child(3) { + font-size: 24rpx; + color: #b4b4b4; + padding-left: 18rpx; + text-decoration: line-through; +} + +.btn { + position: absolute; + bottom: 0; + right: 0; + width: 118rpx; + height: 52rpx; + line-height: 52rpx; + text-align: center; + color: #fff; + float: right; + font-size: 26rpx; + border-radius: 20rpx; + background:linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); +} +.btnZf{ + position: absolute; + bottom: 0; + right: 0; + width: 118rpx; + height: 52rpx; + line-height: 52rpx; + text-align: center; + color: #fff; + float: right; + font-size: 26rpx; + border-radius: 20rpx; + background:linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%); +} +.btnGm{ + position: absolute; + bottom: 0; + right: 0; + width: 118rpx; + height: 52rpx; + line-height: 52rpx; + text-align: center; + color: #fff; + float: right; + font-size: 28rpx; + border: 2rpx solid #2C8DFF; + border-radius: 30rpx; +} + +.payment view:nth-child(2) text { + font-size: 26rpx; + color: #FFFFFF; +} +.txGm{ + font-size: 26rpx!important; + color: #2C8DFF!important; +} +.dingdan { + margin-top: 33rpx; +} + +.dingdan text:nth-of-type(1) { + display: block; + font-size: 34rpx; + color: #333; + letter-spacing: 0; + text-align: center; +} + +.dingdan text:nth-of-type(2) { + display: block; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: center; +} + +.dingdan image { + display: block; + width: 300rpx; + height: 300rpx; + margin: 0 auto 16rpx; +} + +.loading { + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #999; +} + +.loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; +} +button::after{ border: none; } +.goback{ + position: fixed; + right: 50rpx; + bottom: 60rpx; + width:100rpx!important; + height:100rpx; + z-index: 100; + background:rgba(255,255,255,1); + line-height: 95rpx; + border:1rpx solid rgba(227,227,227,1); + border-radius:50%; +} +.goback image{ + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} +.itemBox{ + overflow: hidden; + margin: 0 60rpx 20rpx 60rpx; + padding-bottom: 20rpx; + position: relative; +} +.payStatus{ + text-align: right; +} +.payStatus .sucess { + display: inline-block; + width: 123rpx !important; + /* overflow: hidden; */ + font-family:PingFangSC-Regular; + font-size: 28rpx; + font-weight:400; + color: #2C8DFF; + letter-spacing: 0; + text-align: right; + line-height: 26px; +} +.itemImg{ + float: left; + display: block; + width: 120rpx; + height: 120rpx; + border: 1px solid #f8f8f8; + border-radius: 20rpx; +} +.itemImg image { + display: block; + width: 120rpx; + height: 120rpx; + border-radius: 20rpx; +} +.itemContent{ + float: left; + width: 70%; +} +.face{ + font-size: 24rpx; + color: #999; + letter-spacing: 0; + padding-left: 4%; + line-height: 33rpx; +} +.face text{ + font-size: 24rpx; + color: #333; + letter-spacing: 0; + line-height: 33rpx; + +} +.date{ + /* margin-top: 16rpx; */ + font-size: 24rpx; + color: #999; + letter-spacing: 0; + padding-left: 4%; + line-height: 26rpx; + +} +.yunfe{ + font-size: 24rpx; + color: #999; + letter-spacing: 0; + padding-left: 4%; + height: 33rpx; + line-height: 33rpx; +} +.yunfeK{ + font-size: 24rpx; + color: #999; + letter-spacing: 0; + padding-left: 4%; + height: 25rpx; + line-height: 33rpx; +} \ No newline at end of file diff --git a/pages/orderquanma/index.js b/pages/orderquanma/index.js new file mode 100644 index 0000000..278f818 --- /dev/null +++ b/pages/orderquanma/index.js @@ -0,0 +1,236 @@ +// let util = require("../../utils/util"); +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +let Http = require("../../utils/HttpBasics"); +let config = require("../../config/config.js"); +let app = getApp(); +const imgurl = require("../../utils/imgurl"); +const QR = require("../../utils/memberqrcode.js"); +Page({ + data: { + navigationBarHeight, + btomLineUrl: imgurl.btomLine.url, + topLineUrl: imgurl.topLine.url, + lineUrl: imgurl.line.url, + wm01Url: imgurl.wm01.url, + wm02Url: imgurl.wm02.url, + wm03Url: imgurl.wm03.url, + wm04Url: imgurl.wm04.url, + upDataRqUrl: imgurl.upDataRq.url, + upDataRqUrlF: imgurl.upDataRqF.url, + code: "", + //存储计时器 + setInter: "", + staticGamedata: {}, + showIf: false, + curHtml: '', + contentType: 0, + showhieRq: false, + dynamicRq: "", + expiredSeconds: 0, + templTiem: "" + }, + gotogame: function () { + let that = this; + tt.navigateTo({ + url: '/pages/game/index?url=' + that.data.staticGamedata.url + "&id=" + that.data.staticGamedata.id + "&gameId=" + that.data.staticGamedata.gameId, + }) + }, + // 获取游戏 + getStaticGame(token) { + let _this = this; + Http.get({ + url: config.api.getGame, + data: { + triggleAction: 4 // 核销触发 + } + }).then(res => { + if (res.data.id) { + _this.setData({ + showIf: true + }) + } + _this.setData({ + staticGamedata: res.data + }) + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + + setRq() { + let _this = this + _this.setData({ + showhieRq: false, + }) + Http.get({//获取动态二维码 + url: config.api.dynamicId, + data: { + couponOrderId: _this.data.code + } + }).then(res => { + console.log(res, "res") + _this.setData({ + dynamicRq: res.data.dynamicId, + expiredSeconds: res.data.expiredSeconds + }) + + let url = JSON.stringify({ + END: "C", + TYPE: "couponorder", + ID: _this.data.dynamicRq + }) + + let inre = setInterval(() => { + if (_this.data.expiredSeconds > 1) { + _this.setData({ + expiredSeconds: _this.data.expiredSeconds - 1 + }) + console.log("有效", _this.data.expiredSeconds) + } else { + console.log("无效", _this.data.expiredSeconds) + clearInterval(_this.data.templTiem) + _this.setData({ + showhieRq: true + }) + } + }, 1000) + _this.setData({ + templTiem: inre + }) + // util.qrcode("qrcode", url, 350, 350); + _this.createQrCode(url, "qrcode", 350, 350); + }).catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + + onLoad: function (options) { //quancode + console.log(options) + console.log(app.globalData.curHtml) + let that = this; + // let value = JSON.stringify({ END: "C", TYPE: "couponorder", ID: options.quancode}) + // that.createQrCode(value, "qrcode", 350, 350); + that.setData({ + code: options.quancode, + title: options.title, + subtitle: options.subtitle, + remark: options.remark, + couponorderstatus: options.couponorderstatus, + validStatus: options.validstatus, + contentType: options.contentType + }); + if (options.couponorderstatus==0){ + that.setRq()//动态获取二维码 这个方法必须在拿到 options.quancode 后调用 + } + + if (options.contentType != undefined && options.contentType==1) { + this.setData({ + curHtml: app.globalData.curHtml + }) + } + /** + * 如果没有核销 + */ + that.data.setInter = setInterval(function () { + if (that.data.couponorderstatus == 0) { + Http.get({ + url: config.api.getStatus, + data: { + couponOrderId: options.quancode + } + }).then(res => { + console.log(res); + that.setData({ + couponorderstatus: res.data.CouponOrderStatus + }); + if (res.data.CouponOrderStatus == 1) { + /** + * 动态改变上一级页面的核销状态 + */ + that.getStaticGame() + var pages = getCurrentPages(); + var prevPage = pages[pages.length - 2]; //上一个页面 + //直接调用上一个页面的setData()方法,把数据存到上一个页面中去 + prevPage.setData({ + mystatus: res.data.CouponOrderStatus + }); + } + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }, 2000); + + if (that.data.couponorderstatus == 1) { + /** + * 如果已经核销 + * 不需要循环 + */ + Http.get({ + url: config.api.getStatus, + data: { + couponOrderId: options.quancode + } + }).then(res => { + that.setData({ + couponorderstatus: res.data.CouponOrderStatus + }); + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + /** + * couponorderstatus + * 0 没有核销 + * 1 已经核销成功 + */ + }, + createQrCode: function (url, canvasId, cavW, cavH) { + //调用插件中的draw方法,绘制二维码图片 + let that = this; + QR.api.draw(url, canvasId, cavW, cavH, function (res) { + that.setData({ + tempFilePath: res + }) + }); + }, + onUnload: function () { + let that = this; + clearInterval(that.data.setInter); + clearInterval(that.data.templTiem); + }, + onHide: function () { + let that = this; + clearInterval(that.data.setInter); + clearInterval(that.data.templTiem); + }, + // onHide:function(){ + // console.log(app.globalData.sight) + // tt.setScreenBrightness({ + // value: app.globalData.sight, + // }) + // } +}); diff --git a/pages/orderquanma/index.json b/pages/orderquanma/index.json new file mode 100644 index 0000000..f42c7a6 --- /dev/null +++ b/pages/orderquanma/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/orderquanma/index.ttml b/pages/orderquanma/index.ttml new file mode 100644 index 0000000..7b96f1f --- /dev/null +++ b/pages/orderquanma/index.ttml @@ -0,0 +1,62 @@ + + + + + {{title}} + + + + + + + + + + + + + + + + + + 点一点刷新二维码 + + 二维码在 + {{expiredSeconds}}s + 后失效 + + 兑换码:{{code}} + + + + + + + + + + {{data.remark}} + + + + + + + + + + 用户专享神秘礼物 + 独家福利,抢完即止 + + + diff --git a/pages/orderquanma/index.ttss b/pages/orderquanma/index.ttss new file mode 100644 index 0000000..fab3a01 --- /dev/null +++ b/pages/orderquanma/index.ttss @@ -0,0 +1,265 @@ +@import "../../app.ttss"; + +.couponBox{ + height: 100%; + margin-top: 20rpx; + background:linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%); +} +page { + background: linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%); + height: auto !important; +} +.couponbg { + position: relative; + background: #fff; + overflow: hidden; + width: 92%; + margin: 0 auto 6%; + border-radius: 16rpx; + padding-bottom: 20rpx; +} +.coedTiem{ + text-align: center; + color: rgba(253,131,45,1); + margin-bottom: 20rpx; +} + +.title { + line-height: 36rpx; + text-align: center; + padding-top: 54rpx; + font-size: 32rpx; + color: #1f2d3d; + letter-spacing: 0; +} + +.subtitle { + color: #7f8b9e; + font-size: 26rpx; + line-height: 30rpx; + margin-top: 16rpx; + text-align: center; +} + +.line { + height: 10rpx; + display: block; + width: 100%; + margin-top: 20rpx; +} + +.panel, .zhuangtai image { + width:500rpx; + display:block; + border-radius:10rpx; + margin:0 auto; + padding:0; + z-index:10000; +} +.panel{ + position: relative; +} + +.pane2 { + background: #fff; + opacity: 0.6; +} + +.pane2 image { + width: 500rpx; + display: block; + margin: 40rpx auto 0; +} + +.barcode { + height: 100rpx; + width: 500rpx; + margin: 0 auto; +} + +.barnum { + height: 46rpx; + line-height: 46rpx; + font-size: 24rpx; + text-align: center; + letter-spacing: 2rpx; + white-space: nowrap; + color: #7f7f7f; +} + +.barnum text { + display: inline-block; + vertical-align: top; + font-size: 24rpx; + color: #999; + letter-spacing: 0; + margin-right: 6rpx; +} + +.barcode > canvas { + width: 500rpx; + height: 100rpx; +} + +.qrcode { + position: relative; + height: 360rpx; + display: flex; + flex-direction: column; + justify-content: flex-end; + align-items: center; +} + +.qrcode > canvas { + width: 350rpx; + height: 350rpx; +} + +.jine { + color: #f96563 !important; + font-size: 36rpx !important; +} + +.buy-view { + background: #fff; + position: fixed; + padding-top: 10rpx; + height: 98rpx; + bottom: 0rpx; + left: 0; + right: 0; +} + +.buy { + background: #fff; + height: 88rpx; + width: 100%; + margin: 0 auto 40rpx; + line-height: 88rpx; + border: 2rpx solid #ccc; + border-radius: 10px; + font-size: 36rpx; + color: #333; + letter-spacing: 0; +} + +.mai { + font-size: 24rpx; + color: #919191; + letter-spacing: 0; +} + +.remark { + padding-top: 17rpx; + font-size: 24rpx; + color: #333; + letter-spacing: 0; + line-height: 42rpx; +} +/* 小游戏入口 + */ + .game-entry{ + width: 690rpx; + height: 140rpx; + margin: 0 auto; + border-radius: 14rpx; + box-shadow: 1px 4px 20px #C4C4C4; + background: #fff; +} +.game { + position: relative; + width: 750rpx; + height: 200rpx; + margin: 0 auto; + padding-top: 30rpx; + box-sizing: border-box; +} +.gameimg{ + position: absolute; + right: 25rpx; + top: -14rpx; + width: 250rpx; +} +.game text { + display: block; + position: relative; +} + +.game text:nth-of-type(1) { + display: inline-block; + padding-top: 39rpx; + padding-left: 70rpx; + font-size: 32rpx; + color: #333; + line-height: 36rpx; +} + +.game text:nth-of-type(2) { + font-size: 24rpx; + color: #999; + line-height: 24rpx; + padding-left: 70rpx; +} + +.notes view:nth-child(1) { + height: 87rpx; + line-height: 87rpx; + background: #fff; +} + +.notes { + width: 92%; + margin: 0 auto; +} +.notes view:nth-child(1) text { + color: #333; + letter-spacing: 0; + font-size: 30rpx; + height: 70rpx; + line-height: 70rpx; +} + +.notes view:nth-child(2) { + background: #fff; + display: flex; + flex-direction: column; +} + +.notes view:nth-child(2)>text { + font-size: 24rpx; + color: #919191; + letter-spacing: 0; + line-height: 42rpx; +} +.closeRq{ + position: absolute; + width: 420rpx; + height: 420rpx; + line-height: 420rpx; + text-align: center; + background-color: rgba(0, 0, 0, 0.8); + left: 50%; top: 42%; + transform: translate(-50%, -50%); /* 50%为自身尺寸的一半 */ + z-index: 10000000; + color: #fff; + font-size: 38rpx; +} +.updataRqCode{ + width: 80rpx !important; + height: 80rpx; + margin-top: calc(50%-80rpx) !important; + margin-left: calc(50%-80rpx) !important; + display: inline-block !important; +} +.upDataRq{ + position: absolute; + width: 100%; + text-align: center; + height: 80rpx; + color: #fff ; + top: 20%; + left: 0; +} +/* rich-text img{ + max-width: 100%; +} */ diff --git a/pages/questionnaire/questionnaire.js b/pages/questionnaire/questionnaire.js new file mode 100644 index 0000000..cdb5d9f --- /dev/null +++ b/pages/questionnaire/questionnaire.js @@ -0,0 +1,265 @@ +// pages/questionnaire/questionnaire.js +const Http = require("../../utils/HttpBasics"); +var config = require("../../config/config.js"); +const util = require("../../utils/util.js"); +var app = getApp(); +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + id: "", + question: {}, + userDetails: "", + thenDate: "", + }, + //设置选中项 + setLsit(e) { + if (this.data.userDetails != "") { + return + } + let index1 = e.currentTarget.dataset.index1 + let index2 = e.currentTarget.dataset.index2 + let tempList = this.data.question + if (tempList.topicList[index1].type == 1) { + tempList.topicList[index1].answers.map(item => { + item.falg = false + + }) + tempList.topicList[index1].answers[index2].falg = !tempList.topicList[index1].answers[index2].falg + } else { + tempList.topicList[index1].answers[index2].falg = !tempList.topicList[index1].answers[index2].falg + } + + this.setData({ + question: tempList + }) + }, + //提交 + save() { + let falg = false + let logList = [] + let tmepData = this.data.question.topicList + + tmepData.map(item => { + let tmepObj = {} + let tempArr = [] + tmepObj.topicId = item.id + item.answers.map(res => { + if (res.falg) { + tempArr.push(res.id) + item.complete = true + } + }) + tmepObj.answer = JSON.stringify(tempArr) + logList.push(tmepObj) + }) + tmepData.map(item => { + if (item.complete == null) { + falg = true + + } + }) + if (falg) { + tt.showToast({ + title: "您还有未答的题目!", + icon: 'none', + duration: 2000, + // mask: false + }); + return true + } + let param = { + questionId: this.data.id, + logList: logList + } + console.log(tmepData) + console.log(param, "param") + Http.post({ + url: config.api.submitQuestin, + data: param + }).then(res => { + let str = "" + if (this.data.question.rewardCredit) { + str = `感谢您的参与, + ${this.data.question.rewardCredit}积分已经到账啦` + } else { + str = `感谢您的参与!` + } + tt.showToast({ + title: str, + icon: 'none', + duration: 2000, + success: () => { + setTimeout(() => { + tt.reLaunch({ + url: '/index/index' + }) + }, 2000) + + } + // mask: false + }); + }).catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + // mask: false + }); + }) + }, + //是否授权手机号 + ifPhoneInfo() { + let that = this; + Http.get({ + url: config.api.checkPhoneStatus, + data: {} + }).then(res => { + return + }).catch(err => { + tt.navigateTo({ + url: `/pages/getuserinfo/index?path=wj&wjId=${this.data.id}`, + }) + }) + }, + + /* 判断是否授权*/ + userAuthorization() { + Http.get({ + url: config.api.checkUserStatus, + data: { + token: app.globalData.token + } + }).then(res => { + this.ifPhoneInfo() + }).catch(err => { + tt.navigateTo({ + url: `/pages/getuserinfo/index?fromflag=wj&wjId=${this.data.id}`, + }) + }) + }, + + //获取问卷详情 + getDetail() { + let param = { + id: this.data.id + } + Http.get({ + url: config.api.questionnaireDetail, + data: param + }).then(res => { + + + res.data.question.startDate_Sing = util.formatTime(res.data.question.startDate, "yyyy-MM-dd hh:mm") + res.data.question.endDate_Sing = util.formatTime(res.data.question.endDate, "yyyy-MM-dd hh:mm") + console.log(res.data.question) + if (res.data.userDetails) { + let temp = res.data.question.topicList + temp.map((item, index) => { + + // res.data.userDetails + item.answers.map(item2 => { + let tempArr = JSON.parse(res.data.userDetails.logList[index].answer) + if (tempArr.indexOf(item2.id) != -1) { + item2.falg = true + } + }) + }) + this.setData({ + userDetails: res.data.userDetails + }) + } + this.setData({ + question: res.data.question + }) + }).catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + // mask: false + }); + }) + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + + this.setData({ + id: options.id, + + }) + this.getDetail() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + this.userAuthorization() + this.setData({ + thenDate: new Date().getTime() + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + var that = this; + var shareObj = { + title: "问卷详情", + path: `/pages/main/index?id=${that.data.id}&type=wj`, + success: function (res) { + if (res.errMsg == 'shareAppMessage:ok') { } + }, + fail: function (error) { + if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } + } + }; + console.log(shareObj) + // 返回shareObj + return shareObj; + } +}) \ No newline at end of file diff --git a/pages/questionnaire/questionnaire.json b/pages/questionnaire/questionnaire.json new file mode 100644 index 0000000..5e6fbdf --- /dev/null +++ b/pages/questionnaire/questionnaire.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "navbar": "../../components/navbar/navbar" + }, + "navigationBarBackgroundColor": "#FD832D", + "navigationBarTextStyle": "white" + + } \ No newline at end of file diff --git a/pages/questionnaire/questionnaire.ttml b/pages/questionnaire/questionnaire.ttml new file mode 100644 index 0000000..9c6e500 --- /dev/null +++ b/pages/questionnaire/questionnaire.ttml @@ -0,0 +1,25 @@ + + + + + + + {{question.title}} + {{'答题时间:'+question.startDate_Sing+'至'+question.endDate_Sing}} + {{question.topDesc}} + + + + + {{ item.type==2? index+1 +'、'+item.title+'(可多选)':index+1 +'、'+item.title}} + {{item_2.name}} + + 未开始 + 已过期 + 提交 + 已参与 + 已下线 + 已上线 + \ No newline at end of file diff --git a/pages/questionnaire/questionnaire.ttss b/pages/questionnaire/questionnaire.ttss new file mode 100644 index 0000000..0905195 --- /dev/null +++ b/pages/questionnaire/questionnaire.ttss @@ -0,0 +1,117 @@ +/* pages/questionnaire/questionnaire.wxss */ + +page { + overflow-y: scroll !important; + } + + .Box { + background-color: rgba(242, 242, 242, 1); + overflow: hidden; + } + + .imgBox { + width: 96%; + height: 300rpx; + margin: 20rpx 15rpx; + border-radius: 6rpx; + /* background-color: aqua; */ + } + + .titleBox { + width: 96%; + margin: auto; + } + + .title { + font-size: 36rpx; + font-weight: 700; + color: #999; + margin-top: 10rpx; + } + + .content { + padding: 20rpx 0; + color: #999; + font-size: 32rpx; + /* overflow: hidden; + text-overflow: ellipsis; + height: 70rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; */ + } + .hidBox{ + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background-color: rgba(0, 0, 0, 0.2) + } + .contcBox{ + width: 80%; + height: 300rpx; + background-color: #fff; + + } + .time{ + font-size: 32rpx; + padding: 10rpx 0; + color: #999; + } + .oneBox { + width: 96%; + margin: 20rpx auto; + background-color: #fff; + border-radius: 6rpx; + padding-bottom: 20rpx; + } + + .moreBox { + width: 96%; + margin: 20rpx auto; + background-color: #fff; + border-radius: 6rpx; + padding-bottom: 20rpx; + } + + .oneTitle { + font-weight: 700; + padding: 10rpx; + font-size: 36rpx; + margin: 10rpx auto; + } + + .item_hie { + text-align: center; + line-height: 68rpx; + margin-top: 10rpx; + } + + .item_show { + text-align: center; + line-height: 68rpx; + color: #fff; + background-color: rgba(243, 151, 56, 1); + margin-top: 10rpx; + } + .submit{ + width: 600rpx; + height: 80rpx; + background-color: rgba(0, 153, 255, 1); + color: #fff; + text-align: center; + line-height: 80rpx; + border-radius: 6rpx; + margin: 20rpx auto; + } + .invalid{ + width: 600rpx; + height: 80rpx; + background-color: rgba(0, 0, 0, 0.2); + color: #fff; + text-align: center; + line-height: 80rpx; + border-radius: 6rpx; + margin: 20rpx auto; + } \ No newline at end of file diff --git a/pages/questionnaire/questionnaireLsit/questionnaireLsit.js b/pages/questionnaire/questionnaireLsit/questionnaireLsit.js new file mode 100644 index 0000000..b3321a5 --- /dev/null +++ b/pages/questionnaire/questionnaireLsit/questionnaireLsit.js @@ -0,0 +1,121 @@ +// pages/questionnaire/questionnaireLsit/questionnaireLsit.js +const Http = require("../../../utils/HttpBasics"); +var config = require("../../../config/config.js"); +var app = getApp(); +var app = getApp(); +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +Page({ + + /** + * 页面的初始数据 + */ + data: { + navigationBarHeight, + list: [], + pageNum: 1, + pageSize: 4, + thenDate:"", + }, + goDetails(e){ + let id = e.currentTarget.dataset.id + console.log(id) + tt.navigateTo({ + url: `/pages/questionnaire/questionnaire?id=${id}`, + }) + }, + getQuest() { //查询问卷 + let param = { + pageNum: this.data.pageNum, + pageSize: this.data.pageSize + } + Http.get({ + url: config.api.questionnaire, + data: param + }).then(res => { + if(this.data.pageNum<=1){ + let temp = res.data.list + this.setData({ + list: temp + }) + }else{ + let temp = res.data.list + let formerLsit = this.data.list + formerLsit.push(...temp) + this.setData({ + list:formerLsit + }) + } + }).catch(err=>{ + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + // mask: false + }); + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + this.getQuest() + this.setData({ + thenDate: new Date().getTime() + }) + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + console.log("我到底了!") + let pageNumFlge = this.data.pageNum+1 + this.setData({ + pageNum: pageNumFlge + }) + this.getQuest() + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/questionnaire/questionnaireLsit/questionnaireLsit.json b/pages/questionnaire/questionnaireLsit/questionnaireLsit.json new file mode 100644 index 0000000..da8862c --- /dev/null +++ b/pages/questionnaire/questionnaireLsit/questionnaireLsit.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "navbar": "../../../components/navbar/navbar" + }, + "navigationBarBackgroundColor": "#FD832D", + "navigationBarTextStyle": "white" + } \ No newline at end of file diff --git a/pages/questionnaire/questionnaireLsit/questionnaireLsit.ttml b/pages/questionnaire/questionnaireLsit/questionnaireLsit.ttml new file mode 100644 index 0000000..9ffaa36 --- /dev/null +++ b/pages/questionnaire/questionnaireLsit/questionnaireLsit.ttml @@ -0,0 +1,18 @@ + + + 敬请期待! + + + + + {{item.title}} + {{item.topDesc}} + + 已完成 + 未开始 + 已结束 + {{thenDate}} + {{item.startDate}} + {{item.endDate}} + + diff --git a/pages/questionnaire/questionnaireLsit/questionnaireLsit.ttss b/pages/questionnaire/questionnaireLsit/questionnaireLsit.ttss new file mode 100644 index 0000000..553a374 --- /dev/null +++ b/pages/questionnaire/questionnaireLsit/questionnaireLsit.ttss @@ -0,0 +1,71 @@ +/* pages/questionnaire/questionnaireLsit/questionnaireLsit.wxss */ + +page { + overflow-y: scroll !important; +} + +.questionLsi { + background-color: #fff; + border-radius: 6rpx; + margin: 20rpx auto; + overflow: hidden; + width: 96%; + position: relative; + height: 520rpx; +} + +.img { + width: 96%; + margin: 20rpx 16rpx; + /* background-color: aqua; */ + height: 300rpx; +} + +.title { + width: 96%; + font-size: 36rpx; + font-weight: 700; + color: #999; + margin: auto; +} + +.conten { + width: 96%; + padding: 20rpx 0; + color: #999; + font-size: 32rpx; + margin: 0 auto 20rpx auto; + overflow: hidden; + text-overflow: ellipsis; + height: 70rpx; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; +} + +.accomplish { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: rgb(0, 0, 0, 0.2); + text-align: center; + line-height: 480rpx; + color: #fff; + font-size: 36rpx; + font-weight: 700; +} + +.noData { + width: 100%; + z-index: 1000; + position: fixed; + top: 0; + left: 0; + text-align: center; + line-height: 100vh; + height: 100vh; + background-color: rgb(0, 0, 0, 0.2); + color: #fff; +} diff --git a/pages/searchbar/searchbar.js b/pages/searchbar/searchbar.js new file mode 100644 index 0000000..5043208 --- /dev/null +++ b/pages/searchbar/searchbar.js @@ -0,0 +1,195 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) +'px'; +const config = require("../../config/config"); +const Http = require("../../utils/HttpBasics"); +const imgurl = require("../../utils/imgurl"); +Page({ + data: { + result: [], + page: 1, + navigationBarHeight, + multiArray: [ + [], [] + ], + searchText: "请输入", + multiIndex: 0, + buildingFloor: [], + building: null, + floor: null, + teljpgUrl: imgurl.teljpg.url + }, + // lastSearch: Date.now(), + onShow(){ + this.getbuildingfloorlist(); + if (this.data.focus) { + this.setData({ + searchState: true + }); + } + }, + phone: function (e) { + let that = this; + if (e.currentTarget.dataset.merchantlinkphone) { + tt.makePhoneCall({ + phoneNumber: e.currentTarget.dataset.merchantlinkphone + }) + } + }, + gotoDetail(e) { + tt.navigateTo({ + url: `/pages/index/searchbar/detail/index?id=${e.currentTarget.dataset.id}` + }) + }, + bindMultiPickerColumnChange: function (e) { + var data = { + multiArray: this.data.multiArray, + multiIndex: this.data.multiIndex + }; + console.log(e) + data.multiIndex[e.detail.column] = e.detail.value; + switch (e.detail.column) { + case 0: + data.multiArray[1] = this.data.buildingFloor[e.detail.value].floors; + break; + } + this.setData({ + multiArray: this.data.multiArray, + multiIndex: this.data.multiIndex + }) + }, + bindMultiPickerChange: function (e) { + // 楼座 building + // 楼层 floor + this.setData({ + multiIndex: e.detail.value, + building: this.data.multiArray[0][e.detail.value[0]], + floor: this.data.multiArray[1][e.detail.value[1]], + }) + this.getList(this.data.building.id, this.data.floor.id, 1); + this.setData({ + page:1 + }) + this.setData({ + searchText: this.data.building.name + this.data.floor.floorName + }) + }, + //获取楼层楼座 + getbuildingfloorlist() { + Http.get({ + url: config.api.getbuildingfloorlist, + data: { + } + }).then(res => { + if (res.data.length > 0) { + res.data.map(file => { + if (file.floors.length > 0) { + file.floors.map(ever => { + ever.name = ever.floorName + }) + } + }) + } + this.setData({ + buildingFloor: res.data + }) + this.setData({ + multiArray: [[...this.data.buildingFloor], [...this.data.buildingFloor[0].floors]] + }) + + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + getList: function (building, floor, page) { + let that = this; + let data = { + pageNum: page, + pageSize: 10, + building: building ? building : null, + floor: floor ? floor : null, + }; + Http.get({ + url: config.api.merchantList, + data: data + }).then(res => { + if (page == 1) { + that.setData({ + merchantVoList: [], + }) + } + var tmpArr = that.data.merchantVoList; + tmpArr.push.apply(tmpArr, res.data.list); + that.setData({ + merchantVoList: tmpArr, + isFirstPage: res.data.isFirstPage, + isLastPage: res.data.isLastPage + }) + }) + .catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + clearInput: function clearInput() { + this.setData({ + value: '' + }); + this.triggerEvent('clear'); + }, + inputFocus: function inputFocus(e) { + this.triggerEvent('focus', e.detail); + }, + inputBlur: function inputBlur(e) { + this.setData({ + focus: false + }); + this.triggerEvent('blur', e.detail); + }, + showInput: function showInput() { + this.setData({ + focus: true, + searchState: true + }); + }, + hideInput: function hideInput() { + this.setData({ + searchState: false + }); + this.setData({ + searchText: "请输入", + merchantVoList: [] + }) + }, + selectResult: function selectResult(e) { + var index = e.currentTarget.dataset.index; + var item = this.data.result[index]; + this.triggerEvent('selectresult', { + index: index, + item: item + }); + }, + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + let that = this; + that.data.page++; + that.setData({ + page: that.data.page + }); + // 如果是最后一页 + //就不发送请求 + if (!that.data.isLastPage || that.data.isFirstPage && that.data.isLastPage) { + this.getList(this.data.building.id, this.data.floor.id, that.data.page) + } + } +}) \ No newline at end of file diff --git a/pages/searchbar/searchbar.json b/pages/searchbar/searchbar.json new file mode 100644 index 0000000..002d3a9 --- /dev/null +++ b/pages/searchbar/searchbar.json @@ -0,0 +1,8 @@ +{ + "navigationBarTitleText": "门店搜索", + "navigationBarBackgroundColor": "#F4F5F9", + "navigationBarTextStyle": "black", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/searchbar/searchbar.ttml b/pages/searchbar/searchbar.ttml new file mode 100644 index 0000000..b15cf1a --- /dev/null +++ b/pages/searchbar/searchbar.ttml @@ -0,0 +1,42 @@ + + + + + + + + + + 搜索搜索搜索搜索搜索搜索搜索搜索搜索搜索 + + + + + + + + + {{cancelText}} + + + + + + + 暂无数据 + + \ No newline at end of file diff --git a/pages/searchbar/searchbar.ttss b/pages/searchbar/searchbar.ttss new file mode 100644 index 0000000..e7eb15b --- /dev/null +++ b/pages/searchbar/searchbar.ttss @@ -0,0 +1,88 @@ +@import "../../weui.ttss"; +.weui-search-bar{position:relative;padding:8px;display:flex;box-sizing:border-box;background-color:#EDEDED;-webkit-text-size-adjust:100%;align-items:center}.weui-icon-search{margin-right:8px;font-size:14px;vertical-align:top;margin-top:.64em;height:1em;line-height:1em}.weui-icon-search_in-box{position:absolute;left:12px;top:50%;margin-top:-8px}.weui-search-bar__text{display:inline-block;font-size:14px;vertical-align:top}.weui-search-bar__form{position:relative;flex:auto;border-radius:4px;background:#FFFFFF}.weui-search-bar__box{position:relative;padding-left:32px;padding-right:32px;width:100%;box-sizing:border-box;z-index:1}.weui-search-bar__input{height:32px;line-height:32px;font-size:14px;caret-color:#07C160}.weui-icon-clear{position:absolute;top:0;right:0;bottom:0;padding:0 12px;font-size:0}.weui-icon-clear:after{content:"";height:100%;vertical-align:middle;display:inline-block;width:0;overflow:hidden}.weui-search-bar__label{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;border-radius:4px;text-align:center;color:rgba(0,0,0,0.5);background:#FFFFFF;line-height:32px}.weui-search-bar__cancel-btn{margin-left:8px;line-height:32px;color:#576B95;white-space:nowrap} +.pickers{ + width:560rpx; + height: 64rpx; + position: absolute; + left: 0; + top: 0; + bottom: 0; + margin: auto; + color: transparent; +} +.picker{ + position: relative; + z-index: 10000; + width:496rpx; + height: 64rpx; + overflow: hidden; +} + +.posi { + position: relative; + width: 716rpx; + margin: 0 auto; +} + +.posi>view:nth-child(2) { + width: 100%; + display: flex; + justify-content: space-between; + box-sizing: border-box; +} + +.posi>view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi>view:nth-child(2) text:nth-child(2) { + font-size: 30rpx; + color: #a9a9a9; +} +.tel { + position: absolute; + right: 3%; + top: 0; + bottom: 0; + margin: auto; + width: 50rpx; + height: 50rpx; +} +.posi_logo { + position: relative; + height:176rpx; + background:rgba(255,255,255,1); + box-shadow:0px 4rpx 8rpx 0px rgba(0,0,0,0.04); + border-radius:16rpx; + margin: 20rpx; + overflow: hidden; +} +.merchants{ + width: 90%; + display: flex; + background: #fff; + padding-right:5%; + overflow: hidden; +} +.merchantName{ + display: block; + color: #3C3C3C; + font-size: 32rpx; + margin-left: 20rpx; + width: 90%; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.merchants view:nth-child(1) image { + display: block; + width: 120rpx; + height: 120rpx; + border-radius: 16rpx; +} +.position{ + text-align: center; + margin-top: 100rpx; + color: #999; +} \ No newline at end of file diff --git a/pages/specialcourtesy/specialcourtesy.js b/pages/specialcourtesy/specialcourtesy.js new file mode 100644 index 0000000..ddf36fc --- /dev/null +++ b/pages/specialcourtesy/specialcourtesy.js @@ -0,0 +1,72 @@ +const app = getApp() +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +const QR = require("../../utils/memberqrcode.js"); +Page({ + data: { + navigationBarHeight, + memberId:"", + level:"" + }, + getUserData(){ + Http.get({ + url:config.api.getDiscountInfo + }).then(res=>{ + console.log(res.data); + this.setData({ + memberId:res.data.id, + level:res.data.level + }) + this.qrcode(res.data.id); + }).catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + onLoad: function (options) { + this.getUserData() + }, + + qrcode: function (memberId){ + let that = this; + var size = that.setCanvasSize(); + let url = JSON.stringify({ + END: "C", + TYPE: "memberCode", + ID: memberId, + }); + that.createQrCode(url, "mycanvas2", 250, 250); + }, + createQrCode: function (url, canvasId, cavW, cavH) { + //调用插件中的draw方法,绘制二维码图片 + let that = this; + QR.api.draw(url, canvasId, cavW, cavH,function(res){ + that.setData({ + tempFilePath: res + }) + }); + }, + //适配不同屏幕大小的canvas + setCanvasSize: function () { + var size = {}; + try { + var res = tt.getSystemInfoSync(); + var scale = 750 / 400; + //不同屏幕下canvas的适配比例;设计稿是750宽 + var width = res.windowWidth / scale; + var height = width; + //canvas画布为正方形 + size.w = width; + size.h = height; + } catch (e) { + // Do something when catch error + console.log("获取设备信息失败" + e); + } + return size; + }, +}) \ No newline at end of file diff --git a/pages/specialcourtesy/specialcourtesy.json b/pages/specialcourtesy/specialcourtesy.json new file mode 100644 index 0000000..ff93d80 --- /dev/null +++ b/pages/specialcourtesy/specialcourtesy.json @@ -0,0 +1,5 @@ +{ + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/specialcourtesy/specialcourtesy.ttml b/pages/specialcourtesy/specialcourtesy.ttml new file mode 100644 index 0000000..f0d7484 --- /dev/null +++ b/pages/specialcourtesy/specialcourtesy.ttml @@ -0,0 +1,36 @@ + + + + + + + + + 会员码: + {{memberId}} + + + 会员等级为 + [{{level}}] + 对应门店的优惠折扣 + + + + + + + 9 + 折 + + 百里 + + + A座一层 + + + + + + + + \ No newline at end of file diff --git a/pages/specialcourtesy/specialcourtesy.ttss b/pages/specialcourtesy/specialcourtesy.ttss new file mode 100644 index 0000000..5a796c0 --- /dev/null +++ b/pages/specialcourtesy/specialcourtesy.ttss @@ -0,0 +1,122 @@ +.BoxBg{ + background:linear-gradient(180deg,#FD832D 0%,#FE4A16 100%); + } + .rqBox{ + width: 90%; + background: #ffffff; + border-radius: 12rpx; + margin: 20rpx 5%; + height: 860rpx; + overflow: hidden; + } + + .arImgBox{ + width: 500rpx; + height: 500rpx; + margin: 80rpx auto 60rpx auto; +} +.memCode{ + width: 562rpx; + height: 88rpx; + line-height: 88rpx; + border-radius:16rpx; + border:1px solid rgba(225,225,225,1); + margin: 36rpx auto 0; + color: #666; + display: block; + font-size: 24rpx; + text-align: center; +} +.memText{ + float: left; + margin-left: 40rpx; + font-size: 24rpx; + color: #999; +} +.memNum{ + float: left; + font-weight:600; + font-size: 32rpx; + color: #3C3C3C; + font-family:PingFangSC-Medium; + /* text-align: center; */ +} +.con{ + color: #3C3C3C; + text-align: center; + font-size: 26rpx; + +} +.level{ + color: #FD832D; + display: inline-block; +} +.cardsBox{ + width: 90%; + margin: 20rpx 5%; + display: flex; + justify-content:space-between; + flex-wrap: wrap; + } +.cardsItemBox{ + width: 46%; + height: 200rpx; + border-radius: 12rpx; + background-color: #ffffff; + margin: 20rpx 0; + position: relative; +} +.triangle{ + width: 0px; + height: 0px; + border-color: transparent #dab055; + border-width: 0 0 110rpx 110rpx; + border-style: solid; + +} +.discount{ + position: absolute; +color: #fff; +width: 110rpx; +height: 100rpx; +font-size: 20rpx; +left: 13rpx; +top: -11rpx; +z-index: 10; +transform: rotate(315deg); + +} +.tit{ + font-size: 36rpx; + color: rgba(51, 51, 51, 1); + margin: -40rpx auto 0; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + width: 280rpx; + text-align: center; +} +.footer{ + margin-top: 26rpx; + font-size: 26rpx; + font-weight: 500; + color: rgba(153, 153, 153, 1); + +} +.fl { + float: left; +} +.building{ + display: inline-block; +} +.fr { + float: right; +} +.pgoneImg{ + width: 24rpx; + margin-right: 33rpx; + position: absolute; + right: 0rpx; + bottom: 20rpx; + +} \ No newline at end of file diff --git a/pages/ticket/ticket.js b/pages/ticket/ticket.js new file mode 100644 index 0000000..770ce0e --- /dev/null +++ b/pages/ticket/ticket.js @@ -0,0 +1,132 @@ +const app = getApp() +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px" +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +const util = require("../../utils/util"); +Page({ + data: { + navigationBarHeight, + boatLsit:[ + { + name:"未使用", + value:"0" + }, + { + name:"已使用", + value:"1" + }, + { + name:"已过期", + value:"2" + }, + { + name:"已退款", + value:"3" + }, + ], + boatFlag:"0", + content:"", + loading: false, //"上拉加载"的变量,默认false,隐藏 + pageNum:1, + allow_load: true, + list:[] + }, + setBoatFlag(e){ + let index = e.currentTarget.dataset.index + console.log(index); + this.setData({ + boatFlag:index, + pageNum:1, + list:[], + allow_load: true, + loading: false, //"上拉加载"的变量,默认false,隐藏 + }) + this.getList() + }, + getList(){ + let that = this + if (that.data.allow_load) { + that.setData({ + loading: true, + content: '小主,我在玩命加载中...' + }) + + Http.get({ + url:config.api.couponOrderList, + data:{ + pageNum:that.data.pageNum, + pageSize: 10, + couponOrderStatus:that.data.boatFlag=="all"?"":that.data.boatFlag, + + } + }).then(res=>{ + if(that.data.pageNum==1){ + that.setData({ + list: [] + }) + } + + let tempArr= that.data.list + if(tempArr.length>0){ + tempArr.map(item=>{ + item.createDate = util.formatTime(item.createDate, "yyyy-MM-dd hh:mm:ss"); + }) + } + + if(that.data.pageNum>=res.data.pages){ + that.setData({ + allow_load: false + }) + } + + if(that.data.pageNum>1){//分页 + that.setData({ + list: res.data.list?[...tempArr ,...res.data.list]:tempArr, + loading:false + }) + }else{ + let tempLsit = res.data.list?res.data.list:[] + if(tempLsit.length>0){ + tempLsit.map(item=>{ + item.createDate = util.formatTime(item.createDate, "yyyy-MM-dd hh:mm:ss"); + }) + } + that.setData({ + list: tempLsit, + loading:false + }) + } + }).catch(err => { + tt.showToast({ + title: err.message ? err.message : err.data, // 内容 + icon: "none" + }); + }) + }else { + that.setData({ + loading: true, + content: "——— 再拉裤子就掉了啦 ———" + }) + setTimeout(function () { + that.setData({ + loading: false, + }) + }, 1400) + } + + }, + onLoad: function (options) { + + }, + onReachBottom(){//触底 + console.log(111); + this.setData({ + pageNum:this.data.pageNum+1 + }) + this.getList() + }, + onShow:function(){ + this.getList() + } + +}) \ No newline at end of file diff --git a/pages/ticket/ticket.json b/pages/ticket/ticket.json new file mode 100644 index 0000000..6a6e95e --- /dev/null +++ b/pages/ticket/ticket.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "我的券包", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } +} \ No newline at end of file diff --git a/pages/ticket/ticket.ttml b/pages/ticket/ticket.ttml new file mode 100644 index 0000000..4232d0a --- /dev/null +++ b/pages/ticket/ticket.ttml @@ -0,0 +1,38 @@ + + + + + + + + {{item.name}} + + + + + + + + + + + + + {{item.title}} + {{item.createDate}} + + + 去使用 + 查看 + + + + + + 您还没有相关订单 + 再忙,也要记得买点什么犒赏自己~ + + + {{content}} + + \ No newline at end of file diff --git a/pages/ticket/ticket.ttss b/pages/ticket/ticket.ttss new file mode 100644 index 0000000..510142a --- /dev/null +++ b/pages/ticket/ticket.ttss @@ -0,0 +1,193 @@ +.boatBoxf{ + width: 100%; + height: 90rpx; + position: fixed; + top: 0; + left: 0; +} +.boatBox{ + + width: 100%; + height: 90rpx; + display: flex; + justify-content: space-around; + background-color: #fff; +} +.boatTitle{ + font-size: 30rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + color: #999; +} +.boatTitleA{ + font-size: 32rpx; + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-weight: 500; + +} +.boatA{ + width: 80rpx; + height: 6rpx; + background-color: #fb3e5c; + margin: 0 auto; + border-radius: 20rpx; +} +.ticketList{ + width: 90%; + margin: 20rpx auto ; + + overflow: hidden; +} +.ticketItem{ + float: left; + background-color: #fff; + border-radius: 20rpx; + width: 80%; + height: 140rpx; + overflow: hidden; +} +.useBtn{ + float: left; + border-radius: 20rpx; + width: 20%; + height: 140rpx; + line-height: 140rpx; + text-align: center; + color: #FFFFFF; + font-size: 30rpx; + background: linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%) +} +.nouseBtn{ + float: left; + border-radius: 20rpx; + width: 20%; + height: 140rpx; + line-height: 140rpx; + text-align: center; + color: #FFFFFF; + font-size: 30rpx; + background: #CECECE; + +} +.shopImg{ + width: 88rpx; + height: 88rpx; + border: 1px solid #f8f8f8; + border-radius: 50rpx; + margin-left: 20rpx; + margin-top: 30rpx; + float: left; +} +.shopImg image{ + width: 100%; + height: 100%; + border: 1px solid #f8f8f8; + border-radius: 50rpx; +} +.ticketData{ + margin-left: 20rpx; + overflow: hidden; + float: left; +} +.ticketTitle{ + font-size: 32rpx; + margin-top: 30rpx; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + width: 270rpx; + +} + +.date{ + font-size: 22rpx; + margin-top: 10rpx; +} +.date::before{ + content: "有效期至:"; + font-size: 26rpx; +} + +.loading { + text-align: center; + height: 80rpx; + line-height: 80rpx; + font-size: 26rpx; + color: #999; + } + + .loading image { + width: 60rpx; + height: 60rpx; + vertical-align: middle; + margin-right: 10rpx; + } + + .dingdan { + margin-top: 33rpx; + } + + .dingdan text:nth-of-type(1) { + display: block; + font-size: 34rpx; + color: #333; + letter-spacing: 0; + text-align: center; + } + + .dingdan text:nth-of-type(2) { + display: block; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: center; + } + + .dingdan image { + display: block; + width: 300rpx; + height: 300rpx; + margin: 0 auto 16rpx; + } + .wait{ + display: inline-block; + width: 123rpx !important; + overflow: visible!important; + font-size: 28rpx; + color: #FD832D; + letter-spacing: 0; + text-align: right; + line-height: 28rpx!important; + float: right; + margin: 20rpx; + } + + .sucess { + display: inline-block; + width: 123rpx !important; + /* overflow: hidden; */ + font-family:PingFangSC-Regular; + font-size: 28rpx; + font-weight:400; + color: #2C8DFF; + letter-spacing: 0; + text-align: right; + line-height: 26px; + float: right; + margin: 20rpx; + } + .close { + display: inline-block; + width: 123rpx !important; + overflow: hidden; + font-size: 28rpx; + color: #999; + letter-spacing: 0; + text-align: right; + line-height: 28rpx; + float: right; + margin: 20rpx; + } \ No newline at end of file diff --git a/pages/ticketDetail/ticketDetail.js b/pages/ticketDetail/ticketDetail.js new file mode 100644 index 0000000..48e9359 --- /dev/null +++ b/pages/ticketDetail/ticketDetail.js @@ -0,0 +1,217 @@ +const app = getApp(); +const navigationBarHeight = (getApp().statusBarHeight + 44) + "px"; +const Http = require("../../utils/HttpBasics"); +const config = require("../../config/config"); +const util = require("../../utils/util"); +const QR = require("../../utils/memberqrcode.js"); +Page({ + data: { + navigationBarHeight, + couponorderstatus:"", + quancode:"", + setInter:"", + validStartDate:"", + validEndDate:"", + pickStartDate:"", + pickEndDate:"", + expiredTime:"", + updateDate:"", + createDate:"", + code:"", + data:{ + + }, + showhieRq:false, + dynamicRq:"", + expiredSeconds:0, + templTiem:"", + curHtml:"", + }, + getHtml(couponOrderId) { + Http.get({ + url: config.api.couponHtmlDetailForPkg, + data: { + couponOrderId: couponOrderId + } + }).then(res => { + console.log(res) + if (res.code == 200 && res.data.html) { + this.setData({ + curHtml: decodeURI(res.data.html) + }) + // app.globalData.curHtml = this.data.curHtml; + // console.log(app.globalData.curHtml) + } + }) + }, + onLoad: function (options) { + let that = this; + console.log(options); + that.setData({ + code: options.quancode, + couponorderstatus: options.couponorderstatus + }); + that.setRq()//动态二维码 //这个方法必须在拿到 options.quancode 后调用 + //初始数据不能延时收到写一边 + Http.get({ + url: config.api.couponOrderDetail, + data: { + couponOrderId: options.quancode + } + }).then(res => { + that.setData({ + couponorderstatus: res.data.couponOrderStatus, + data: res.data, + }); + that.setData({ + expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"), + updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), + createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") + }); + if (res.data.contentType != undefined && res.data.contentType == 1) { + //获取图文展示详情html + that.setData({ + contentType: res.data.contentType + }) + that.getHtml(options.quancode); + } + if (that.data.data.validStartDate && that.data.data.validEndDate) { + that.setData({ + validStartDate: util.formatTime(that.data.data.validStartDate, "yyyy-MM-dd hh:mm:ss"), + validEndDate: util.formatTime(that.data.data.validEndDate, "yyyy-MM-dd hh:mm:ss"), + // pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd hh:mm:ss"), + // pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"), + }) + } + + }).catch(err => { + tt.showToast({ + title: err.message?err.message:err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + // + + + + + //获得优惠券的详情 + let setInter = setInterval(function () { + if ( + options.quancode && + that.data.couponorderstatus == 0 + ) { + + Http.get({ + url: config.api.couponOrderDetail, + data: { + couponOrderId: options.quancode + } + }).then(res => { + that.setData({ + couponorderstatus: res.data.couponOrderStatus, + data: res.data, + }); + + that.setData({ + expiredTime: util.formatTime(that.data.data.expiredTime, "yyyy-MM-dd hh:mm:ss"), + updateDate: util.formatTime(that.data.data.updateDate, "yyyy-MM-dd hh:mm:ss"), + createDate: util.formatTime(that.data.data.createDate, "yyyy-MM-dd hh:mm:ss") + }); + if (that.data.data.validStartDate && that.data.data.validEndDate) { + that.setData({ + validStartDate: util.formatTime(that.data.data.validStartDate, "yyyy-MM-dd hh:mm:ss"), + validEndDate: util.formatTime(that.data.data.validEndDate, "yyyy-MM-dd hh:mm:ss"), + // pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd hh:mm:ss"), + // pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd hh:mm:ss"), + }) + } + + }).catch(err => { + tt.showToast({ + title: err.message?err.message:err.data, + icon: 'none', + duration: 2000, + mask: false + }); + }) + } + }, 2000); + that.setData({ + setInter:setInter + }) + }, + setRq(){ + let _this = this + _this.setData({ + showhieRq: false, + }) + Http.get({//获取动态二维码 + url: config.api.dynamicId, + data: { + couponOrderId: _this.data.code + } + }).then(res => { + console.log(res, "res") + _this.setData({ + dynamicRq: res.data.dynamicId, + expiredSeconds: res.data.expiredSeconds + }) + + let url = JSON.stringify({ + END: "C", + TYPE: "couponorder", + ID: _this.data.dynamicRq + }) + + let inre = setInterval(()=>{ + if(_this.data.expiredSeconds>1){ + _this.setData({ + expiredSeconds: _this.data.expiredSeconds-1 + }) + console.log("有效",_this.data.expiredSeconds) + }else{ + console.log("无效", _this.data.expiredSeconds) + clearInterval(_this.data.templTiem) + _this.setData({ + showhieRq:true + }) + } + },1000) + _this.setData({ + templTiem:inre + }) + // util.qrcode("qrcode", url, 350, 350); + _this.createQrCode(url, "qrcode", 210, 210); + }).catch(err => { + tt.showToast({ + title: err.message, + icon: 'none', + duration: 4000, + mask: false + }); + }) + }, + + createQrCode: function (url, canvasId, cavW, cavH) { + //调用插件中的draw方法,绘制二维码图片 + let that = this; + QR.api.draw(url, canvasId, cavW, cavH, function (res) { + that.setData({ + tempFilePath: res + }) + }); + }, + onUnload: function () { + let that = this; + clearInterval(that.data.setInter); + clearInterval(that.data.templTiem); + }, + onHide: function () { + let that = this; + clearInterval(that.data.setInter); + clearInterval(that.data.templTiem); + }, +}) \ No newline at end of file diff --git a/pages/ticketDetail/ticketDetail.json b/pages/ticketDetail/ticketDetail.json new file mode 100644 index 0000000..2490acb --- /dev/null +++ b/pages/ticketDetail/ticketDetail.json @@ -0,0 +1,7 @@ +{ + "navigationBarTitleText": "使用优惠券", + "usingComponents": { + "navbar": "../../components/navbar/navbar", + "store":"../../components/store/index" + } +} \ No newline at end of file diff --git a/pages/ticketDetail/ticketDetail.ttml b/pages/ticketDetail/ticketDetail.ttml new file mode 100644 index 0000000..bf680f1 --- /dev/null +++ b/pages/ticketDetail/ticketDetail.ttml @@ -0,0 +1,69 @@ + + + + + + + + + + + {{data.title}} + {{data.subTitle}} + + ¥{{data.couponPrice/100}} + ¥{{data.price/100}} + 过期不退款 + + 有效期至:{{expiredTime}} + 满{{data.usePrice/100}}元可用 + 仅限本店使用 + + + + + + + + + + + + + + 点一点刷新二维码 + + 二维码在 + {{expiredSeconds}}s + 后失效 + + {{code}} + + + + + + + + + + 实付金额: + + {{data.couponPrice/100}} + + {{createDate}} + {{updateDate}} + {{updateDate}} + {{updateDate}} + + {{data.orderId}} + + + 购买须知 + {{data.remark}} + + + + + + \ No newline at end of file diff --git a/pages/ticketDetail/ticketDetail.ttss b/pages/ticketDetail/ticketDetail.ttss new file mode 100644 index 0000000..530745e --- /dev/null +++ b/pages/ticketDetail/ticketDetail.ttss @@ -0,0 +1,284 @@ +.BoxBg{ + height: 100%; + background: linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%); + overflow: hidden; +} + +.container { + + background: #fff; + width: 92%; + margin: 8% auto 6% auto; + border-radius: 16rpx; + text-align: center; +} +.quanDataBox{ + /* margin-top: 60rpx; */ + overflow: hidden; +} +.qianTitle{ + font-size: 32rpx; +} +.payBox{ + display: flex; + justify-content: center; +} +.selling{ + font-size: 30rpx; + color: rgba(253,131,45,1); + margin-top: 10rpx; +} +.original{ + color: #999; + font-size: 26rpx; + text-decoration: line-through; + margin-left: 20rpx; + margin-top: 14rpx; +} +.past{ + font-size: 24rpx!important; + color: red!important; + border: 1px solid red; + padding: 3rpx; + float: left; + margin-left: 10rpx; + font-size: 26rpx; + height: 40rpx; + line-height: 40rpx; + margin-top: 10rpx; + +} +.timevalidity{ + font-size: 22rpx; + color: #999; + letter-spacing: 0; + margin: 6rpx 0 10rpx 0; +} +.subhead{ + font-size: 26rpx; + color: #999; + letter-spacing: 0; + text-align: center; + line-height: 37rpx; + padding: 0 10rpx; + +} +.manjian{ + margin-left: 26rpx; + color: #999!important; + font-size: 26rpx !important; + text-align: center; + +} +.line{ + height: 10rpx; + display: block; + width: 100%; + margin-top: 20rpx; + +} +.zhuangtai{ + margin-bottom: 20rpx; +} +.panel{ + overflow: hidden; + position: relative; +} +.rqImg{ + /* background-color: aqua; */ + width: 600rpx; + height: 440rpx; + display: block; + border-radius: 10rpx; + margin: 20rpx auto; + padding: 0; + overflow: hidden; +} +.barnum{ + background: #fff; + height: 88rpx; + width: 600rpx; + margin: 0 auto; + line-height: 88rpx; + border: 2rpx solid #ccc; + border-radius: 10px; + font-size: 36rpx; + color: #333; + letter-spacing: 0; + text-align: center; + +} +.barnum::before{ + content: "优惠券码:"; + font-size: 24rpx; + color: #999; +} +.shopData{ + margin-top: 20rpx; + text-align: left; +} +.shopTexx{ + font-size: 30rpx; + height: 70rpx; + line-height: 70rpx; + text-indent: 1em; + color: #333; + background: #fff; + margin: 20rpx 0; +} +.posi{ + overflow: hidden; + height: 70px; + +} +.note{ + text-align: left; + +} +.shiji{ + width: 22%; + text-indent: 30rpx; + text-align: left; + font-size: 24rpx; + color: #333; + letter-spacing: 1.16rpx; + margin-left: 20rpx; +} +.moneys{ + + font-size: 40rpx !important; + color: #ff4949 !important; + letter-spacing: 0; + float: right; + +} +.orderDate::before{ + content: "下单时间:"; + margin-left: 20rpx; +} +.orderDate{ + font-size: 24rpx; + color: #333; + letter-spacing: 1.16rpx; + margin: 10rpx 0; +} + +.orderDate1::before{ + content: "核销时间:"; + margin-left: 20rpx; +} +.orderDate1{ + font-size: 24rpx; + color: #333; + letter-spacing: 1.16rpx; + margin: 10rpx 0; +} + +.orderDate2::before{ + content: "过期时间:"; + margin-left: 20rpx; +} +.orderDate2{ + font-size: 24rpx; + color: #333; + letter-spacing: 1.16rpx; + margin: 10rpx 0; +} + +.orderDate3::before{ + content: "退款时间:"; + margin-left: 20rpx; +} +.orderDate3{ + font-size: 24rpx; + color: #333; + letter-spacing: 1.16rpx; + margin: 10rpx 0; +} + +.orderNum::before{ + content: "订单编号:"; + margin-left: 20rpx; +} +.orderNum{ + font-size: 24rpx; + color: #333; + letter-spacing: 1.16rpx; + margin: 10rpx 0; +} +.notes{ + margin: 20rpx; + text-align: left; +} + +.notesText{ + font-size: 30rpx; + color: #333; + letter-spacing: 0; + +} +.introduce{ + font-size: 28rpx; + color: #333; +} +.closeRq{ + position: absolute; + width: 420rpx; + height: 400rpx; + line-height: 400rpx; + text-align: center; + background-color: rgba(0, 0, 0, 0.8); + left: 50%; top: 42%; + transform: translate(-50%, -50%); /* 50%为自身尺寸的一半 */ + z-index: 10000000; + color: #fff; + font-size: 38rpx; +} +.updataRqCode{ + width: 80rpx !important; + height: 80rpx; + margin-top: calc(50%-80rpx) !important; + margin-left: calc(50%-80rpx) !important; + display: inline-block !important; +} +.upDataRq{ + position: absolute; + width: 100%; + text-align: center; + height: 80rpx; + color: #fff ; + top: 20%; + left: 0; +} +.rich_text{ + width: 100%; + height: 100%; +} +.rich_text p { + width: 100% !important; +} +.rich_text img{ + max-width: 100% !important; +} +.logoBox{ + position: relative; + width: 100%; + height: 80rpx; +} + +.logo{ + position: absolute; + width: 100rpx; + height: 100rpx; + border-radius: 50%; + top: -50%; + display: block; + left: 44%; + z-index: 1000000; +} +.coedTiem{ + text-align: center; + color: rgba(253,131,45,1); + margin-bottom: 10rpx; + font-size: 30rpx; + } \ No newline at end of file diff --git a/pages/topicDetail/index.js b/pages/topicDetail/index.js new file mode 100644 index 0000000..6908149 --- /dev/null +++ b/pages/topicDetail/index.js @@ -0,0 +1,109 @@ +const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' +let config = require("../../config/config.js"); +let app = getApp(); +const Http = require("../../utils/HttpBasics"); +const util = require("../../utils/util"); +const imgurl = require("../../utils/imgurl"); +Page({ + data: { + mouldType: 0, + navigationBarHeight, + data: { + bgColor:"#fff" + }, + wmhome: imgurl.wmhome.url, + couponId: null, + orderId: "", + day: "", + hour: "", + minute: "", + nodes: '', + id:'', + }, + onLoad(options){ + this.setData({ + mouldType: app.globalData.mouldType + }) + console.log(options) + if(options&&options.id){ + this.setData({ + id:options.id + }) + this.topicShow(options.id) + } + }, + goback: function () { + tt.reLaunch({ + url: '/index/index', + }) + }, + topicShow(id){ + let that = this; + Http.get({ + url: config.api.topicFindById, + data: { + id: id + } + }).then(res => { + console.log(res) + if (res&&res.data) { + that.setData({ + data: res.data + }); + /** + * 获取屏幕的高度 + * + */ + let query = tt.createSelectorQuery(); + query.select('.coupons').boundingClientRect(); + query.selectViewport().scrollOffset(); + query.exec((res) => { + let listHeight = res[0].height; // 获取list高度 + let windowHeight = tt.getSystemInfoSync().windowHeight; + if (windowHeight >= listHeight){ + that.setData({ + winHeight:'100%' + }) + } + }) + } + }).catch(err => { + tt.showToast({ + title: err.errMsg, + icon: 'none', + duration: 2000, + mask: false + }); + }) + }, + gotoDetail:function(e){ + if (e.currentTarget.dataset.type == 9){ + console.log("平团") + tt.navigateTo({ + url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${e.currentTarget.dataset.couponchannelid}`, + }) + }else{ + console.log("优惠卷") + tt.navigateTo({ + url: `/pages/coupon/detail/index?couponChannelId=${e.currentTarget.dataset.couponchannelid}&couponId=${e.currentTarget.dataset.couponid}`, + }) + } + }, + onShareAppMessage: function (options) { + var that = this; + var shareObj = { + title: "专题活动", + path: `/pages/main/index?id=${that.data.id}&type=td`, + success: function (res) { + if (res.errMsg == 'shareAppMessage:ok') { } + }, + fail: function (error) { + if (res.errMsg == 'shareAppMessage:fail cancel') { } else if (res.errMsg == 'shareAppMessage:fail') { } + } + }; + console.log(shareObj) + // 返回shareObj + return shareObj; + } + +}); diff --git a/pages/topicDetail/index.json b/pages/topicDetail/index.json new file mode 100644 index 0000000..9136d3d --- /dev/null +++ b/pages/topicDetail/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "活动详情", + "usingComponents": { + "navbar": "../../components/navbar/navbar" + } + } \ No newline at end of file diff --git a/pages/topicDetail/index.ttml b/pages/topicDetail/index.ttml new file mode 100644 index 0000000..3edad48 --- /dev/null +++ b/pages/topicDetail/index.ttml @@ -0,0 +1,51 @@ + + + + + + + + + {{data.name}} + {{data.title}} + + {{data.content}} + + + + + + + + + + + + + + {{item.title}} + {{item.subTitle}} + + {{item.salePriceStr}} + + 满¥{{item.usePriceStr}}可用 + + + 仅限本店使用 + + + + + + + + 免费领 + 马上购 + + + + + + \ No newline at end of file diff --git a/pages/topicDetail/index.ttss b/pages/topicDetail/index.ttss new file mode 100644 index 0000000..43c3e43 --- /dev/null +++ b/pages/topicDetail/index.ttss @@ -0,0 +1,558 @@ +@import "../../app.ttss"; +.coupons { + width: 100%; + position: relative; + padding-bottom:57rpx; +} + +.coupons-body { + flex: 1; + /* overflow: auto; */ +} + +.banner { + position: relative; + width: 100%; +} + +.banner image { + display: block; + width: 100%; + border-radius: 12rpx; +} + +.act { + position: relative; + z-index: 1000; + background: #fff; + border-radius: 12rpx; + width: 94%; + margin: 24rpx auto 0; + padding-bottom: 20rpx; +} + +.act view { + padding-left: 4.8%; + padding-right: 4.8%; +} + +.txt001 { + /* display: block; */ + font-size: 34rpx; + color: #363636; + letter-spacing: 0; + text-align: left; + line-height: 48rpx; + padding-top: 3.2%; +} + +.txt002 { + font-size: 24rpx; + color: #999; + letter-spacing: 0; + text-align: left; + line-height: 33rpx; +} + +.proct { + position: relative; + /* height: 60rpx; */ + margin-top: 20rpx; +} + +.proct text:nth-of-type(1) { + display: block; + font-size: 30rpx; + letter-spacing: 0; + line-height: 42rpx; + margin-bottom: 20rpx; + text-align: left!important; + /* width: 60rpx; */ + /* height: 64rpx; */ +} + +.proct text:nth-of-type(2) { + display: block; + /* width: 498rpx; */ + /* height: 63rpx; */ + /* overflow: hidden; */ + word-wrap:break-word; + /* text-overflow: ellipsis; */ + font-size: 22rpx; + color: #6f6f6f; + letter-spacing: 0; + margin: 0 auto; +} + +.orbg { + position: absolute; + top: 256rpx; + z-index: 1000000; +} + +.banner text { + position: absolute; + right: 0; + top: 0; + bottom: 0; + margin: auto; + width: 122rpx; + height: 48rpx; + line-height: 48rpx; + opacity: 0.8; + background: #000; + font-size: 24rpx; + color: #fff; + letter-spacing: 0; + text-indent: 0.5em; + border-top-left-radius: 50rpx; + border-bottom-left-radius: 50rpx; +} + +.coupons_info { + width: 92%; + height: 120rpx; + display: flex; + justify-content: space-between; + padding: 0 4% 4%; + background: #fff; +} + +.coupons_info view { + display: flex; + flex-direction: column; +} + +.coupons_info view:nth-child(1) text { + font-size: 30rpx; + line-height: 32rpx; + margin-top: 10%; +} + +.coupons_info view:nth-child(1) text:nth-child(1) text { + color: #ff3434; + font-size: 24rpx; + border: 1px solid #ff3434; + border-radius: 6rpx; + margin-left: 2%; + padding: 0 5rpx; +} + +.coupons_info view:nth-child(1) text:nth-child(2), +.coupons_info view:nth-child(1) text:nth-child(3) { + color: #b8b8b8; + font-size: 24rpx; + margin-top: 4%; +} + +.coupons_info view:nth-child(1) text:nth-child(2) text, +.coupons_info view:nth-child(1) text:nth-child(3) text { + color: #ff3434; + font-size: 24rpx; +} + +.coupons_info view:nth-child(2) text:nth-child(1) { + font-size: 36rpx; + color: #ff3434; + margin-top: 40rpx; + font-weight: bold; +} + +.coupons_info view:nth-child(2) text:nth-child(2) { + font-size: 24rpx; + color: #b4b4b4; + text-decoration: line-through; + padding-left: 10rpx; + padding-top: 4rpx; +} + +.navigator { + display: block; + margin-bottom: 24rpx; + width: 344rpx; +} + +.navigator-hover{ + opacity: 1!important; + background: #fff!important; + border-radius:16rpx; +} +.active{ + opacity: .6; +} +.navigator:nth-of-type(2n) { + float: right; +} + +.navigator:nth-of-type(2n+1) { + float: left; +} + +.contain { + padding: 24rpx 25rpx 0; +} + +.posi { + width: 92%; + display: flex; + flex-direction: column; + padding: 0 4%; + background: #fff; + margin-top: 2%; +} + +.posi>view:nth-child(2) { + width: 100%; + height: 87rpx; + display: flex; + justify-content: space-between; + border-top: 1px solid #f6f6f6; + line-height: 87rpx; +} + +.posi>view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi>view:nth-child(2) text:nth-child(2) { + font-size: 30rpx; + color: #a9a9a9; +} + +.posi_logo { + width: 100%; + height: 156rpx; + display: flex; + margin-top: 30rpx; +} + +.posi_logo view:nth-child(1) { + width: 126rpx; + height: 126rpx; + border-radius: 50%; + overflow: hidden; + flex: 2; +} + +.posi_logo view:nth-child(1) image { + width: 100%; + height: 100%; +} + +.posi_logo view:nth-child(2) { + display: flex; + flex-direction: column; + flex: 8; + padding-top: 20rpx; + padding-left: 30rpx; +} + +.posi_logo view:nth-child(2) text:nth-child(1) { + font-size: 30rpx; +} + +.posi_logo view:nth-child(2) text:nth-child(2) { + font-size: 24rpx; + color: #b8b8b8; + padding-top: 10rpx; +} + +.notes view:nth-child(1) { + width: 92%; + height: 87rpx; + padding: 0 4%; + line-height: 87rpx; + background: #fff; + /* border-top: 1rpx solid #f5f5f5; */ +} + +.notes view:nth-child(1) text { + font-size: 30rpx; + font-weight: bold; +} + +.notes view:nth-child(2) { + width: 92%; + height: auto; + padding: 0 4% 4%; + background: #fff; + /* border-bottom: 1rpx solid #f5f5f5; */ + display: flex; + flex-direction: column; +} + +.notes view:nth-child(2)>text { + font-size: 28rpx; + color: #a9a9a9; + line-height: 45rpx; +} + +.spot { + width: 12rpx; + height: 12rpx; + display: inline-block; + background: #a9a9a9; + margin-right: 16rpx; + position: relative; + bottom: 4rpx; + border-radius: 50%; +} + +.buy-view { + background: #fff; + position: fixed; + padding-top: 10rpx; + height: 98rpx; + bottom: 0rpx; + left: 0; + right: 0; +} + +.buy { + display: block; + background: linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%); + border-radius: 30rpx; + height: 48rpx; + width: 112rpx; + margin: 0 auto; + color: #fff; + font-size: 26rpx; + line-height: 48rpx; + text-align: center; +} + +.coupons1-btn-gm { + background: #00c0ff !important; + border-radius: 10rpx !important; + margin: 0 !important; + padding: 0 !important; + font-family: PingFangSC-Semibold; + font-size: 28rpx; + color: #fff !important; + letter-spacing: 0; + height: 50rpx !important; + width: 138rpx !important; + line-height: 50rpx !important; +} + +.coupons1 { + position: relative; + background: #fff; + border-radius: 16rpx; + padding-bottom: 21rpx; + overflow: hidden; + height: 400rpx; +} + +/* .coupons1-border { + height: 1rpx; + left: 30rpx; + right: 30rpx; + background: #f5f5f5; + position: absolute; + bottom: 0; +} */ + +.coupons1-img { + width: 344rpx; + height: 233rpx; + overflow: hidden; +} + +.coupons1-img image { + display: block; + width: 100%; + height: 233rpx; +} + +.coupons1-info { + padding-left: 20rpx; +} + +.coupons1-info-name { + font-size: 28rpx; + color: #000; + letter-spacing: 0; +} + +.i { + font-size: 20rpx; + font-style: normal; +} + +.coupons1-info-price-p { + display: inline-block; + font-size: 36rpx; + color: #f96563; + line-height: 50rpx; + margin-top: 21rpx; +} + +.tit { + font-size: 30rpx; + color: #000; + letter-spacing: 0; + line-height: 42rpx; + width: 270rpx; + height: 42rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + padding-top: 16rpx; +} + +.coupons1-info-price-o { + display: block; + text-align: center; + font-size: 26rpx; + color: #b4b4b4; + letter-spacing: 0.96rpx; + text-decoration: line-through; + line-height: 24rpx; +} + +.coupons1-info-distance { + font-size: 22rpx; + color: #c0c0c0; + letter-spacing: 0; + padding-bottom: 10rpx; + line-height: 30rpx; +} + +.coupons1-info-address { + font-size: 22rpx; + color: #585858; + letter-spacing: 0; + line-height: 30rpx; +} + +.coupons1-btn { + position: absolute; + width: 120rpx; + bottom: 25rpx; + right: 13rpx; +} + +.coupons1-btn-gm { + background: #00c0ff !important; + border-radius: 10rpx !important; + margin: 0 !important; + padding: 0 !important; + font-family: PingFangSC-Semibold; + font-size: 28rpx; + color: #fff !important; + letter-spacing: 0; + height: 50rpx !important; + width: 138rpx !important; + line-height: 50rpx !important; +} + +.subtitle { + font-size: 24rpx; + font-weight: 100; + text-align: left; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + width: 300rpx; + color: #999; + height: 38rpx; + letter-spacing: 0; +} + +.coupons1-info-manjian { + color: #fa7c7a; + font-size: 20rpx; + line-height: 34rpx; + display: inline-block; +} + +.jian { + width: 44rpx; + position: absolute; + bottom: 1.7%; + right: 3.5%; +} + +/**上拉加载更多**/ + +.userinfo { + display: flex; + flex-direction: column; + align-items: center; +} + +.userinfo-avatar { + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.userinfo-nickname { + color: #aaa; +} + +.sy { + display: block; + text-align: center; + width: 120rpx !important; + margin-top: 6rpx; +} + +.usermotto { + margin-top: 200px; +} + +/**/ + +scroll-view { + width: 100%; +} + +.item { + width: 90%; + height: 300rpx; + margin: 20rpx auto; + background: brown; + overflow: hidden; +} + +.item .img { + width: 430rpx; + margin-right: 20rpx; + float: left; +} + +.title { + font-size: 30rpx; + display: block; + margin: 30rpx auto; +} +.description { + font-size: 26rpx; + line-height: 15rpx; +} +button::after{ border: none; } +.goback{ + position: fixed; + right: 50rpx; + bottom: 60rpx; + width:100rpx!important; + height:100rpx; + z-index: 100; + background:rgba(255,255,255,1); + line-height: 95rpx; + border:1rpx solid rgba(227,227,227,1); + border-radius:50%; +} +.goback image{ + position: absolute; + width: 60rpx; + left: 0; + right: 0; + top: 0; + bottom: 0; + margin: auto; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json new file mode 100644 index 0000000..29e45b0 --- /dev/null +++ b/project.config.json @@ -0,0 +1,39 @@ +{ + "setting": { + "urlCheck": true, + "es6": true, + "newFeature": false, + "postcss": false, + "mockUpdate": false, + "minified": false, + "scripts": false, + "mockLogin": false + }, + "appid": "ttef6599d8705b49b101", + "projectname": "tt富茂C", + "condition": { + "miniprogram": { + "current": -1, + "list": [ + { + "id": 1647410836514, + "name": "10积分兑换代金券一张", + "pathName": "pages/index/index", + "query": "couponChannelId=660689095507763200", + "scene": "", + "launchFrom": "", + "location": "" + }, + { + "id": 1648016638517, + "name": "鸭鸭服饰", + "pathName": "pages/index/index", + "query": "id=666438721331978240&frommd=md&type=md", + "scene": "", + "launchFrom": "", + "location": "" + } + ] + } + } +} diff --git a/utils/HttpBasics.js b/utils/HttpBasics.js new file mode 100644 index 0000000..74858ba --- /dev/null +++ b/utils/HttpBasics.js @@ -0,0 +1,119 @@ +const config = require("../config/config.js"); +class HttpBasics { + constructor(address) { + if (address) { + this.address = address; + } + } + /** + * 配置 + */ + config = config; + /** + * 请求路径前缀 + */ + address ='https://ctest.malls.iformall.com/C/api';//测试 + // address ='https://c.jcwise.cn/tt/api';//生产 + /** + * 请求头 + */ + headers = { + "Content-Type": "application/json;charset=UTF-8", + token: "", + // token:"3ab2afa2-f704-4086-b6e5-ad0715c7e2a1:1027:tt-cuser" + }; + /** + * 设置token + * @param {*} token + */ + setToken(token) { + this.headers.token = token; + } + /** + * 获取数据 + * @param {url,data,headers} param0 + */ + get({ url, data, headers }) { + headers = { ...this.headers, ...headers }; + url = `${this.address}${url}`; + return new Promise((resolve, reject) => { + tt.request({ + url: url, + header: headers, + data: data, + method: "get", + success: res => { + this.responseMap(res, resolve, reject); + }, + fail: err => { + console.log(err) + if (err.errMsg == 'request:fail timeout') { + err.errMsg = '请求超时,请检查您的网络设置!' + } else if (err.errMsg == 'request:fail'){ + err.errMsg = '未检查到您的网络,请检查您的网络设置!' + } else if (err.errMsg == 'request:fail request connect error') { + err.errMsg = '连接失败' + } + reject(err); + } + }); + }); + } + /** + * 提交数据 + * @param {url,data,headers} param0 + */ + post({ url, data, headers }) { + headers = { ...this.headers, ...headers }; + url = `${this.address}${url}`; + return new Promise((resolve, reject) => { + tt.request({ + url: url, + header: headers, + data: data, + method: "post", + success: res => { + this.responseMap(res, resolve, reject); + }, + fail: err => { + if (err.errMsg == 'request:fail timeout') { + err.errMsg = '请求超时,请检查您的网络设置!' + } else if (err.errMsg == 'request:fail') { + err.errMsg = '未检查到您的网络,请检查您的网络设置!' + } else if (err.errMsg == 'request:fail request connect error') { + err.errMsg = '连接失败' + } + reject(err); + }, + complete: res => {} + }); + }); + } + /** + * 过滤 请求信息 + * @param {*} res + * @param {*} resolve + * @param {*} reject + */ + responseMap = (res, resolve, reject) => { + // 网络状态码200 + if (res.statusCode == 200) { + // 服务器code 200 成功 + if (res.data.code == 200) { + resolve(res.data); + } else if (res.data.code == 1052) { + tt.reLaunch({ + url: '/pages/index/index' + }) + } else { + reject(res.data); + } + } else { + console.log("请求出错:", res); + reject(res.data); + } + }; + /** 日志 */ + log(url, body, headers) {} +} +module.exports = new HttpBasics(); diff --git a/utils/barcode.js b/utils/barcode.js new file mode 100644 index 0000000..0a94287 --- /dev/null +++ b/utils/barcode.js @@ -0,0 +1,392 @@ +var CHAR_TILDE = 126; +var CODE_FNC1 = 102; + +var SET_STARTA = 103; +var SET_STARTB = 104; +var SET_STARTC = 105; +var SET_SHIFT = 98; +var SET_CODEA = 101; +var SET_CODEB = 100; +var SET_STOP = 106; + + +var REPLACE_CODES = { + CHAR_TILDE: CODE_FNC1 //~ corresponds to FNC1 in GS1-128 standard +} + +var CODESET = { + ANY: 1, + AB: 2, + A: 3, + B: 4, + C: 5 +}; + +function getBytes(str) { + var bytes = []; + for (var i = 0; i < str.length; i++) { + bytes.push(str.charCodeAt(i)); + } + return bytes; +} + +exports.code128 = function(ctx, text, width, height) { + + width = parseInt(width); + + height = parseInt(height); + + var codes = stringToCode128(text); + + var g = new Graphics(ctx, width, height); + + var barWeight = g.area.width / ((codes.length - 3) * 11 + 35); + + var x = g.area.left; + var y = g.area.top; + for (var i = 0; i < codes.length; i++) { + var c = codes[i]; + //two bars at a time: 1 black and 1 white + for (var bar = 0; bar < 8; bar += 2) { + var barW = PATTERNS[c][bar] * barWeight; + // var barH = height - y - this.border; + var barH = height - y; + var spcW = PATTERNS[c][bar + 1] * barWeight; + + //no need to draw if 0 width + if (barW > 0) { + g.fillFgRect(x, y, barW, barH); + } + + x += barW + spcW; + } + } + + ctx.draw(); +} + + +function stringToCode128(text) { + + var barc = { + currcs: CODESET.C + }; + + var bytes = getBytes(text); + //decide starting codeset + var index = bytes[0] == CHAR_TILDE ? 1 : 0; + + var csa1 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB; + var csa2 = bytes.length > 0 ? codeSetAllowedFor(bytes[index++]) : CODESET.AB; + barc.currcs = getBestStartSet(csa1, csa2); + barc.currcs = perhapsCodeC(bytes, barc.currcs); + + //if no codeset changes this will end up with bytes.length+3 + //start, checksum and stop + var codes = new Array(); + + switch (barc.currcs) { + case CODESET.A: + codes.push(SET_STARTA); + break; + case CODESET.B: + codes.push(SET_STARTB); + break; + default: + codes.push(SET_STARTC); + break; + } + + + for (var i = 0; i < bytes.length; i++) { + var b1 = bytes[i]; //get the first of a pair + //should we translate/replace + if (b1 in REPLACE_CODES) { + codes.push(REPLACE_CODES[b1]); + i++ //jump to next + b1 = bytes[i]; + } + + //get the next in the pair if possible + var b2 = bytes.length > (i + 1) ? bytes[i + 1] : -1; + + codes = codes.concat(codesForChar(b1, b2, barc.currcs)); + //code C takes 2 chars each time + if (barc.currcs == CODESET.C) i++; + } + + //calculate checksum according to Code 128 standards + var checksum = codes[0]; + for (var weight = 1; weight < codes.length; weight++) { + checksum += (weight * codes[weight]); + } + codes.push(checksum % 103); + + codes.push(SET_STOP); + + //encoding should now be complete + return codes; + + function getBestStartSet(csa1, csa2) { + //tries to figure out the best codeset + //to start with to get the most compact code + var vote = 0; + vote += csa1 == CODESET.A ? 1 : 0; + vote += csa1 == CODESET.B ? -1 : 0; + vote += csa2 == CODESET.A ? 1 : 0; + vote += csa2 == CODESET.B ? -1 : 0; + //tie goes to B due to my own predudices + return vote > 0 ? CODESET.A : CODESET.B; + } + + function perhapsCodeC(bytes, codeset) { + for (var i = 0; i < bytes.length; i++) { + var b = bytes[i] + if ((b < 48 || b > 57) && b != CHAR_TILDE) + return codeset; + } + return CODESET.C; + } + + //chr1 is current byte + //chr2 is the next byte to process. looks ahead. + function codesForChar(chr1, chr2, currcs) { + var result = []; + var shifter = -1; + + if (charCompatible(chr1, currcs)) { + if (currcs == CODESET.C) { + if (chr2 == -1) { + shifter = SET_CODEB; + currcs = CODESET.B; + } else if ((chr2 != -1) && !charCompatible(chr2, currcs)) { + //need to check ahead as well + if (charCompatible(chr2, CODESET.A)) { + shifter = SET_CODEA; + currcs = CODESET.A; + } else { + shifter = SET_CODEB; + currcs = CODESET.B; + } + } + } + } else { + //if there is a next char AND that next char is also not compatible + if ((chr2 != -1) && !charCompatible(chr2, currcs)) { + //need to switch code sets + switch (currcs) { + case CODESET.A: + shifter = SET_CODEB; + currcs = CODESET.B; + break; + case CODESET.B: + shifter = SET_CODEA; + currcs = CODESET.A; + break; + } + } else { + //no need to shift code sets, a temporary SHIFT will suffice + shifter = SET_SHIFT; + } + } + + //ok some type of shift is nessecary + if (shifter != -1) { + result.push(shifter); + result.push(codeValue(chr2)); + } else { + if (currcs == CODESET.C) { + //include next as well + result.push(codeValue(chr1, chr2)); + } else { + result.push(codeValue(chr1)); + } + } + barc.currcs = currcs; + + return result; + } +} + +//reduce the ascii code to fit into the Code128 char table +function codeValue(chr1, chr2) { + if (typeof chr2 == "undefined") { + return chr1 >= 32 ? chr1 - 32 : chr1 + 64; + } else { + return parseInt(String.fromCharCode(chr1) + String.fromCharCode(chr2)); + } +} + +function charCompatible(chr, codeset) { + var csa = codeSetAllowedFor(chr); + if (csa == CODESET.ANY) return true; + //if we need to change from current + if (csa == CODESET.AB) return true; + if (csa == CODESET.A && codeset == CODESET.A) return true; + if (csa == CODESET.B && codeset == CODESET.B) return true; + return false; +} + +function codeSetAllowedFor(chr) { + if (chr >= 48 && chr <= 57) { + //0-9 + return CODESET.ANY; + } else if (chr >= 32 && chr <= 95) { + //0-9 A-Z + return CODESET.AB; + } else { + //if non printable + return chr < 32 ? CODESET.A : CODESET.B; + } +} + +var Graphics = function(ctx, width, height) { + + this.width = width; + this.height = height; + this.quiet = Math.round(this.width / 40); + + this.border_size = 0; + this.padding_width = 0; + + this.area = { + width: width - this.padding_width * 2 - this.quiet * 2, + height: height - this.border_size * 2, + top: this.border_size - 4, + left: this.padding_width + this.quiet + }; + + this.ctx = ctx; + this.fg = "#000000"; + this.bg = "#ffffff"; + + // fill background + this.fillBgRect(0, 0, width, height); + + // fill center to create border + this.fillBgRect(0, this.border_size, width, height - this.border_size * 2); +} + +//use native color +Graphics.prototype._fillRect = function(x, y, width, height, color) { + this.ctx.setFillStyle(color) + this.ctx.fillRect(x, y, width, height) +} + +Graphics.prototype.fillFgRect = function(x, y, width, height) { + this._fillRect(x, y, width, height, this.fg); +} + +Graphics.prototype.fillBgRect = function(x, y, width, height) { + this._fillRect(x, y, width, height, this.bg); +} + +var PATTERNS = [ + [2, 1, 2, 2, 2, 2, 0, 0], // 0 + [2, 2, 2, 1, 2, 2, 0, 0], // 1 + [2, 2, 2, 2, 2, 1, 0, 0], // 2 + [1, 2, 1, 2, 2, 3, 0, 0], // 3 + [1, 2, 1, 3, 2, 2, 0, 0], // 4 + [1, 3, 1, 2, 2, 2, 0, 0], // 5 + [1, 2, 2, 2, 1, 3, 0, 0], // 6 + [1, 2, 2, 3, 1, 2, 0, 0], // 7 + [1, 3, 2, 2, 1, 2, 0, 0], // 8 + [2, 2, 1, 2, 1, 3, 0, 0], // 9 + [2, 2, 1, 3, 1, 2, 0, 0], // 10 + [2, 3, 1, 2, 1, 2, 0, 0], // 11 + [1, 1, 2, 2, 3, 2, 0, 0], // 12 + [1, 2, 2, 1, 3, 2, 0, 0], // 13 + [1, 2, 2, 2, 3, 1, 0, 0], // 14 + [1, 1, 3, 2, 2, 2, 0, 0], // 15 + [1, 2, 3, 1, 2, 2, 0, 0], // 16 + [1, 2, 3, 2, 2, 1, 0, 0], // 17 + [2, 2, 3, 2, 1, 1, 0, 0], // 18 + [2, 2, 1, 1, 3, 2, 0, 0], // 19 + [2, 2, 1, 2, 3, 1, 0, 0], // 20 + [2, 1, 3, 2, 1, 2, 0, 0], // 21 + [2, 2, 3, 1, 1, 2, 0, 0], // 22 + [3, 1, 2, 1, 3, 1, 0, 0], // 23 + [3, 1, 1, 2, 2, 2, 0, 0], // 24 + [3, 2, 1, 1, 2, 2, 0, 0], // 25 + [3, 2, 1, 2, 2, 1, 0, 0], // 26 + [3, 1, 2, 2, 1, 2, 0, 0], // 27 + [3, 2, 2, 1, 1, 2, 0, 0], // 28 + [3, 2, 2, 2, 1, 1, 0, 0], // 29 + [2, 1, 2, 1, 2, 3, 0, 0], // 30 + [2, 1, 2, 3, 2, 1, 0, 0], // 31 + [2, 3, 2, 1, 2, 1, 0, 0], // 32 + [1, 1, 1, 3, 2, 3, 0, 0], // 33 + [1, 3, 1, 1, 2, 3, 0, 0], // 34 + [1, 3, 1, 3, 2, 1, 0, 0], // 35 + [1, 1, 2, 3, 1, 3, 0, 0], // 36 + [1, 3, 2, 1, 1, 3, 0, 0], // 37 + [1, 3, 2, 3, 1, 1, 0, 0], // 38 + [2, 1, 1, 3, 1, 3, 0, 0], // 39 + [2, 3, 1, 1, 1, 3, 0, 0], // 40 + [2, 3, 1, 3, 1, 1, 0, 0], // 41 + [1, 1, 2, 1, 3, 3, 0, 0], // 42 + [1, 1, 2, 3, 3, 1, 0, 0], // 43 + [1, 3, 2, 1, 3, 1, 0, 0], // 44 + [1, 1, 3, 1, 2, 3, 0, 0], // 45 + [1, 1, 3, 3, 2, 1, 0, 0], // 46 + [1, 3, 3, 1, 2, 1, 0, 0], // 47 + [3, 1, 3, 1, 2, 1, 0, 0], // 48 + [2, 1, 1, 3, 3, 1, 0, 0], // 49 + [2, 3, 1, 1, 3, 1, 0, 0], // 50 + [2, 1, 3, 1, 1, 3, 0, 0], // 51 + [2, 1, 3, 3, 1, 1, 0, 0], // 52 + [2, 1, 3, 1, 3, 1, 0, 0], // 53 + [3, 1, 1, 1, 2, 3, 0, 0], // 54 + [3, 1, 1, 3, 2, 1, 0, 0], // 55 + [3, 3, 1, 1, 2, 1, 0, 0], // 56 + [3, 1, 2, 1, 1, 3, 0, 0], // 57 + [3, 1, 2, 3, 1, 1, 0, 0], // 58 + [3, 3, 2, 1, 1, 1, 0, 0], // 59 + [3, 1, 4, 1, 1, 1, 0, 0], // 60 + [2, 2, 1, 4, 1, 1, 0, 0], // 61 + [4, 3, 1, 1, 1, 1, 0, 0], // 62 + [1, 1, 1, 2, 2, 4, 0, 0], // 63 + [1, 1, 1, 4, 2, 2, 0, 0], // 64 + [1, 2, 1, 1, 2, 4, 0, 0], // 65 + [1, 2, 1, 4, 2, 1, 0, 0], // 66 + [1, 4, 1, 1, 2, 2, 0, 0], // 67 + [1, 4, 1, 2, 2, 1, 0, 0], // 68 + [1, 1, 2, 2, 1, 4, 0, 0], // 69 + [1, 1, 2, 4, 1, 2, 0, 0], // 70 + [1, 2, 2, 1, 1, 4, 0, 0], // 71 + [1, 2, 2, 4, 1, 1, 0, 0], // 72 + [1, 4, 2, 1, 1, 2, 0, 0], // 73 + [1, 4, 2, 2, 1, 1, 0, 0], // 74 + [2, 4, 1, 2, 1, 1, 0, 0], // 75 + [2, 2, 1, 1, 1, 4, 0, 0], // 76 + [4, 1, 3, 1, 1, 1, 0, 0], // 77 + [2, 4, 1, 1, 1, 2, 0, 0], // 78 + [1, 3, 4, 1, 1, 1, 0, 0], // 79 + [1, 1, 1, 2, 4, 2, 0, 0], // 80 + [1, 2, 1, 1, 4, 2, 0, 0], // 81 + [1, 2, 1, 2, 4, 1, 0, 0], // 82 + [1, 1, 4, 2, 1, 2, 0, 0], // 83 + [1, 2, 4, 1, 1, 2, 0, 0], // 84 + [1, 2, 4, 2, 1, 1, 0, 0], // 85 + [4, 1, 1, 2, 1, 2, 0, 0], // 86 + [4, 2, 1, 1, 1, 2, 0, 0], // 87 + [4, 2, 1, 2, 1, 1, 0, 0], // 88 + [2, 1, 2, 1, 4, 1, 0, 0], // 89 + [2, 1, 4, 1, 2, 1, 0, 0], // 90 + [4, 1, 2, 1, 2, 1, 0, 0], // 91 + [1, 1, 1, 1, 4, 3, 0, 0], // 92 + [1, 1, 1, 3, 4, 1, 0, 0], // 93 + [1, 3, 1, 1, 4, 1, 0, 0], // 94 + [1, 1, 4, 1, 1, 3, 0, 0], // 95 + [1, 1, 4, 3, 1, 1, 0, 0], // 96 + [4, 1, 1, 1, 1, 3, 0, 0], // 97 + [4, 1, 1, 3, 1, 1, 0, 0], // 98 + [1, 1, 3, 1, 4, 1, 0, 0], // 99 + [1, 1, 4, 1, 3, 1, 0, 0], // 100 + [3, 1, 1, 1, 4, 1, 0, 0], // 101 + [4, 1, 1, 1, 3, 1, 0, 0], // 102 + [2, 1, 1, 4, 1, 2, 0, 0], // 103 + [2, 1, 1, 2, 1, 4, 0, 0], // 104 + [2, 1, 1, 2, 3, 2, 0, 0], // 105 + [2, 3, 3, 1, 1, 1, 2, 0] // 106 +] \ No newline at end of file diff --git a/utils/bgColor.js b/utils/bgColor.js new file mode 100644 index 0000000..99c3b1a --- /dev/null +++ b/utils/bgColor.js @@ -0,0 +1,38 @@ +module.exports = { + colorFirst:{ + // 我的 + "user": { + "banneColor": "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)", + "levelBg":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)", + "view":"#FD832D", + "backColor":"#cc6633" + }, + //首页 + "main": { + "chengzhangBox":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)", + "activeColor":"#FC8B37", + "qg":"#FD782D", + "sql":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)", + "txt": "#2C8DFF", + }, + + }, + colorSecond:{ + // 我的 + "user": { + "banneColor": "linear-gradient(180deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)", + "levelBg": "linear-gradient(180deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)", + "view": "#FF1D30" + }, + //首页 + "main": { + "chengzhangBox": "linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)", + "activeColor": "#2C8DFF", + "qg": "#31A5FC", + "sql": "linear-gradient(127deg,rgba(119,192,254,1) 0%,rgba(48,120,255,1) 100%)", + "txt":"#FF1D30", + }, + } + + +} \ No newline at end of file diff --git a/utils/creditType.js b/utils/creditType.js new file mode 100644 index 0000000..3ec9fc7 --- /dev/null +++ b/utils/creditType.js @@ -0,0 +1,19 @@ +let creditType=[ + { name: "每日登录", value: "1" }, + { name: "消费", value: "2" }, + { name: "绑车牌", value: "3" }, + { name: "连接WIFI", value: "4" }, + { name: "微信昵称授权", value: "5" }, + { name: "微信用户手机授权", value: "6" }, + { name: "完善个人信息", value: "7" }, + { name: "积分导入", value: "8" }, + { name: "消费积分", value: "9" }, + { name: "新增积分", value: "10" }, + { name: "积分兑换", value: "11" }, + { name: "消费积分", value: "12" }, + { name: "活动报名", value: "13" }, + { name: "积分清零计划", value: "14" } +] +module.exports = { + creditType +} \ No newline at end of file diff --git a/utils/imgurl.js b/utils/imgurl.js new file mode 100644 index 0000000..324c831 --- /dev/null +++ b/utils/imgurl.js @@ -0,0 +1,776 @@ +const baseUrl = 'https://formall.oss-accelerate.aliyuncs.com/cimg/' +module.exports = { + 'upDataRq':{ + 'url': baseUrl + "upDataRq.png", + "name":"" + }, + 'upDataRqF': { + 'url': baseUrl + "upDataRqF.png", + "name": "" + }, + 'xiangshang':{ + 'url': baseUrl +"xiangshang.png", + "name":"" + }, + 'map':{ + 'url': baseUrl + "ditufubiao.png", + "name": "" + }, + 'concealBnt':{ + "url": baseUrl +'xiala.png', + "naem":'' + }, + 'act': { + 'url': baseUrl + 'act.png', + 'name': '' + }, + 'shoppingAtlas':{ + 'url': baseUrl + 'shoppingAtlas.png', + 'name': '' + }, + 'shareDefaultTp':{ + 'url': baseUrl +'mall_default.jpg', + 'name':'' + }, + 'active': { + 'url': baseUrl + 'active.gif', + 'name': '' + }, + 'add': { + 'url': baseUrl + 'add.png', + 'name': '' + }, + 'jiaofeiwm':{ + 'url': baseUrl + 'jiaofeiwm.png', + 'name': '缴费规则' + }, + 'addr-white': { + 'url': baseUrl + 'addr-white.png', + 'name': '' + }, + 'guanbi1': { + 'url': baseUrl + 'guanbi1.png', + 'name': '首页游戏的关闭按钮' + }, + 'usergift': { + 'url': baseUrl + 'usergift.gif', + 'name': '首页悬浮游戏入口' + }, + 'addr': { + 'url': baseUrl + 'addr.png', + 'name': '' + }, + 'addresslogo': { + 'url': baseUrl + 'addresslogo.png', + 'name': '' + }, + 'alipay': { + 'url': baseUrl + 'alipay.png', + 'name': '' + }, + 'banner': { + 'url': baseUrl + 'banner.png', + 'name': '' + }, + 'wmclose': { + 'url': baseUrl + 'wmclose.png', + 'name': '余额不足' + }, + 'bg': { + 'url': baseUrl + 'bg.png', + 'name': '' + }, + 'cardicon': { + 'url': baseUrl + 'cardicon2.png', + 'name': '' + }, + 'che': { + 'url': baseUrl + 'che1.png', + 'name': '' + }, + 'choice': { + 'url': baseUrl + 'choice.png', + 'name': '' + }, + 'choiced': { + 'url': baseUrl + 'choiced.png', + 'name': '' + }, + 'clock': { + 'url': baseUrl + 'clock.png', + 'name': '' + }, + 'yushou': { + 'url': baseUrl + 'yushou.png', + 'name': '' + }, + 'closed': { + 'url': baseUrl + 'closed.png', + 'name': '' + }, + 'coupon': { + 'url': baseUrl + 'coupon.png', + 'name': '' + }, + 'noCoupon': { + 'url': baseUrl + 'noCoupon.png', + 'name': '' + }, + 'ding': { + 'url': baseUrl + 'ding2.png', + 'name': '' + }, + 'dingdan': { + 'url': baseUrl + 'dingdan.png', + 'name': '' + }, + 'noOrders': { + 'url': baseUrl + 'noOrders.png', + 'name': '' + }, + 'down-white': { + 'url': baseUrl + 'down-white.png', + 'name': '' + }, + 'down': { + 'url': baseUrl + 'down.png', + 'name': '' + }, + 'edit': { + 'url': baseUrl + 'edit.png', + 'name': '' + }, + 'fail': { + 'url': baseUrl + 'fail.png', + 'name': '' + }, + 'fenxiang1': { + 'url': baseUrl + 'fenxiang1.png', + 'name': '' + }, + 'game': { + 'url': baseUrl + 'game.png', + 'name': '' + }, + 'gift': { + 'url': baseUrl + 'gift1.png', + 'name': '' + }, + 'wmgift': { + 'url': baseUrl + 'wmgift.png', + 'name': '' + }, + 'gou': { + 'url': baseUrl + 'gou.png', + 'name': '' + }, + 'gouHr': { + 'url': baseUrl + 'gouHr.png', + 'name': '' + }, + 'grade': { + 'url': baseUrl + 'grade.png', + 'name': '' + }, + 'grade1': { + 'url': baseUrl + 'grade1.png', + 'name': '' + }, + 'grade2': { + 'url': baseUrl + 'grade2.png', + 'name': '' + }, + 'grade3': { + 'url': baseUrl + 'grade3.png', + 'name': '' + }, + 'growthbg': { + 'url': baseUrl + 'growthbg.png', + 'name': '' + }, + 'headbg': { + 'url': baseUrl + 'headbg.png', + 'name': '' + }, + 'home-n': { + 'url': baseUrl + 'home-n.png', + 'name': '' + }, + 'home-y': { + 'url': baseUrl + 'home-y.png', + 'name': '' + }, + 'jian': { + 'url': baseUrl + 'jian.png', + 'name': '' + }, + 'jilu': { + 'url': baseUrl + 'jilu.png', + 'name': '' + }, + 'topLine': { + 'url': baseUrl + 'topLine.png', + 'name': '' + }, + 'btomLine': { + 'url': baseUrl + 'btomLine.png', + 'name': '' + }, + 'line': { + 'url': baseUrl + 'line.png', + 'name': '' + }, + 'lines': { + 'url': baseUrl + 'lines.png', + 'name': '' + }, + 'liness': { + 'url': baseUrl + 'liness.png', + 'name': '' + }, + 'loading': { + 'url': baseUrl + 'loading.gif', + 'name': '' + }, + 'loading1': { + 'url': baseUrl + 'loading1.gif', + 'name': '' + }, + 'location': { + 'url': baseUrl + 'location.png', + 'name': '' + }, + 'logo': { + 'url': baseUrl + 'logo.png', + 'name': '' + }, + 'mine': { + 'url': baseUrl + 'mine.png', + 'name': '' + }, + 'myspeacial': { + 'url': baseUrl + 'myspeacial.jpg', + 'name': '' + }, + 'new1': { + 'url': baseUrl + 'new1.png', + 'name': '游戏' + }, + 'orbg': { + 'url': baseUrl + 'orbg.png', + 'name': '' + }, + 'park': { + 'url': baseUrl + 'park2.png', + 'name': '' + }, + 'parkCoupon': { + 'url': baseUrl + 'parkCoupon.png', + 'name': '' + }, + 'pass0': { + 'url': baseUrl + 'pass0.png', + 'name': '' + }, + 'pass1': { + 'url': baseUrl + 'pass1.png', + 'name': '' + }, + 'phone': { + 'url': baseUrl + 'phone.png', + 'name': '' + }, + 'platebg': { + 'url': baseUrl + 'platebg.png', + 'name': '' + }, + 'qidai': { + 'url': baseUrl + 'qidai.png', + 'name': '' + }, + 'qrcode': { + 'url': baseUrl + 'qrcode.png', + 'name': '' + }, + 'quan': { + 'url': baseUrl + 'quan1.png', + 'name': '' + }, + 'quans': { + 'url': baseUrl + 'quans2.png', + 'name': '' + }, + 'ques_bg': { + 'url': baseUrl + 'ques_bg.png', + 'name': '' + }, + 'ques_gou': { + 'url': baseUrl + 'ques_gou.png', + 'name': '' + }, + 'quesimg01': { + 'url': baseUrl + 'quesimg01.png', + 'name': '' + }, + 'redirect': { + 'url': baseUrl + 'redirect.png', + 'name': '' + }, + 'right': { + 'url': baseUrl + 'right.png', + 'name': '' + }, + 'rule': { + 'url': baseUrl + 'rule1.png', + 'name': '' + }, + 'shanchuGray': { + 'url': baseUrl + 'shanchu-gray.png', + 'name': '' + }, + 'shanchu': { + 'url': baseUrl + 'shanchu.png', + 'name': '' + }, + 'shang': { + 'url': baseUrl + 'shang.png', + 'name': '' + }, + 'share': { + 'url': baseUrl + 'share.png', + 'name': '' + }, + 'share01': { + 'url': baseUrl + 'share02.png', + 'name': '分享' + }, + 'spcode': { + 'url': baseUrl + 'spcode.png', + 'name': '' + }, + 'chevron': { + 'url': baseUrl + 'chevron.png', + 'name': '' + }, + 'spphone': { + 'url': baseUrl + 'spphone.png', + 'name': '' + }, + 'succ': { + 'url': baseUrl + 'succ.png', + 'name': '' + }, + 'success': { + 'url': baseUrl + 'success.png', + 'name': '' + }, + 'teljpg': { + 'url': baseUrl + 'tel1.jpg', + 'name': '' + }, + 'telpng': { + 'url': baseUrl + 'tel.png', + 'name': '' + }, + 'telicon': { + 'url': baseUrl + 'telicon.png', + 'name': '' + }, + 'user-n': { + 'url': baseUrl + 'user-n.png', + 'name': '' + }, + 'user-y': { + 'url': baseUrl + 'user-y.png', + 'name': '' + }, + 'wechat': { + 'url': baseUrl + 'wechat.png', + 'name': '' + }, + 'wenti': { + 'url': baseUrl + 'wenti1.png', + 'name': '' + }, + 'wm01': { + 'url': baseUrl + 'wm01.jpg', + 'name': '' + }, + 'wm02': { + 'url': baseUrl + 'wm02.jpg', + 'name': '' + }, + 'wm03': { + 'url': baseUrl + 'wm03.jpg', + 'name': '' + }, + 'wm04': { + 'url': baseUrl + 'wm04.jpg', + 'name': '' + }, + 'icon0001': { + 'url': baseUrl + 'icon0001.png', + 'name': '' + }, + 'icon0002': { + 'url': baseUrl + 'icon0002.png', + 'name': '' + }, + 'icon0003': { + 'url': baseUrl + 'icon0003.png', + 'name': '' + }, + 'icon0004': { + 'url': baseUrl + 'icon0004.png', + 'name': '' + }, + 'icon0005': { + 'url': baseUrl + 'icon0005.png', + 'name': '' + }, + 'icon0006': { + 'url': baseUrl + 'icon0006.png', + 'name': '' + }, + 'icon0007': { + 'url': baseUrl + 'icon0007.png', + 'name': '' + }, + 'icon0008': { + 'url': baseUrl + 'icon0008.png', + 'name': '' + }, + 'canTransferred': { + 'url': baseUrl + 'can-transferred.png', + 'name': '转赠图标' + }, + 'weixinTitle': { + 'url': baseUrl + 'weixin-title.png', + 'name': '微信图标' + }, + 'close02': { + 'url': baseUrl + 'close02.png', + 'name': '关闭图标' + }, + 'success01': { + 'url': baseUrl + 'success01.png', + 'name': '卡领取成功图标' + }, + 'sapellgroup': { + 'url': baseUrl + 'sapellgroup.png', + 'name': '拼团图标' + }, + 'spellBg': { + 'url': baseUrl + 'spell-bg.png', + 'name': '拼团背景图片' + }, + 'spellDetailBg': { + 'url': baseUrl + 'spelldetail-bg.png', + 'name': '拼团背景图片' + }, + 'tuanzhang': { + 'url': baseUrl + 'tuanzhang.png', + 'name': '团长' + }, + 'position': { + 'url': baseUrl + 'position.png', + 'name': '地理位置图标' + }, + 'close03': { + 'url': baseUrl + 'close03.png', + 'name': '拼团页面关闭图标' + }, + 'home': { + 'url': baseUrl + 'home.png', + 'name': '返回首页图标' + }, + 'nodata': { + 'url': baseUrl + 'nodata.png', + 'name': '拼团暂无数据' + }, + 'orderGroupFail': { + 'url': baseUrl + 'orderGroupFail.png', + 'name': '拼团失败' + }, + 'wmcard': { + 'url': baseUrl + 'wmcard.png', + 'name': '首页优惠卡' + }, + 'rushtobuy': { + 'url': baseUrl + 'rushtobuy.png', + 'name': '首页立即抢购' + }, + 'barginlistbg': { + 'url': baseUrl + 'barginlistbg.jpg', + 'name': '砍价列表背景图' + }, + 'bargindetailbg': { + 'url': baseUrl + 'bargindetailbg.jpg', + 'name': '砍价详情背景图' + }, + 'bargaincancel': { + 'url': baseUrl + 'bargaincancel.png', + 'name': '砍价取消' + }, + 'bargainfail': { + 'url': baseUrl + 'bargainfail.png', + 'name': '砍价失败' + }, + 'bargainsuccess': { + 'url': baseUrl + 'bargainsuccess.png', + 'name': '砍价成功' + }, + 'wmdiscount': { + 'url': baseUrl + 'discount.png', + 'name': '砍价图标' + }, + 'bgg': { + 'url': baseUrl + 'bgg.png', + 'name': 'banner背景' + }, + 'wmgive': { + 'url': baseUrl + 'wmgive.png', + 'name': '赠送' + }, + 'wmyes': { + 'url': baseUrl + 'wmyes.png', + 'name': '成功' + }, + 'wmhome': { + 'url': baseUrl + 'gobackhome.png', + 'name': '首页' + }, + 'wmhelp': { + 'url': baseUrl + 'wmhelp.gif', + 'name': '帮助好友砍价' + }, + 'wmsuccess01': { + 'url': baseUrl + 'wmsuccess01.png', + 'name': '帮好友砍价成功对勾' + }, + 'successHr': { + 'url': baseUrl + 'successHr.png', + 'name': '帮好友砍价成功对勾' + }, + 'pay_success': { + 'url': baseUrl + 'pay-success.png', + 'name': '消费卡付款成功' + }, + 'shixiao': { + 'url': baseUrl + 'shixiao.png', + 'name': '失效' + }, + + 'wmbarginicon': { + 'url': baseUrl + 'wmbarginicon2.png', + 'name': '我的砍价' + }, + 'wmspellgroup': { + 'url': baseUrl + 'wmspellgroup2.png', + 'name': '我的拼团' + }, + 'myactivity': { + 'url': baseUrl + 'myactivity.png', + 'name': '我的活动' + }, + 'myactivitygift': { + 'url': baseUrl + 'myactivitygift.png', + 'name': '我的奖品' + }, + 'leftarrows': { + 'url': baseUrl + 'leftarrows.png', + 'name': '左箭头' + }, + 'barcode': {//换肤 + 'url': baseUrl + 'lqcbarcode.png', + 'name': '二维码' + }, + 'poterbg': { + 'url': baseUrl + 'canvas.png', + 'name': '海报背景' + }, + 'newgroup': { + 'url': baseUrl + 'newgroup.png', + 'name': '新UI拼团' + }, + 'newbargain': { + 'url': baseUrl + 'newbargain.png', + 'name': '新UI砍价' + }, + 'newseckill': { + 'url': baseUrl + 'newseckill.png', + 'name': '新UI秒杀' + }, + 'newcard': { + 'url': baseUrl + 'newcard.png', + 'name': '新UI消费卡' + }, + 'product': { + 'url': baseUrl + 'product.png', + 'name': '新UI产品栏' + }, + 'barginicon': { + 'url': baseUrl + 'lqcbarginicon.png', + 'name': '砍价小图标' + }, + 'pintuan': { + 'url': baseUrl + 'lqcpintuan.png', + 'name': '拼团小图标' + }, + 'duihuan': { + 'url': baseUrl + 'exchange01.png', + 'name': '兑换小图标' + }, + 'wangmeimeibargin':{ + 'url': baseUrl + 'wangmeimeibargin.jpg', + 'name': '砍价专场的图标' + }, + 'wangmeimeipintuan': { + 'url': baseUrl + 'wangmeimeipintuan.png', + 'name': '拼团专场的图标' + }, + 'wangmeimeijiantou': { + 'url': baseUrl + 'wangmeimeijiantou.png', + 'name': '专场的更多图标' + }, + 'wangmeimeiarrow01': { + 'url': baseUrl + 'wangmeimeiarrow01.png', + 'name': '专场的更多图标' + }, + 'wangmeimeicredit':{ + 'url': baseUrl + "wangmeimeicredit.png", + 'name': '积分背景' + }, + 'wmintegral': { + 'url': baseUrl + "wmintegral1.png", + 'name': '积分商城' + }, + 'orange': { + 'url': baseUrl + "orange.png", + 'name': '积分商城' + }, + 'blue': { + 'url': baseUrl + "blue.png", + 'name': '积分商城' + }, + 'gray': { + 'url': baseUrl + "gray.png", + 'name': '积分商城' + }, + 'kanjia': { + 'url': baseUrl + "kanjia.png", + 'name': '砍价' + }, + 'pintuan': { + 'url': baseUrl + "pintuan.png", + 'name': '拼团' + }, + 'xiaofeika': { + 'url': baseUrl + "xiaofeika.png", + 'name': '消费卡' + }, + 'xingyun': { + 'url': baseUrl + "xingyunkapai.png", + 'name': '幸运卡牌' + }, + 'jfshangcheng': { + 'url': baseUrl + "jifenshangcheng.png", + 'name': '积分商城' + }, + 'toutiao': { + 'url': baseUrl + "toutiao.png", + 'name': '' + }, + 'more': { + 'url': baseUrl + "more.png", + 'name': '' + }, + 'change': { + 'url': baseUrl + "change.png", + 'name': '' + }, + 'None': { + 'url': baseUrl + "None.png", + 'name': '' + }, + 'fenxiang': { + 'url': baseUrl + "fenxiang.png", + 'name': '' + }, + 'homeSelectedO': { + 'url': baseUrl + "homeSelectedO.png", + 'name': '' + }, + 'noMerchant': { + 'url': baseUrl + "noMerchant.png", + 'name': '' + }, + 'rightHr': { + 'url': baseUrl + "rightHr.png", + 'name': '' + }, + 'cancelH': { + 'url': baseUrl + "cancelH.png", + 'name': '' + }, + 'giftHr': { + 'url': baseUrl + "giftHr.png", + 'name': '' + }, + 'next': { + 'url': baseUrl + "next.png", + 'name': '' + }, + 'erweima': { + 'url': baseUrl + "erweima.png", + 'name': '' + }, + 'guanliHr': { + 'url': baseUrl + "guanliHr.png", + 'name': '' + }, + 'tingcheHr': { + 'url': baseUrl + "tingcheHr.png", + 'name': '' + }, + 'wentiHr': { + 'url': baseUrl + "wentiHr.png", + 'name': '' + }, + 'stopThat':{ + 'url': baseUrl +"tingcheshiyong.png", + 'name': '' + }, + 'jiaofei': { + 'url': baseUrl + "jiaofei.png", + 'name': '' + }, + 'chenggong': { + 'url': baseUrl + "chenggong.png", + 'name': '' + }, + 'chenghr': { + 'url': baseUrl + "chenghr.png", + 'name': '' + }, + "aboutUs":{ + 'url': baseUrl + "we.png", + 'name': '' + }, + "sort":{ + "url":baseUrl + "noSort.png", + 'name':'' + }, + 'up':{ + 'url' : baseUrl + 'up.png', + 'name':'' + }, + 'down':{ + 'url' : baseUrl + 'down.png', + 'name':'' + }, + 'live': { + 'url': baseUrl + 'live.png', + 'name': '' + } +} \ No newline at end of file diff --git a/utils/iti.js b/utils/iti.js new file mode 100644 index 0000000..7b25455 --- /dev/null +++ b/utils/iti.js @@ -0,0 +1,87 @@ +const config = require("../config/config.js") +const Http = require("./HttpBasics.js") +function order(id) {//支付 + Http.post({//下订单 + url:config.api.order, + data:{ + couponId:this.data.id + } + }).then(res=>{ + console.log(res.data,"订单成功"); + let id = res.data.id + console.log(id); + Http.post({//拿orderInfo + url:config.api.pay, + data:{ + orderId:res.data.id + } + }).then(item=>{ + console.log(item,"orderId"); + tt.pay({ + service: 5, + orderInfo:{ + order_id:item.data.orderId, + order_token:item.data.token, + }, + success(res) { + if (res.code === 0) { + tt.showToast({ + title: '支付成功!', // 内容 + }); + + // 支付成功处理逻辑,只有res.code=0时,才表示支付成功 + // 但是最终状态要以商户后端结果为准 + }else if(res.code === 1){ + tt.showToast({ + title: '支付超时', // 内容 + icon:"none" + }); + Http.post({ + url:config.api.ifPayOk, + data:{ + code:1, + orderId:res.data.id + } + }) + }else if(res.code === 2){ + tt.showToast({ + title: '支付失败', // 内容 + icon:"none" + }); + }else if(res.code === 3){ + tt.showToast({ + title: '支付关闭', // 内容 + icon:"none" + }); + }else if(res.code === 4){ + tt.showToast({ + title: '支付取消', // 内容 + icon:"none" + }); + }else if(res.code === 9){ + tt.showToast({ + title: '订单状态开发者自行获取', // 内容 + icon:"none" + }); + } + }, + fail(res) { + // handle fail + }, + }) + }).catch(err=>{ + tt.showToast({ + title: '唤起支付失败', // 内容 + icon:"none" + }); + }) + }).catch(err=>{ + tt.showToast({ + title: err.message, // 内容 + icon:"none" + }); + }) +} +module.exports={ + order +} \ No newline at end of file diff --git a/utils/memberqrcode.js b/utils/memberqrcode.js new file mode 100644 index 0000000..972b354 --- /dev/null +++ b/utils/memberqrcode.js @@ -0,0 +1,843 @@ +!(function () { + + // alignment pattern + var adelta = [ + 0, 11, 15, 19, 23, 27, 31, + 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, + 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28 + ]; + + // version block + var vpat = [ + 0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, + 0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9, + 0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, + 0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, + 0x541, 0xc69 + ]; + + // final format bits with mask: level << 3 | mask + var fmtword = [ + 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L + 0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M + 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q + 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H + ]; + + // 4 per version: number of blocks 1,2; data width; ecc width + var eccblocks = [ + 1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, + 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, + 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, + 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, + 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, + 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, + 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, + 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, + 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, + 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, + 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, + 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, + 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, + 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, + 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, + 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, + 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, + 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, + 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, + 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, + 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, + 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, + 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, + 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, + 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, + 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, + 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, + 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, + 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, + 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, + 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, + 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, + 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, + 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, + 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, + 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, + 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, + 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, + 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, + 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30 + ]; + + // Galois field log table + var glog = [ + 0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, + 0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71, + 0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45, + 0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6, + 0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88, + 0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40, + 0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d, + 0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57, + 0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18, + 0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e, + 0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61, + 0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2, + 0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6, + 0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a, + 0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7, + 0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf + ]; + + // Galios field exponent table + var gexp = [ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, + 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, + 0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23, + 0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1, + 0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, + 0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2, + 0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce, + 0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc, + 0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54, + 0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73, + 0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff, + 0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41, + 0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6, + 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09, + 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16, + 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00 + ]; + + // Working buffers: + // data input and ecc append, image working buffer, fixed part of image, run lengths for badness + var strinbuf = [], eccbuf = [], qrframe = [], framask = [], rlens = []; + // Control values - width is based on version, last 4 are from table. + var version, width, neccblk1, neccblk2, datablkw, eccblkwid; + var ecclevel = 2; + // set bit to indicate cell in qrframe is immutable. symmetric around diagonal + function setmask(x, y) { + var bt; + if (x > y) { + bt = x; + x = y; + y = bt; + } + // y*y = 1+3+5... + bt = y; + bt *= y; + bt += y; + bt >>= 1; + bt += x; + framask[bt] = 1; + } + + // enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask) + function putalign(x, y) { + var j; + + qrframe[x + width * y] = 1; + for (j = -2; j < 2; j++) { + qrframe[(x + j) + width * (y - 2)] = 1; + qrframe[(x - 2) + width * (y + j + 1)] = 1; + qrframe[(x + 2) + width * (y + j)] = 1; + qrframe[(x + j + 1) + width * (y + 2)] = 1; + } + for (j = 0; j < 2; j++) { + setmask(x - 1, y + j); + setmask(x + 1, y - j); + setmask(x - j, y - 1); + setmask(x + j, y + 1); + } + } + + //======================================================================== + // Reed Solomon error correction + // exponentiation mod N + function modnn(x) { + while (x >= 255) { + x -= 255; + x = (x >> 8) + (x & 255); + } + return x; + } + + var genpoly = []; + + // Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given. + function appendrs(data, dlen, ecbuf, eclen) { + var i, j, fb; + + for (i = 0; i < eclen; i++) + strinbuf[ecbuf + i] = 0; + for (i = 0; i < dlen; i++) { + fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]]; + if (fb != 255) /* fb term is non-zero */ + for (j = 1; j < eclen; j++) + strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])]; + else + for (j = ecbuf; j < ecbuf + eclen; j++) + strinbuf[j] = strinbuf[j + 1]; + strinbuf[ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])]; + } + } + + //======================================================================== + // Frame data insert following the path rules + + // check mask - since symmetrical use half. + function ismasked(x, y) { + var bt; + if (x > y) { + bt = x; + x = y; + y = bt; + } + bt = y; + bt += y * y; + bt >>= 1; + bt += x; + return framask[bt]; + } + + //======================================================================== + // Apply the selected mask out of the 8. + function applymask(m) { + var x, y, r3x, r3y; + + switch (m) { + case 0: + for (y = 0; y < width; y++) + for (x = 0; x < width; x++) + if (!((x + y) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + break; + case 1: + for (y = 0; y < width; y++) + for (x = 0; x < width; x++) + if (!(y & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + break; + case 2: + for (y = 0; y < width; y++) + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!r3x && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + break; + case 3: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = r3y, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!r3x && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 4: + for (y = 0; y < width; y++) + for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++ , r3x++) { + if (r3x == 3) { + r3x = 0; + r3y = !r3y; + } + if (!r3y && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + break; + case 5: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 6: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 7: + for (r3y = 0, y = 0; y < width; y++ , r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++ , r3x++) { + if (r3x == 3) + r3x = 0; + if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + } + return; + } + + // Badness coefficients. + var N1 = 3, N2 = 3, N3 = 40, N4 = 10; + + // Using the table of the length of each run, calculate the amount of bad image + // - long runs or those that look like finders; called twice, once each for X and Y + function badruns(length) { + var i; + var runsbad = 0; + for (i = 0; i <= length; i++) + if (rlens[i] >= 5) + runsbad += N1 + rlens[i] - 5; + // BwBBBwB as in finder + for (i = 3; i < length - 1; i += 2) + if (rlens[i - 2] == rlens[i + 2] + && rlens[i + 2] == rlens[i - 1] + && rlens[i - 1] == rlens[i + 1] + && rlens[i - 1] * 3 == rlens[i] + // white around the black pattern? Not part of spec + && (rlens[i - 3] == 0 // beginning + || i + 3 > length // end + || rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4) + ) + runsbad += N3; + return runsbad; + } + + // Calculate how bad the masked image is - blocks, imbalance, runs, or finders. + function badcheck() { + var x, y, h, b, b1; + var thisbad = 0; + var bw = 0; + + // blocks of same color. + for (y = 0; y < width - 1; y++) + for (x = 0; x < width - 1; x++) + if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y] + && qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black + || !(qrframe[x + width * y] || qrframe[(x + 1) + width * y] + || qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white + thisbad += N2; + + // X runs + for (y = 0; y < width; y++) { + rlens[0] = 0; + for (h = b = x = 0; x < width; x++) { + if ((b1 = qrframe[x + width * y]) == b) + rlens[h]++; + else + rlens[++h] = 1; + b = b1; + bw += b ? 1 : -1; + } + thisbad += badruns(h); + } + + // black/white imbalance + if (bw < 0) + bw = -bw; + + var big = bw; + var count = 0; + big += big << 2; + big <<= 1; + while (big > width * width) + big -= width * width, count++; + thisbad += count * N4; + + // Y runs + for (x = 0; x < width; x++) { + rlens[0] = 0; + for (h = b = y = 0; y < width; y++) { + if ((b1 = qrframe[x + width * y]) == b) + rlens[h]++; + else + rlens[++h] = 1; + b = b1; + } + thisbad += badruns(h); + } + return thisbad; + } + + function genframe(instring) { + var x, y, k, t, v, i, j, m; + + // find the smallest version that fits the string + t = instring.length; + version = 0; + do { + version++; + k = (ecclevel - 1) * 4 + (version - 1) * 16; + neccblk1 = eccblocks[k++]; + neccblk2 = eccblocks[k++]; + datablkw = eccblocks[k++]; + eccblkwid = eccblocks[k]; + k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9); + if (t <= k) + break; + } while (version < 40); + + // FIXME - insure that it fits insted of being truncated + width = 17 + 4 * version; + + // allocate, clear and setup data structures + v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; + for (t = 0; t < v; t++) + eccbuf[t] = 0; + strinbuf = instring.slice(0); + + for (t = 0; t < width * width; t++) + qrframe[t] = 0; + + for (t = 0; t < (width * (width + 1) + 1) / 2; t++) + framask[t] = 0; + + // insert finders - black to frame, white to mask + for (t = 0; t < 3; t++) { + k = 0; + y = 0; + if (t == 1) + k = (width - 7); + if (t == 2) + y = (width - 7); + qrframe[(y + 3) + width * (k + 3)] = 1; + for (x = 0; x < 6; x++) { + qrframe[(y + x) + width * k] = 1; + qrframe[y + width * (k + x + 1)] = 1; + qrframe[(y + 6) + width * (k + x)] = 1; + qrframe[(y + x + 1) + width * (k + 6)] = 1; + } + for (x = 1; x < 5; x++) { + setmask(y + x, k + 1); + setmask(y + 1, k + x + 1); + setmask(y + 5, k + x); + setmask(y + x + 1, k + 5); + } + for (x = 2; x < 4; x++) { + qrframe[(y + x) + width * (k + 2)] = 1; + qrframe[(y + 2) + width * (k + x + 1)] = 1; + qrframe[(y + 4) + width * (k + x)] = 1; + qrframe[(y + x + 1) + width * (k + 4)] = 1; + } + } + + // alignment blocks + if (version > 1) { + t = adelta[version]; + y = width - 7; + for (; ;) { + x = width - 7; + while (x > t - 3) { + putalign(x, y); + if (x < t) + break; + x -= t; + } + if (y <= t + 9) + break; + y -= t; + putalign(6, y); + putalign(y, 6); + } + } + + // single black + qrframe[8 + width * (width - 8)] = 1; + + // timing gap - mask only + for (y = 0; y < 7; y++) { + setmask(7, y); + setmask(width - 8, y); + setmask(7, y + width - 7); + } + for (x = 0; x < 8; x++) { + setmask(x, 7); + setmask(x + width - 8, 7); + setmask(x, width - 8); + } + + // reserve mask-format area + for (x = 0; x < 9; x++) + setmask(x, 8); + for (x = 0; x < 8; x++) { + setmask(x + width - 8, 8); + setmask(8, x); + } + for (y = 0; y < 7; y++) + setmask(8, y + width - 7); + + // timing row/col + for (x = 0; x < width - 14; x++) + if (x & 1) { + setmask(8 + x, 6); + setmask(6, 8 + x); + } + else { + qrframe[(8 + x) + width * 6] = 1; + qrframe[6 + width * (8 + x)] = 1; + } + + // version block + if (version > 6) { + t = vpat[version - 7]; + k = 17; + for (x = 0; x < 6; x++) + for (y = 0; y < 3; y++ , k--) + if (1 & (k > 11 ? version >> (k - 12) : t >> k)) { + qrframe[(5 - x) + width * (2 - y + width - 11)] = 1; + qrframe[(2 - y + width - 11) + width * (5 - x)] = 1; + } + else { + setmask(5 - x, 2 - y + width - 11); + setmask(2 - y + width - 11, 5 - x); + } + } + + // sync mask bits - only set above for white spaces, so add in black bits + for (y = 0; y < width; y++) + for (x = 0; x <= y; x++) + if (qrframe[x + width * y]) + setmask(x, y); + + // convert string to bitstream + // 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported) + v = strinbuf.length; + + // string to array + for (i = 0; i < v; i++) + eccbuf[i] = strinbuf.charCodeAt(i); + strinbuf = eccbuf.slice(0); + + // calculate max string length + x = datablkw * (neccblk1 + neccblk2) + neccblk2; + if (v >= x - 2) { + v = x - 2; + if (version > 9) + v--; + } + + // shift and repack to insert length prefix + i = v; + if (version > 9) { + strinbuf[i + 2] = 0; + strinbuf[i + 3] = 0; + while (i--) { + t = strinbuf[i]; + strinbuf[i + 3] |= 255 & (t << 4); + strinbuf[i + 2] = t >> 4; + } + strinbuf[2] |= 255 & (v << 4); + strinbuf[1] = v >> 4; + strinbuf[0] = 0x40 | (v >> 12); + } + else { + strinbuf[i + 1] = 0; + strinbuf[i + 2] = 0; + while (i--) { + t = strinbuf[i]; + strinbuf[i + 2] |= 255 & (t << 4); + strinbuf[i + 1] = t >> 4; + } + strinbuf[1] |= 255 & (v << 4); + strinbuf[0] = 0x40 | (v >> 4); + } + // fill to end with pad pattern + i = v + 3 - (version < 10); + while (i < x) { + strinbuf[i++] = 0xec; + // buffer has room if (i == x) break; + strinbuf[i++] = 0x11; + } + + // calculate and append ECC + + // calculate generator polynomial + genpoly[0] = 1; + for (i = 0; i < eccblkwid; i++) { + genpoly[i + 1] = 1; + for (j = i; j > 0; j--) + genpoly[j] = genpoly[j] + ? genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1]; + genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)]; + } + for (i = 0; i <= eccblkwid; i++) + genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step + + // append ecc to data buffer + k = x; + y = 0; + for (i = 0; i < neccblk1; i++) { + appendrs(y, datablkw, k, eccblkwid); + y += datablkw; + k += eccblkwid; + } + for (i = 0; i < neccblk2; i++) { + appendrs(y, datablkw + 1, k, eccblkwid); + y += datablkw + 1; + k += eccblkwid; + } + // interleave blocks + y = 0; + for (i = 0; i < datablkw; i++) { + for (j = 0; j < neccblk1; j++) + eccbuf[y++] = strinbuf[i + j * datablkw]; + for (j = 0; j < neccblk2; j++) + eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; + } + for (j = 0; j < neccblk2; j++) + eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; + for (i = 0; i < eccblkwid; i++) + for (j = 0; j < neccblk1 + neccblk2; j++) + eccbuf[y++] = strinbuf[x + i + j * eccblkwid]; + strinbuf = eccbuf; + + // pack bits into frame avoiding masked area. + x = y = width - 1; + k = v = 1; // up, minus + /* inteleaved data and ecc codes */ + m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; + for (i = 0; i < m; i++) { + t = strinbuf[i]; + for (j = 0; j < 8; j++ , t <<= 1) { + if (0x80 & t) + qrframe[x + width * y] = 1; + do { // find next fill position + if (v) + x--; + else { + x++; + if (k) { + if (y != 0) + y--; + else { + x -= 2; + k = !k; + if (x == 6) { + x--; + y = 9; + } + } + } + else { + if (y != width - 1) + y++; + else { + x -= 2; + k = !k; + if (x == 6) { + x--; + y -= 8; + } + } + } + } + v = !v; + } while (ismasked(x, y)); + } + } + + // save pre-mask copy of frame + strinbuf = qrframe.slice(0); + t = 0; // best + y = 30000; // demerit + // for instead of while since in original arduino code + // if an early mask was "good enough" it wouldn't try for a better one + // since they get more complex and take longer. + for (k = 0; k < 8; k++) { + applymask(k); // returns black-white imbalance + x = badcheck(); + if (x < y) { // current mask better than previous best? + y = x; + t = k; + } + if (t == 7) + break; // don't increment i to a void redoing mask + qrframe = strinbuf.slice(0); // reset for next pass + } + if (t != k) // redo best mask - none good enough, last wasn't t + applymask(t); + + // add in final mask/ecclevel bytes + y = fmtword[t + ((ecclevel - 1) << 3)]; + // low byte + for (k = 0; k < 8; k++ , y >>= 1) + if (y & 1) { + qrframe[(width - 1 - k) + width * 8] = 1; + if (k < 6) + qrframe[8 + width * k] = 1; + else + qrframe[8 + width * (k + 1)] = 1; + } + // high byte + for (k = 0; k < 7; k++ , y >>= 1) + if (y & 1) { + qrframe[8 + width * (width - 7 + k)] = 1; + if (k) + qrframe[(6 - k) + width * 8] = 1; + else + qrframe[7 + width * 8] = 1; + } + return qrframe; + } + + + + + var _canvas = null; + + var api = { + + get ecclevel() { + return ecclevel; + }, + + set ecclevel(val) { + ecclevel = val; + }, + + get size() { + return _size; + }, + + set size(val) { + _size = val + }, + + get canvas() { + return _canvas; + }, + + set canvas(el) { + _canvas = el; + }, + + getFrame: function (string) { + return genframe(string); + }, + //这里的utf16to8(str)是对Text中的字符串进行转码,让其支持中文 + utf16to8: function (str) { + var out, i, len, c; + + out = ""; + len = str.length; + for (i = 0; i < len; i++) { + c = str.charCodeAt(i); + if ((c >= 0x0001) && (c <= 0x007F)) { + out += str.charAt(i); + } else if (c > 0x07FF) { + out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); + out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); + out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); + } else { + out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); + out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); + } + } + return out; + }, + /** + * 新增$this参数,传入组件的this,兼容在组件中生成 + */ + draw: function (str, canvas, cavW, cavH,cb,$this, ecc) { + var that = this; + ecclevel = ecc || ecclevel; + canvas = canvas || _canvas; + if (!canvas) { + console.warn('No canvas provided to draw QR code in!') + return; + } + + var size = Math.min(cavW, cavH); + str = that.utf16to8(str);//增加中文显示 + + var frame = that.getFrame(str), + // 组件中生成qrcode需要绑定this + ctx = tt.createCanvasContext(canvas,$this), + px = Math.round(size / (width + 8)); + var roundedSize = px * (width + 8), + offset = Math.floor((size - roundedSize) / 2); + size = roundedSize; + ctx.clearRect(0, 0, cavW, cavW); + ctx.setFillStyle('#ffffff') + ctx.fillRect(0, 0, cavW, cavW); + ctx.setFillStyle('#000000'); + for (var i = 0; i < width; i++) { + for (var j = 0; j < width; j++) { + if (frame[j * width + i]) { + ctx.fillRect(px * (4 + i) + offset, px * (4 + j) + offset, px, px); + } + } + } + ctx.draw(true, function () { + // 判断绘制方法,判断手机类型 + let brand = ""; + tt.getSystemInfo({ + success:function(res){ + console.log(res.brand) + brand = res.brand; + } + }) + if (brand == 'iPhone') { + tt.canvasToTempFilePath({ + x: 0, + y: 0, + width: cavW, + height: cavH, + destWidth: cavW, + destHeight: cavH, + canvasId: canvas, + fail: function (res) { + console.log(res) + }, + success: function (res) { + if (cb) { + cb(res.tempFilePath); + }; + } + }) + + } else { + + // 延迟加载 + setTimeout(function () { + tt.canvasToTempFilePath({ + x: 0, + y: 0, + width: cavW, + height: cavH, + destWidth: cavW, + destHeight: cavH, + canvasId: canvas, + fail: function (res) { + console.log(res) + }, + success: function (res) { + + if (cb) { + cb(res.tempFilePath); + }; + } + }) + + }, 1000) + } + }); + + + } + } + module.exports = { api } + // exports.draw = api; +})(); \ No newline at end of file diff --git a/utils/qrcode.js b/utils/qrcode.js new file mode 100644 index 0000000..e4c994e --- /dev/null +++ b/utils/qrcode.js @@ -0,0 +1,778 @@ +var QR = (function () { + + // alignment pattern + var adelta = [ + 0, 11, 15, 19, 23, 27, 31, // force 1 pat + 16, 18, 20, 22, 24, 26, 28, 20, 22, 24, 24, 26, 28, 28, 22, 24, 24, + 26, 26, 28, 28, 24, 24, 26, 26, 26, 28, 28, 24, 26, 26, 26, 28, 28 + ]; + + // version block + var vpat = [ + 0xc94, 0x5bc, 0xa99, 0x4d3, 0xbf6, 0x762, 0x847, 0x60d, + 0x928, 0xb78, 0x45d, 0xa17, 0x532, 0x9a6, 0x683, 0x8c9, + 0x7ec, 0xec4, 0x1e1, 0xfab, 0x08e, 0xc1a, 0x33f, 0xd75, + 0x250, 0x9d5, 0x6f0, 0x8ba, 0x79f, 0xb0b, 0x42e, 0xa64, + 0x541, 0xc69 + ]; + + // final format bits with mask: level << 3 | mask + var fmtword = [ + 0x77c4, 0x72f3, 0x7daa, 0x789d, 0x662f, 0x6318, 0x6c41, 0x6976, //L + 0x5412, 0x5125, 0x5e7c, 0x5b4b, 0x45f9, 0x40ce, 0x4f97, 0x4aa0, //M + 0x355f, 0x3068, 0x3f31, 0x3a06, 0x24b4, 0x2183, 0x2eda, 0x2bed, //Q + 0x1689, 0x13be, 0x1ce7, 0x19d0, 0x0762, 0x0255, 0x0d0c, 0x083b //H + ]; + + // 4 per version: number of blocks 1,2; data width; ecc width + var eccblocks = [ + 1, 0, 19, 7, 1, 0, 16, 10, 1, 0, 13, 13, 1, 0, 9, 17, + 1, 0, 34, 10, 1, 0, 28, 16, 1, 0, 22, 22, 1, 0, 16, 28, + 1, 0, 55, 15, 1, 0, 44, 26, 2, 0, 17, 18, 2, 0, 13, 22, + 1, 0, 80, 20, 2, 0, 32, 18, 2, 0, 24, 26, 4, 0, 9, 16, + 1, 0, 108, 26, 2, 0, 43, 24, 2, 2, 15, 18, 2, 2, 11, 22, + 2, 0, 68, 18, 4, 0, 27, 16, 4, 0, 19, 24, 4, 0, 15, 28, + 2, 0, 78, 20, 4, 0, 31, 18, 2, 4, 14, 18, 4, 1, 13, 26, + 2, 0, 97, 24, 2, 2, 38, 22, 4, 2, 18, 22, 4, 2, 14, 26, + 2, 0, 116, 30, 3, 2, 36, 22, 4, 4, 16, 20, 4, 4, 12, 24, + 2, 2, 68, 18, 4, 1, 43, 26, 6, 2, 19, 24, 6, 2, 15, 28, + 4, 0, 81, 20, 1, 4, 50, 30, 4, 4, 22, 28, 3, 8, 12, 24, + 2, 2, 92, 24, 6, 2, 36, 22, 4, 6, 20, 26, 7, 4, 14, 28, + 4, 0, 107, 26, 8, 1, 37, 22, 8, 4, 20, 24, 12, 4, 11, 22, + 3, 1, 115, 30, 4, 5, 40, 24, 11, 5, 16, 20, 11, 5, 12, 24, + 5, 1, 87, 22, 5, 5, 41, 24, 5, 7, 24, 30, 11, 7, 12, 24, + 5, 1, 98, 24, 7, 3, 45, 28, 15, 2, 19, 24, 3, 13, 15, 30, + 1, 5, 107, 28, 10, 1, 46, 28, 1, 15, 22, 28, 2, 17, 14, 28, + 5, 1, 120, 30, 9, 4, 43, 26, 17, 1, 22, 28, 2, 19, 14, 28, + 3, 4, 113, 28, 3, 11, 44, 26, 17, 4, 21, 26, 9, 16, 13, 26, + 3, 5, 107, 28, 3, 13, 41, 26, 15, 5, 24, 30, 15, 10, 15, 28, + 4, 4, 116, 28, 17, 0, 42, 26, 17, 6, 22, 28, 19, 6, 16, 30, + 2, 7, 111, 28, 17, 0, 46, 28, 7, 16, 24, 30, 34, 0, 13, 24, + 4, 5, 121, 30, 4, 14, 47, 28, 11, 14, 24, 30, 16, 14, 15, 30, + 6, 4, 117, 30, 6, 14, 45, 28, 11, 16, 24, 30, 30, 2, 16, 30, + 8, 4, 106, 26, 8, 13, 47, 28, 7, 22, 24, 30, 22, 13, 15, 30, + 10, 2, 114, 28, 19, 4, 46, 28, 28, 6, 22, 28, 33, 4, 16, 30, + 8, 4, 122, 30, 22, 3, 45, 28, 8, 26, 23, 30, 12, 28, 15, 30, + 3, 10, 117, 30, 3, 23, 45, 28, 4, 31, 24, 30, 11, 31, 15, 30, + 7, 7, 116, 30, 21, 7, 45, 28, 1, 37, 23, 30, 19, 26, 15, 30, + 5, 10, 115, 30, 19, 10, 47, 28, 15, 25, 24, 30, 23, 25, 15, 30, + 13, 3, 115, 30, 2, 29, 46, 28, 42, 1, 24, 30, 23, 28, 15, 30, + 17, 0, 115, 30, 10, 23, 46, 28, 10, 35, 24, 30, 19, 35, 15, 30, + 17, 1, 115, 30, 14, 21, 46, 28, 29, 19, 24, 30, 11, 46, 15, 30, + 13, 6, 115, 30, 14, 23, 46, 28, 44, 7, 24, 30, 59, 1, 16, 30, + 12, 7, 121, 30, 12, 26, 47, 28, 39, 14, 24, 30, 22, 41, 15, 30, + 6, 14, 121, 30, 6, 34, 47, 28, 46, 10, 24, 30, 2, 64, 15, 30, + 17, 4, 122, 30, 29, 14, 46, 28, 49, 10, 24, 30, 24, 46, 15, 30, + 4, 18, 122, 30, 13, 32, 46, 28, 48, 14, 24, 30, 42, 32, 15, 30, + 20, 4, 117, 30, 40, 7, 47, 28, 43, 22, 24, 30, 10, 67, 15, 30, + 19, 6, 118, 30, 18, 31, 47, 28, 34, 34, 24, 30, 20, 61, 15, 30 + ]; + + // Galois field log table + var glog = [ + 0xff, 0x00, 0x01, 0x19, 0x02, 0x32, 0x1a, 0xc6, 0x03, 0xdf, 0x33, 0xee, 0x1b, 0x68, 0xc7, 0x4b, + 0x04, 0x64, 0xe0, 0x0e, 0x34, 0x8d, 0xef, 0x81, 0x1c, 0xc1, 0x69, 0xf8, 0xc8, 0x08, 0x4c, 0x71, + 0x05, 0x8a, 0x65, 0x2f, 0xe1, 0x24, 0x0f, 0x21, 0x35, 0x93, 0x8e, 0xda, 0xf0, 0x12, 0x82, 0x45, + 0x1d, 0xb5, 0xc2, 0x7d, 0x6a, 0x27, 0xf9, 0xb9, 0xc9, 0x9a, 0x09, 0x78, 0x4d, 0xe4, 0x72, 0xa6, + 0x06, 0xbf, 0x8b, 0x62, 0x66, 0xdd, 0x30, 0xfd, 0xe2, 0x98, 0x25, 0xb3, 0x10, 0x91, 0x22, 0x88, + 0x36, 0xd0, 0x94, 0xce, 0x8f, 0x96, 0xdb, 0xbd, 0xf1, 0xd2, 0x13, 0x5c, 0x83, 0x38, 0x46, 0x40, + 0x1e, 0x42, 0xb6, 0xa3, 0xc3, 0x48, 0x7e, 0x6e, 0x6b, 0x3a, 0x28, 0x54, 0xfa, 0x85, 0xba, 0x3d, + 0xca, 0x5e, 0x9b, 0x9f, 0x0a, 0x15, 0x79, 0x2b, 0x4e, 0xd4, 0xe5, 0xac, 0x73, 0xf3, 0xa7, 0x57, + 0x07, 0x70, 0xc0, 0xf7, 0x8c, 0x80, 0x63, 0x0d, 0x67, 0x4a, 0xde, 0xed, 0x31, 0xc5, 0xfe, 0x18, + 0xe3, 0xa5, 0x99, 0x77, 0x26, 0xb8, 0xb4, 0x7c, 0x11, 0x44, 0x92, 0xd9, 0x23, 0x20, 0x89, 0x2e, + 0x37, 0x3f, 0xd1, 0x5b, 0x95, 0xbc, 0xcf, 0xcd, 0x90, 0x87, 0x97, 0xb2, 0xdc, 0xfc, 0xbe, 0x61, + 0xf2, 0x56, 0xd3, 0xab, 0x14, 0x2a, 0x5d, 0x9e, 0x84, 0x3c, 0x39, 0x53, 0x47, 0x6d, 0x41, 0xa2, + 0x1f, 0x2d, 0x43, 0xd8, 0xb7, 0x7b, 0xa4, 0x76, 0xc4, 0x17, 0x49, 0xec, 0x7f, 0x0c, 0x6f, 0xf6, + 0x6c, 0xa1, 0x3b, 0x52, 0x29, 0x9d, 0x55, 0xaa, 0xfb, 0x60, 0x86, 0xb1, 0xbb, 0xcc, 0x3e, 0x5a, + 0xcb, 0x59, 0x5f, 0xb0, 0x9c, 0xa9, 0xa0, 0x51, 0x0b, 0xf5, 0x16, 0xeb, 0x7a, 0x75, 0x2c, 0xd7, + 0x4f, 0xae, 0xd5, 0xe9, 0xe6, 0xe7, 0xad, 0xe8, 0x74, 0xd6, 0xf4, 0xea, 0xa8, 0x50, 0x58, 0xaf + ]; + + // Galios field exponent table + var gexp = [ + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1d, 0x3a, 0x74, 0xe8, 0xcd, 0x87, 0x13, 0x26, + 0x4c, 0x98, 0x2d, 0x5a, 0xb4, 0x75, 0xea, 0xc9, 0x8f, 0x03, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, + 0x9d, 0x27, 0x4e, 0x9c, 0x25, 0x4a, 0x94, 0x35, 0x6a, 0xd4, 0xb5, 0x77, 0xee, 0xc1, 0x9f, 0x23, + 0x46, 0x8c, 0x05, 0x0a, 0x14, 0x28, 0x50, 0xa0, 0x5d, 0xba, 0x69, 0xd2, 0xb9, 0x6f, 0xde, 0xa1, + 0x5f, 0xbe, 0x61, 0xc2, 0x99, 0x2f, 0x5e, 0xbc, 0x65, 0xca, 0x89, 0x0f, 0x1e, 0x3c, 0x78, 0xf0, + 0xfd, 0xe7, 0xd3, 0xbb, 0x6b, 0xd6, 0xb1, 0x7f, 0xfe, 0xe1, 0xdf, 0xa3, 0x5b, 0xb6, 0x71, 0xe2, + 0xd9, 0xaf, 0x43, 0x86, 0x11, 0x22, 0x44, 0x88, 0x0d, 0x1a, 0x34, 0x68, 0xd0, 0xbd, 0x67, 0xce, + 0x81, 0x1f, 0x3e, 0x7c, 0xf8, 0xed, 0xc7, 0x93, 0x3b, 0x76, 0xec, 0xc5, 0x97, 0x33, 0x66, 0xcc, + 0x85, 0x17, 0x2e, 0x5c, 0xb8, 0x6d, 0xda, 0xa9, 0x4f, 0x9e, 0x21, 0x42, 0x84, 0x15, 0x2a, 0x54, + 0xa8, 0x4d, 0x9a, 0x29, 0x52, 0xa4, 0x55, 0xaa, 0x49, 0x92, 0x39, 0x72, 0xe4, 0xd5, 0xb7, 0x73, + 0xe6, 0xd1, 0xbf, 0x63, 0xc6, 0x91, 0x3f, 0x7e, 0xfc, 0xe5, 0xd7, 0xb3, 0x7b, 0xf6, 0xf1, 0xff, + 0xe3, 0xdb, 0xab, 0x4b, 0x96, 0x31, 0x62, 0xc4, 0x95, 0x37, 0x6e, 0xdc, 0xa5, 0x57, 0xae, 0x41, + 0x82, 0x19, 0x32, 0x64, 0xc8, 0x8d, 0x07, 0x0e, 0x1c, 0x38, 0x70, 0xe0, 0xdd, 0xa7, 0x53, 0xa6, + 0x51, 0xa2, 0x59, 0xb2, 0x79, 0xf2, 0xf9, 0xef, 0xc3, 0x9b, 0x2b, 0x56, 0xac, 0x45, 0x8a, 0x09, + 0x12, 0x24, 0x48, 0x90, 0x3d, 0x7a, 0xf4, 0xf5, 0xf7, 0xf3, 0xfb, 0xeb, 0xcb, 0x8b, 0x0b, 0x16, + 0x2c, 0x58, 0xb0, 0x7d, 0xfa, 0xe9, 0xcf, 0x83, 0x1b, 0x36, 0x6c, 0xd8, 0xad, 0x47, 0x8e, 0x00 + ]; + + // Working buffers: + // data input and ecc append, image working buffer, fixed part of image, run lengths for badness + var strinbuf=[], eccbuf=[], qrframe=[], framask=[], rlens=[]; + // Control values - width is based on version, last 4 are from table. + var version, width, neccblk1, neccblk2, datablkw, eccblkwid; + var ecclevel = 2; + // set bit to indicate cell in qrframe is immutable. symmetric around diagonal + function setmask(x, y) + { + var bt; + if (x > y) { + bt = x; + x = y; + y = bt; + } + // y*y = 1+3+5... + bt = y; + bt *= y; + bt += y; + bt >>= 1; + bt += x; + framask[bt] = 1; + } + + // enter alignment pattern - black to qrframe, white to mask (later black frame merged to mask) + function putalign(x, y) + { + var j; + + qrframe[x + width * y] = 1; + for (j = -2; j < 2; j++) { + qrframe[(x + j) + width * (y - 2)] = 1; + qrframe[(x - 2) + width * (y + j + 1)] = 1; + qrframe[(x + 2) + width * (y + j)] = 1; + qrframe[(x + j + 1) + width * (y + 2)] = 1; + } + for (j = 0; j < 2; j++) { + setmask(x - 1, y + j); + setmask(x + 1, y - j); + setmask(x - j, y - 1); + setmask(x + j, y + 1); + } + } + + //======================================================================== + // Reed Solomon error correction + // exponentiation mod N + function modnn(x) + { + while (x >= 255) { + x -= 255; + x = (x >> 8) + (x & 255); + } + return x; + } + + var genpoly = []; + + // Calculate and append ECC data to data block. Block is in strinbuf, indexes to buffers given. + function appendrs(data, dlen, ecbuf, eclen) + { + var i, j, fb; + + for (i = 0; i < eclen; i++) + strinbuf[ecbuf + i] = 0; + for (i = 0; i < dlen; i++) { + fb = glog[strinbuf[data + i] ^ strinbuf[ecbuf]]; + if (fb != 255) /* fb term is non-zero */ + for (j = 1; j < eclen; j++) + strinbuf[ecbuf + j - 1] = strinbuf[ecbuf + j] ^ gexp[modnn(fb + genpoly[eclen - j])]; + else + for( j = ecbuf ; j < ecbuf + eclen; j++ ) + strinbuf[j] = strinbuf[j + 1]; + strinbuf[ ecbuf + eclen - 1] = fb == 255 ? 0 : gexp[modnn(fb + genpoly[0])]; + } + } + + //======================================================================== + // Frame data insert following the path rules + + // check mask - since symmetrical use half. + function ismasked(x, y) + { + var bt; + if (x > y) { + bt = x; + x = y; + y = bt; + } + bt = y; + bt += y * y; + bt >>= 1; + bt += x; + return framask[bt]; + } + + //======================================================================== + // Apply the selected mask out of the 8. + function applymask(m) + { + var x, y, r3x, r3y; + + switch (m) { + case 0: + for (y = 0; y < width; y++) + for (x = 0; x < width; x++) + if (!((x + y) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + break; + case 1: + for (y = 0; y < width; y++) + for (x = 0; x < width; x++) + if (!(y & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + break; + case 2: + for (y = 0; y < width; y++) + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x == 3) + r3x = 0; + if (!r3x && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + break; + case 3: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = r3y, x = 0; x < width; x++, r3x++) { + if (r3x == 3) + r3x = 0; + if (!r3x && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 4: + for (y = 0; y < width; y++) + for (r3x = 0, r3y = ((y >> 1) & 1), x = 0; x < width; x++, r3x++) { + if (r3x == 3) { + r3x = 0; + r3y = !r3y; + } + if (!r3y && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + break; + case 5: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x == 3) + r3x = 0; + if (!((x & y & 1) + !(!r3x | !r3y)) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 6: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x == 3) + r3x = 0; + if (!(((x & y & 1) + (r3x && (r3x == r3y))) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + case 7: + for (r3y = 0, y = 0; y < width; y++, r3y++) { + if (r3y == 3) + r3y = 0; + for (r3x = 0, x = 0; x < width; x++, r3x++) { + if (r3x == 3) + r3x = 0; + if (!(((r3x && (r3x == r3y)) + ((x + y) & 1)) & 1) && !ismasked(x, y)) + qrframe[x + y * width] ^= 1; + } + } + break; + } + return; + } + + // Badness coefficients. + var N1 = 3, N2 = 3, N3 = 40, N4 = 10; + + // Using the table of the length of each run, calculate the amount of bad image + // - long runs or those that look like finders; called twice, once each for X and Y + function badruns(length) + { + var i; + var runsbad = 0; + for (i = 0; i <= length; i++) + if (rlens[i] >= 5) + runsbad += N1 + rlens[i] - 5; + // BwBBBwB as in finder + for (i = 3; i < length - 1; i += 2) + if (rlens[i - 2] == rlens[i + 2] + && rlens[i + 2] == rlens[i - 1] + && rlens[i - 1] == rlens[i + 1] + && rlens[i - 1] * 3 == rlens[i] + // white around the black pattern? Not part of spec + && (rlens[i - 3] == 0 // beginning + || i + 3 > length // end + || rlens[i - 3] * 3 >= rlens[i] * 4 || rlens[i + 3] * 3 >= rlens[i] * 4) + ) + runsbad += N3; + return runsbad; + } + + // Calculate how bad the masked image is - blocks, imbalance, runs, or finders. + function badcheck() + { + var x, y, h, b, b1; + var thisbad = 0; + var bw = 0; + + // blocks of same color. + for (y = 0; y < width - 1; y++) + for (x = 0; x < width - 1; x++) + if ((qrframe[x + width * y] && qrframe[(x + 1) + width * y] + && qrframe[x + width * (y + 1)] && qrframe[(x + 1) + width * (y + 1)]) // all black + || !(qrframe[x + width * y] || qrframe[(x + 1) + width * y] + || qrframe[x + width * (y + 1)] || qrframe[(x + 1) + width * (y + 1)])) // all white + thisbad += N2; + + // X runs + for (y = 0; y < width; y++) { + rlens[0] = 0; + for (h = b = x = 0; x < width; x++) { + if ((b1 = qrframe[x + width * y]) == b) + rlens[h]++; + else + rlens[++h] = 1; + b = b1; + bw += b ? 1 : -1; + } + thisbad += badruns(h); + } + + // black/white imbalance + if (bw < 0) + bw = -bw; + + var big = bw; + var count = 0; + big += big << 2; + big <<= 1; + while (big > width * width) + big -= width * width, count++; + thisbad += count * N4; + + // Y runs + for (x = 0; x < width; x++) { + rlens[0] = 0; + for (h = b = y = 0; y < width; y++) { + if ((b1 = qrframe[x + width * y]) == b) + rlens[h]++; + else + rlens[++h] = 1; + b = b1; + } + thisbad += badruns(h); + } + return thisbad; + } + + function genframe(instring) + { + var x, y, k, t, v, i, j, m; + + // find the smallest version that fits the string + t = instring.length; + version = 0; + do { + version++; + k = (ecclevel - 1) * 4 + (version - 1) * 16; + neccblk1 = eccblocks[k++]; + neccblk2 = eccblocks[k++]; + datablkw = eccblocks[k++]; + eccblkwid = eccblocks[k]; + k = datablkw * (neccblk1 + neccblk2) + neccblk2 - 3 + (version <= 9); + if (t <= k) + break; + } while (version < 40); + + // FIXME - insure that it fits insted of being truncated + width = 17 + 4 * version; + + // allocate, clear and setup data structures + v = datablkw + (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; + for( t = 0; t < v; t++ ) + eccbuf[t] = 0; + strinbuf = instring.slice(0); + + for( t = 0; t < width * width; t++ ) + qrframe[t] = 0; + + for( t = 0 ; t < (width * (width + 1) + 1) / 2; t++) + framask[t] = 0; + + // insert finders - black to frame, white to mask + for (t = 0; t < 3; t++) { + k = 0; + y = 0; + if (t == 1) + k = (width - 7); + if (t == 2) + y = (width - 7); + qrframe[(y + 3) + width * (k + 3)] = 1; + for (x = 0; x < 6; x++) { + qrframe[(y + x) + width * k] = 1; + qrframe[y + width * (k + x + 1)] = 1; + qrframe[(y + 6) + width * (k + x)] = 1; + qrframe[(y + x + 1) + width * (k + 6)] = 1; + } + for (x = 1; x < 5; x++) { + setmask(y + x, k + 1); + setmask(y + 1, k + x + 1); + setmask(y + 5, k + x); + setmask(y + x + 1, k + 5); + } + for (x = 2; x < 4; x++) { + qrframe[(y + x) + width * (k + 2)] = 1; + qrframe[(y + 2) + width * (k + x + 1)] = 1; + qrframe[(y + 4) + width * (k + x)] = 1; + qrframe[(y + x + 1) + width * (k + 4)] = 1; + } + } + + // alignment blocks + if (version > 1) { + t = adelta[version]; + y = width - 7; + for (;;) { + x = width - 7; + while (x > t - 3) { + putalign(x, y); + if (x < t) + break; + x -= t; + } + if (y <= t + 9) + break; + y -= t; + putalign(6, y); + putalign(y, 6); + } + } + + // single black + qrframe[8 + width * (width - 8)] = 1; + + // timing gap - mask only + for (y = 0; y < 7; y++) { + setmask(7, y); + setmask(width - 8, y); + setmask(7, y + width - 7); + } + for (x = 0; x < 8; x++) { + setmask(x, 7); + setmask(x + width - 8, 7); + setmask(x, width - 8); + } + + // reserve mask-format area + for (x = 0; x < 9; x++) + setmask(x, 8); + for (x = 0; x < 8; x++) { + setmask(x + width - 8, 8); + setmask(8, x); + } + for (y = 0; y < 7; y++) + setmask(8, y + width - 7); + + // timing row/col + for (x = 0; x < width - 14; x++) + if (x & 1) { + setmask(8 + x, 6); + setmask(6, 8 + x); + } + else { + qrframe[(8 + x) + width * 6] = 1; + qrframe[6 + width * (8 + x)] = 1; + } + + // version block + if (version > 6) { + t = vpat[version - 7]; + k = 17; + for (x = 0; x < 6; x++) + for (y = 0; y < 3; y++, k--) + if (1 & (k > 11 ? version >> (k - 12) : t >> k)) { + qrframe[(5 - x) + width * (2 - y + width - 11)] = 1; + qrframe[(2 - y + width - 11) + width * (5 - x)] = 1; + } + else { + setmask(5 - x, 2 - y + width - 11); + setmask(2 - y + width - 11, 5 - x); + } + } + + // sync mask bits - only set above for white spaces, so add in black bits + for (y = 0; y < width; y++) + for (x = 0; x <= y; x++) + if (qrframe[x + width * y]) + setmask(x, y); + + // convert string to bitstream + // 8 bit data to QR-coded 8 bit data (numeric or alphanum, or kanji not supported) + v = strinbuf.length; + + // string to array + for( i = 0 ; i < v; i++ ) + eccbuf[i] = strinbuf.charCodeAt(i); + strinbuf = eccbuf.slice(0); + + // calculate max string length + x = datablkw * (neccblk1 + neccblk2) + neccblk2; + if (v >= x - 2) { + v = x - 2; + if (version > 9) + v--; + } + + // shift and repack to insert length prefix + i = v; + if (version > 9) { + strinbuf[i + 2] = 0; + strinbuf[i + 3] = 0; + while (i--) { + t = strinbuf[i]; + strinbuf[i + 3] |= 255 & (t << 4); + strinbuf[i + 2] = t >> 4; + } + strinbuf[2] |= 255 & (v << 4); + strinbuf[1] = v >> 4; + strinbuf[0] = 0x40 | (v >> 12); + } + else { + strinbuf[i + 1] = 0; + strinbuf[i + 2] = 0; + while (i--) { + t = strinbuf[i]; + strinbuf[i + 2] |= 255 & (t << 4); + strinbuf[i + 1] = t >> 4; + } + strinbuf[1] |= 255 & (v << 4); + strinbuf[0] = 0x40 | (v >> 4); + } + // fill to end with pad pattern + i = v + 3 - (version < 10); + while (i < x) { + strinbuf[i++] = 0xec; + // buffer has room if (i == x) break; + strinbuf[i++] = 0x11; + } + + // calculate and append ECC + + // calculate generator polynomial + genpoly[0] = 1; + for (i = 0; i < eccblkwid; i++) { + genpoly[i + 1] = 1; + for (j = i; j > 0; j--) + genpoly[j] = genpoly[j] + ? genpoly[j - 1] ^ gexp[modnn(glog[genpoly[j]] + i)] : genpoly[j - 1]; + genpoly[0] = gexp[modnn(glog[genpoly[0]] + i)]; + } + for (i = 0; i <= eccblkwid; i++) + genpoly[i] = glog[genpoly[i]]; // use logs for genpoly[] to save calc step + + // append ecc to data buffer + k = x; + y = 0; + for (i = 0; i < neccblk1; i++) { + appendrs(y, datablkw, k, eccblkwid); + y += datablkw; + k += eccblkwid; + } + for (i = 0; i < neccblk2; i++) { + appendrs(y, datablkw + 1, k, eccblkwid); + y += datablkw + 1; + k += eccblkwid; + } + // interleave blocks + y = 0; + for (i = 0; i < datablkw; i++) { + for (j = 0; j < neccblk1; j++) + eccbuf[y++] = strinbuf[i + j * datablkw]; + for (j = 0; j < neccblk2; j++) + eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; + } + for (j = 0; j < neccblk2; j++) + eccbuf[y++] = strinbuf[(neccblk1 * datablkw) + i + (j * (datablkw + 1))]; + for (i = 0; i < eccblkwid; i++) + for (j = 0; j < neccblk1 + neccblk2; j++) + eccbuf[y++] = strinbuf[x + i + j * eccblkwid]; + strinbuf = eccbuf; + + // pack bits into frame avoiding masked area. + x = y = width - 1; + k = v = 1; // up, minus + /* inteleaved data and ecc codes */ + m = (datablkw + eccblkwid) * (neccblk1 + neccblk2) + neccblk2; + for (i = 0; i < m; i++) { + t = strinbuf[i]; + for (j = 0; j < 8; j++, t <<= 1) { + if (0x80 & t) + qrframe[x + width * y] = 1; + do { // find next fill position + if (v) + x--; + else { + x++; + if (k) { + if (y != 0) + y--; + else { + x -= 2; + k = !k; + if (x == 6) { + x--; + y = 9; + } + } + } + else { + if (y != width - 1) + y++; + else { + x -= 2; + k = !k; + if (x == 6) { + x--; + y -= 8; + } + } + } + } + v = !v; + } while (ismasked(x, y)); + } + } + + // save pre-mask copy of frame + strinbuf = qrframe.slice(0); + t = 0; // best + y = 30000; // demerit + // for instead of while since in original arduino code + // if an early mask was "good enough" it wouldn't try for a better one + // since they get more complex and take longer. + for (k = 0; k < 8; k++) { + applymask(k); // returns black-white imbalance + x = badcheck(); + if (x < y) { // current mask better than previous best? + y = x; + t = k; + } + if (t == 7) + break; // don't increment i to a void redoing mask + qrframe = strinbuf.slice(0); // reset for next pass + } + if (t != k) // redo best mask - none good enough, last wasn't t + applymask(t); + + // add in final mask/ecclevel bytes + y = fmtword[t + ((ecclevel - 1) << 3)]; + // low byte + for (k = 0; k < 8; k++, y >>= 1) + if (y & 1) { + qrframe[(width - 1 - k) + width * 8] = 1; + if (k < 6) + qrframe[8 + width * k] = 1; + else + qrframe[8 + width * (k + 1)] = 1; + } + // high byte + for (k = 0; k < 7; k++, y >>= 1) + if (y & 1) { + qrframe[8 + width * (width - 7 + k)] = 1; + if (k) + qrframe[(6 - k) + width * 8] = 1; + else + qrframe[7 + width * 8] = 1; + } + + // return image + return qrframe; + } + + var _canvas = null, + _size = null; + + var api = { + + get ecclevel () { + return ecclevel; + }, + + set ecclevel (val) { + ecclevel = val; + }, + + get size () { + return _size; + }, + + set size (val) { + _size = val + }, + + get canvas () { + return _canvas; + }, + + set canvas (el) { + _canvas = el; + }, + + getFrame: function (string) { + return genframe(string); + }, + + draw: function (string, canvas, size, ecc) { + + ecclevel = ecc || ecclevel; + canvas = canvas || _canvas; + + if (!canvas) { + console.warn('No canvas provided to draw QR code in!') + return; + } + + size = size || _size || Math.min(canvas.width, canvas.height); + + var frame = genframe(string), + ctx = canvas.ctx, + px = Math.round(size / (width + 8)); + + var roundedSize = px * (width + 8), + offset = Math.floor((size - roundedSize) / 2); + + size = roundedSize; + + ctx.clearRect(0, 0, canvas.width, canvas.height); + ctx.setFillStyle('#000000'); + + for (var i = 0; i < width; i++) { + for (var j = 0; j < width; j++) { + if (frame[j * width + i]) { + ctx.fillRect(px * (4 + i) + offset, px * (4 + j) + offset, px, px); + } + } + } + ctx.draw(); + } + } + + module.exports = { + api: api + } + +})() \ No newline at end of file diff --git a/utils/spell.js b/utils/spell.js new file mode 100644 index 0000000..7297820 --- /dev/null +++ b/utils/spell.js @@ -0,0 +1,80 @@ +const spellStatus=[ + { + name:'拼团中', + value:10 + }, + { + name: '拼团成功', + value: 11 + }, + { + name: '已过期', + value: 12 + }, + { + name: '拼团失败', + value: 13 + }, + { + name: '参团失败', + value: 14 + }, + { + name: '待支付', + value: 15 + }, + { + name: '拼团取消', + value: 16 + }, + { + name: '失败请稍候', + value: 98 + }, + { + name: '失败请稍候', + value: 99 + } +] +const spellStatus02 = [ + { + name: '继续邀请好友', + value: 10 + }, + { + name: '拼团完成', + value: 11 + }, + { + name: '已过期', + value: 12 + }, + { + name: '重新拼团', + value: 13 + }, + { + name: '参团失败', + value: 14 + }, + { + name: '去支付', + value: 15 + }, + { + name: '拼团取消', + value: 16 + }, + { + name: '失败请稍候', + value: 98 + }, + { + name: '失败请稍候', + value: 99 + } +] +module.exports={ + spellStatus, + spellStatus02 +} \ No newline at end of file diff --git a/utils/util.js b/utils/util.js new file mode 100644 index 0000000..c1c0049 --- /dev/null +++ b/utils/util.js @@ -0,0 +1,207 @@ +var barcode = require("./barcode"); +var qrcode = require("./qrcode"); + +const extConfig = tt.getExtConfigSync ? tt.getExtConfigSync() : {} + + +function convertUTCTimeToLocalTime(UTCDateString) { + if (!UTCDateString) { + return '-'; + } + function formatFunc(str) { //格式化显示 + return str > 9 ? str : '0' + str + } + var date2 = new Date(UTCDateString); //这步是关键 + var year = date2.getFullYear(); + var mon = formatFunc(date2.getMonth() + 1); + var day = formatFunc(date2.getDate()); + var hour = date2.getHours(); + var noon = hour >= 12 ? 'PM' : 'AM'; + hour = hour >= 24 ? hour - 24 : hour; + hour = formatFunc(hour); + var min = formatFunc(date2.getMinutes()); + var dateStr = ' ' + hour + ':' + min ; + return dateStr; +} + +// function fmtDate(date) { +// var dateee = new Date(date).toJSON(); +// return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, ''); +// } + +function moodsText(Num){//人气值处理 Num人气值 返回字符串 处理到万位 + let sing = "" + if(Num>10000){ + sing = (Num/10000).toFixed(2)+"w" + + }else{ + sing =Num + } + return sing +} + +const formatTime = (date, fmt) => { + try { + if (!date) { + return date; + } + if (typeof date === 'string' && date.length === 13) { + date = Number(date); + } + if (typeof date == "number") { + date = new Date(date); + } + var o = { + "M+": date.getMonth() + 1, //月份 + "d+": date.getDate(), //日 + "h+": date.getHours(), //小时 + "m+": date.getMinutes(), //分 + "s+": date.getSeconds(), //秒 + "q+": Math.floor((date.getMonth() + 3) / 3), //季度 + S: date.getMilliseconds() //毫秒 + }; + if (/(y+)/.test(fmt)) + fmt = fmt.replace( + RegExp.$1, + (date.getFullYear() + "").substr(4 - RegExp.$1.length) + ); + for (var k in o) + if (new RegExp("(" + k + ")").test(fmt)) + fmt = fmt.replace( + RegExp.$1, + RegExp.$1.length == 1 + ? o[k] + : ("00" + o[k]).substr(("" + o[k]).length) + ); + return fmt; + } catch (error) { + return date; + } +}; + +const formatNumber = n => { + n = n.toString(); + return n[1] ? n : "0" + n; +}; + +function convert_length(length) { + return Math.round((tt.getSystemInfoSync().windowWidth * length) / 750); +} + +function barc(id, code, width, height) { + barcode.code128( + tt.createCanvasContext(id), + code, + convert_length(width), + convert_length(height) + ); +} + +function qrc(id, code, width, height) { + qrcode.api.draw(code, { + ctx: tt.createCanvasContext(id), + width: convert_length(width), + height: convert_length(height) + }); +} +function fmtDate(obj) { + if (typeof obj === 'string' && obj.length === 13) { + obj = Number(obj); + } + var date = new Date(obj); + var y = 1900 + date.getYear(); + var m = "0" + (date.getMonth() + 1); + var d = "0" + date.getDate(); + return ( + y + + "-" + + m.substring(m.length - 2, m.length) + + "-" + + d.substring(d.length - 2, d.length) + ); +} + +//计算下单的时间与现在的时间的 +function timechuo(startTime) { + var s1 = new Date(startTime.replace(/-/g, "/")); + var s2 = new Date(); + var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); + var year = Math.floor(runTime / 86400 / 365); + var runTime = runTime % (86400 * 365); + var month = Math.floor(runTime / 86400 / 30); + var runTime = runTime % (86400 * 30); + var day = Math.floor(runTime / 86400); + var runTime = runTime % 86400; + var hour = Math.floor(runTime / 3600); + var runTime = runTime % 3600; + var minute = Math.floor(runTime / 60); + var runTime = runTime % 60; + var second = runTime; + if (day && !year && !month){ + return (day + '天' + hour + "小时" + minute + "分钟") + } else if (month && !year){ + return ((month*30+day) +'天' + hour + "小时" + minute + "分钟") + } else if (year) { + return ((year*365 + month*30+ day) + '天' + hour + "小时" + minute + "分钟") + }else{ + return (hour + "小时" + minute + "分钟") + } +} + + +//计算时间差 +function timecha(endTime,startTime) { + var s1 = new Date(endTime.replace(/-/g, "/")); + var s2 = new Date(startTime.replace(/-/g, "/")); + var runTime = parseInt((s1.getTime() - s2.getTime()) / 1000); + var year = Math.floor(runTime / 86400 / 365); + var runTime = runTime % (86400 * 365); + var month = Math.floor(runTime / 86400 / 30); + var runTime = runTime % (86400 * 30); + var day = Math.floor(runTime / 86400); + var runTime = runTime % 86400; + var hour = Math.floor(runTime / 3600); + var runTime = runTime % 3600; + var minute = Math.floor(runTime / 60); + var runTime = runTime % 60; + var second = runTime; + return (month+"月"+day+"天"+hour+"小时"+minute+"分钟") +} +function isJSON(str) { + if (typeof str == 'string') { + console.log("string") + try { + var obj = JSON.parse(str); + if (typeof obj == 'object' && obj) { + return true; + } else { + return false; + } + } catch (e) { + console.log(e); + tt.showToast({ + title: '请扫描正确的二维码', + icon: 'none', + duration: 1300 + }) + } + } else { + tt.showToast({ + title: '请扫描正确的二维码', + icon: 'none', + duration: 1300 + }) + } +} + +module.exports = { + formatTime: formatTime, + barcode: barc, + qrcode: qrc, + isJSON: isJSON, + fmtDate: fmtDate, + timechuo: timechuo, + timecha: timecha, + moodsText:moodsText, + convertUTCTimeToLocalTime: convertUTCTimeToLocalTime +}; diff --git a/weui.ttss b/weui.ttss new file mode 100644 index 0000000..d825c94 --- /dev/null +++ b/weui.ttss @@ -0,0 +1,6 @@ +/*! + * WeUI v1.1.1 (https://github.com/weui/weui-wxss) + * Copyright 2017 Tencent, Inc. + * Licensed under the MIT license + */ + page{line-height:1.6;font-family:-apple-system-font,Helvetica Neue,sans-serif}icon{vertical-align:middle}.weui-cells{position:relative;margin-top:1.17647059em;background-color:#fff;line-height:1.41176471;font-size:17px}.weui-cells:before{top:0;border-top:1rpx solid #d9d9d9}.weui-cells:after,.weui-cells:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#d9d9d9}.weui-cells:after{bottom:0;border-bottom:1rpx solid #d9d9d9}.weui-cells__title{margin-top:.77em;margin-bottom:.3em;padding-left:15px;padding-right:15px;color:#999;font-size:14px}.weui-cells_after-title{margin-top:0}.weui-cells__tips{margin-top:.3em;color:#999;padding-left:15px;padding-right:15px;font-size:14px}.weui-cell{padding:10px 15px;position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-cell:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #d9d9d9;color:#d9d9d9;left:15px}.weui-cell:first-child:before{display:none}.weui-cell_active{background-color:#ececec}.weui-cell_primary{-webkit-box-align:start;-webkit-align-items:flex-start;align-items:flex-start}.weui-cell__bd{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-cell__ft{text-align:right;color:#999}.weui-cell_access{color:inherit}.weui-cell__ft_in-access{padding-right:13px;position:relative}.weui-cell__ft_in-access:after{content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8cd;border-style:solid;-webkit-transform:matrix(.71,.71,-.71,.71,0,0);transform:matrix(.71,.71,-.71,.71,0,0);position:relative;top:-2px;position:absolute;top:50%;margin-top:-4px;right:2px}.weui-cell_link{color:#586c94;font-size:14px}.weui-cell_link:active{background-color:#ececec}.weui-cell_link:first-child:before{display:block}.weui-icon-radio{margin-left:3.2px;margin-right:3.2px}.weui-icon-checkbox_circle,.weui-icon-checkbox_success{margin-left:4.6px;margin-right:4.6px}.weui-check__label:active{background-color:#ececec}.weui-check{position:absolute;left:-9999px}.weui-check__hd_in-checkbox{padding-right:.35em}.weui-cell__ft_in-radio{padding-left:.35em}.weui-cell_input{padding-top:0;padding-bottom:0}.weui-label{width:105px;word-wrap:break-word;word-break:break-all}.weui-input{height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em}.weui-toptips{position:fixed;-webkit-transform:translateZ(0);transform:translateZ(0);top:0;left:0;right:0;padding:5px;font-size:14px;text-align:center;color:#fff;z-index:5000;word-wrap:break-word;word-break:break-all}.weui-toptips_warn{background-color:#e64340}.weui-textarea{display:block;width:100%}.weui-textarea-counter{color:#b2b2b2;text-align:right}.weui-cell_warn,.weui-textarea-counter_warn{color:#e64340}.weui-form-preview{position:relative;background-color:#fff}.weui-form-preview:before{top:0;border-top:1rpx solid #d9d9d9}.weui-form-preview:after,.weui-form-preview:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#d9d9d9}.weui-form-preview:after{bottom:0;border-bottom:1rpx solid #d9d9d9}.weui-form-preview__value{font-size:14px}.weui-form-preview__value_in-hd{font-size:26px}.weui-form-preview__hd{position:relative;padding:10px 15px;text-align:right;line-height:2.5em}.weui-form-preview__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid #d9d9d9;color:#d9d9d9;left:15px}.weui-form-preview__bd{padding:10px 15px;font-size:.9em;text-align:right;color:#999;line-height:2}.weui-form-preview__ft{position:relative;line-height:50px;display:-webkit-box;display:-webkit-flex;display:flex}.weui-form-preview__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__item{overflow:hidden}.weui-form-preview__label{float:left;margin-right:1em;min-width:4em;color:#999;text-align:justify;text-align-last:justify}.weui-form-preview__value{display:block;overflow:hidden;word-break:normal;word-wrap:break-word}.weui-form-preview__btn{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#3cc51f;text-align:center}.weui-form-preview__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #d5d5d6;color:#d5d5d6}.weui-form-preview__btn:first-child:after{display:none}.weui-form-preview__btn_active{background-color:#eee}.weui-form-preview__btn_default{color:#999}.weui-form-preview__btn_primary{color:#0bb20c}.weui-cell_select{padding:0}.weui-select{position:relative;padding-left:15px;padding-right:30px;height:2.58823529em;min-height:2.58823529em;line-height:2.58823529em;border-right:1rpx solid #d9d9d9}.weui-select:before{content:" ";display:inline-block;height:6px;width:6px;border-width:2px 2px 0 0;border-color:#c8c8cd;border-style:solid;-webkit-transform:matrix(.71,.71,-.71,.71,0,0);transform:matrix(.71,.71,-.71,.71,0,0);position:relative;top:-2px;position:absolute;top:50%;right:15px;margin-top:-4px}.weui-select_in-select-after{padding-left:0}.weui-cell__bd_in-select-before,.weui-cell__hd_in-select-after{padding-left:15px}.weui-cell_vcode{padding-right:0}.weui-vcode-btn,.weui-vcode-img{margin-left:5px;height:2.58823529em;vertical-align:middle}.weui-vcode-btn{display:inline-block;padding:0 .6em 0 .7em;border-left:1px solid #e5e5e5;line-height:2.58823529em;font-size:17px;color:#3cc51f;white-space:nowrap}.weui-vcode-btn:active{color:#52a341}.weui-cell_switch{padding-top:6px;padding-bottom:6px}.weui-uploader__hd{display:-webkit-box;display:-webkit-flex;display:flex;padding-bottom:10px;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-uploader__title{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-uploader__info{color:#b2b2b2}.weui-uploader__bd{margin-bottom:-4px;margin-right:-9px;overflow:hidden}.weui-uploader__file{float:left;margin-right:9px;margin-bottom:9px}.weui-uploader__img{display:block;width:79px;height:79px}.weui-uploader__file_status{position:relative}.weui-uploader__file_status:before{content:" ";position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,.5)}.weui-uploader__file-content{position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);color:#fff}.weui-uploader__input-box{float:left;position:relative;margin-right:9px;margin-bottom:9px;width:77px;height:77px;border:1px solid #d9d9d9}.weui-uploader__input-box:after,.weui-uploader__input-box:before{content:" ";position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#d9d9d9}.weui-uploader__input-box:before{width:2px;height:39.5px}.weui-uploader__input-box:after{width:39.5px;height:2px}.weui-uploader__input-box:active{border-color:#999}.weui-uploader__input-box:active:after,.weui-uploader__input-box:active:before{background-color:#999}.weui-uploader__input{position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;opacity:0}.weui-article{padding:20px 15px;font-size:15px}.weui-article__section{margin-bottom:1.5em}.weui-article__h1{font-size:18px;font-weight:400;margin-bottom:.9em}.weui-article__h2{font-size:16px;font-weight:400;margin-bottom:.34em}.weui-article__h3{font-weight:400;font-size:15px;margin-bottom:.34em}.weui-article__p{margin:0 0 .8em}.weui-msg{padding-top:36px;text-align:center}.weui-msg__link{display:inline;color:#586c94}.weui-msg__icon-area{margin-bottom:30px}.weui-msg__text-area{margin-bottom:25px;padding:0 20px}.weui-msg__title{margin-bottom:5px;font-weight:400;font-size:20px}.weui-msg__desc{font-size:14px;color:#999}.weui-msg__opr-area{margin-bottom:25px}.weui-msg__extra-area{margin-bottom:15px;font-size:14px;color:#999}@media screen and (min-height:438px){.weui-msg__extra-area{position:fixed;left:0;bottom:0;width:100%;text-align:center}}.weui-flex{display:-webkit-box;display:-webkit-flex;display:flex}.weui-flex__item{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-btn{margin-top:15px}.weui-btn:first-child{margin-top:0}.weui-btn-area{margin:1.17647059em 15px .3em}.weui-agree{display:block;padding:.5em 15px;font-size:13px}.weui-agree__text{color:#999}.weui-agree__link{display:inline;color:#586c94}.weui-agree__checkbox{position:absolute;left:-9999px}.weui-agree__checkbox-icon{position:relative;top:2px;display:inline-block;border:1px solid #d1d1d1;background-color:#fff;border-radius:3px;width:11px;height:11px}.weui-agree__checkbox-icon-check{position:absolute;top:1px;left:1px}.weui-footer{color:#999;font-size:14px;text-align:center}.weui-footer_fixed-bottom{position:fixed;bottom:.52em;left:0;right:0}.weui-footer__links{font-size:0}.weui-footer__link{display:inline-block;vertical-align:top;margin:0 .62em;position:relative;font-size:14px;color:#586c94}.weui-footer__link:before{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1rpx solid #c7c7c7;color:#c7c7c7;left:-.65em;top:.36em;bottom:.36em}.weui-footer__link:first-child:before{display:none}.weui-footer__text{padding:0 .34em;font-size:12px}.weui-grids{border-top:1rpx solid #d9d9d9;border-left:1rpx solid #d9d9d9;overflow:hidden}.weui-grid{position:relative;float:left;padding:20px 10px;width:33.33333333%;box-sizing:border-box;border-right:1rpx solid #d9d9d9;border-bottom:1rpx solid #d9d9d9}.weui-grid_active{background-color:#ececec}.weui-grid__icon{display:block;width:28px;height:28px;margin:0 auto}.weui-grid__label{margin-top:5px;display:block;text-align:center;color:#000;font-size:14px;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.weui-loading{margin:0 5px;width:20px;height:20px;display:inline-block;vertical-align:middle;-webkit-animation:a 1s steps(12) infinite;animation:a 1s steps(12) infinite;background:transparent url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgMTAwIDEwMCI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTTAgMGgxMDB2MTAwSDB6Ii8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTlFOUU5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAgLTMwKSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iIzk4OTY5NyIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgzMCAxMDUuOTggNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjOUI5OTlBIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDYwIDc1Ljk4IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0EzQTFBMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCA2NSA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNBQkE5QUEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoMTIwIDU4LjY2IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0IyQjJCMiIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgxNTAgNTQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjQkFCOEI5IiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKDE4MCA1MCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDMkMwQzEiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTE1MCA0NS45OCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNDQkNCQ0IiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTEyMCA0MS4zNCA2NSkiLz48cmVjdCB3aWR0aD0iNyIgaGVpZ2h0PSIyMCIgeD0iNDYuNSIgeT0iNDAiIGZpbGw9IiNEMkQyRDIiIHJ4PSI1IiByeT0iNSIgdHJhbnNmb3JtPSJyb3RhdGUoLTkwIDM1IDY1KSIvPjxyZWN0IHdpZHRoPSI3IiBoZWlnaHQ9IjIwIiB4PSI0Ni41IiB5PSI0MCIgZmlsbD0iI0RBREFEQSIgcng9IjUiIHJ5PSI1IiB0cmFuc2Zvcm09InJvdGF0ZSgtNjAgMjQuMDIgNjUpIi8+PHJlY3Qgd2lkdGg9IjciIGhlaWdodD0iMjAiIHg9IjQ2LjUiIHk9IjQwIiBmaWxsPSIjRTJFMkUyIiByeD0iNSIgcnk9IjUiIHRyYW5zZm9ybT0icm90YXRlKC0zMCAtNS45OCA2NSkiLz48L3N2Zz4=) no-repeat;background-size:100%}.weui-loading.weui-loading_transparent{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 100 100'%3E%3Cpath fill='none' d='M0 0h100v100H0z'/%3E%3Crect xmlns='http://www.w3.org/2000/svg' width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.56)' rx='5' ry='5' transform='translate(0 -30)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.5)' rx='5' ry='5' transform='rotate(30 105.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.43)' rx='5' ry='5' transform='rotate(60 75.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.38)' rx='5' ry='5' transform='rotate(90 65 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.32)' rx='5' ry='5' transform='rotate(120 58.66 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.28)' rx='5' ry='5' transform='rotate(150 54.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.25)' rx='5' ry='5' transform='rotate(180 50 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.2)' rx='5' ry='5' transform='rotate(-150 45.98 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.17)' rx='5' ry='5' transform='rotate(-120 41.34 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.14)' rx='5' ry='5' transform='rotate(-90 35 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.1)' rx='5' ry='5' transform='rotate(-60 24.02 65)'/%3E%3Crect width='7' height='20' x='46.5' y='40' fill='rgba(255,255,255,.03)' rx='5' ry='5' transform='rotate(-30 -5.98 65)'/%3E%3C/svg%3E")}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.weui-badge{display:inline-block;padding:.15em .4em;min-width:8px;border-radius:18px;background-color:#e64340;color:#fff;line-height:1.2;text-align:center;font-size:12px;vertical-align:middle}.weui-badge_dot{padding:.4em;min-width:0}.weui-loadmore{width:65%;margin:1.5em auto;line-height:1.6em;font-size:14px;text-align:center}.weui-loadmore__tips{display:inline-block;vertical-align:middle}.weui-loadmore_line{border-top:1px solid #e5e5e5;margin-top:2.4em}.weui-loadmore__tips_in-line{position:relative;top:-.9em;padding:0 .55em;background-color:#fff;color:#999}.weui-loadmore__tips_in-dot{position:relative;padding:0 .16em;width:4px;height:1.6em}.weui-loadmore__tips_in-dot:before{content:" ";position:absolute;top:50%;left:50%;margin-top:-1px;margin-left:-2px;width:4px;height:4px;border-radius:50%;background-color:#e5e5e5}.weui-panel{background-color:#fff;margin-top:10px;position:relative;overflow:hidden}.weui-panel:first-child{margin-top:0}.weui-panel:before{top:0;border-top:1rpx solid #e5e5e5}.weui-panel:after,.weui-panel:before{content:" ";position:absolute;left:0;right:0;height:1px;color:#e5e5e5}.weui-panel:after{bottom:0;border-bottom:1rpx solid #e5e5e5}.weui-panel__hd{padding:14px 15px 10px;color:#999;font-size:13px;position:relative}.weui-panel__hd:after{content:" ";position:absolute;left:0;bottom:0;right:0;height:1px;border-bottom:1rpx solid #e5e5e5;color:#e5e5e5;left:15px}.weui-media-box{padding:15px;position:relative}.weui-media-box:before{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1rpx solid #e5e5e5;color:#e5e5e5;left:15px}.weui-media-box:first-child:before{display:none}.weui-media-box__title{font-weight:400;font-size:17px;width:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal;word-wrap:break-word;word-break:break-all}.weui-media-box__desc{color:#999;font-size:13px;line-height:1.2;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.weui-media-box__info{margin-top:15px;padding-bottom:5px;font-size:13px;color:#cecece;line-height:1em;list-style:none;overflow:hidden}.weui-media-box__info__meta{float:left;padding-right:1em}.weui-media-box__info__meta_extra{padding-left:1em;border-left:1px solid #cecece}.weui-media-box__title_in-text{margin-bottom:8px}.weui-media-box_appmsg{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-media-box__thumb{width:100%;height:100%;vertical-align:top}.weui-media-box__hd_in-appmsg{margin-right:.8em;width:60px;height:60px;line-height:60px;text-align:center}.weui-media-box__bd_in-appmsg{-webkit-box-flex:1;-webkit-flex:1;flex:1;min-width:0}.weui-media-box_small-appmsg{padding:0}.weui-cells_in-small-appmsg{margin-top:0}.weui-cells_in-small-appmsg:before{display:none}.weui-progress{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.weui-progress__bar{-webkit-box-flex:1;-webkit-flex:1;flex:1}.weui-progress__opr{margin-left:15px;font-size:0}.weui-navbar{display:-webkit-box;display:-webkit-flex;display:flex;position:absolute;z-index:500;top:0;width:100%;border-bottom:1rpx solid #ccc}.weui-navbar__item{position:relative;display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;padding:13px 0;text-align:center;font-size:0}.weui-navbar__item.weui-bar__item_on{color:#1aad19}.weui-navbar__slider{position:absolute;content:" ";left:0;bottom:0;width:6em;height:3px;background-color:#1aad19;-webkit-transition:-webkit-transform .3s;transition:-webkit-transform .3s;transition:transform .3s;transition:transform .3s,-webkit-transform .3s}.weui-navbar__title{display:inline-block;font-size:15px;max-width:8em;width:auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-wrap:normal}.weui-tab{position:relative;height:100%}.weui-tab__panel{box-sizing:border-box;height:100%;padding-top:50px;overflow:auto;-webkit-overflow-scrolling:touch}.weui-search-bar{position:relative;padding:8px 10px;display:-webkit-box;display:-webkit-flex;display:flex;box-sizing:border-box;background-color:#efeff4;border-top:1rpx solid #d7d6dc;border-bottom:1rpx solid #d7d6dc}.weui-icon-search{margin-right:8px;font-size:inherit}.weui-icon-search_in-box{position:absolute;left:10px;top:7px}.weui-search-bar__text{display:inline-block;font-size:14px;vertical-align:middle}.weui-search-bar__form{position:relative;-webkit-box-flex:1;-webkit-flex:auto;flex:auto;border-radius:5px;background:#fff;border:1rpx solid #e6e6ea}.weui-search-bar__box{position:relative;padding-left:30px;padding-right:30px;width:100%;box-sizing:border-box;z-index:1}.weui-search-bar__input{height:28px;line-height:28px;font-size:14px}.weui-icon-clear{position:absolute;top:0;right:0;padding:7px 8px;font-size:0}.weui-search-bar__label{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;border-radius:3px;text-align:center;color:#9b9b9b;background:#fff;line-height:28px}.weui-search-bar__cancel-btn{margin-left:10px;line-height:28px;color:#09bb07;white-space:nowrap}