diff --git a/app.json b/app.json index 9f638b9..94f571b 100644 --- a/app.json +++ b/app.json @@ -1,22 +1,13 @@ { "pages": [ - "pages/homeindex/homeindex", - "pages/index/index", - - - - - - + "pages/index/index", + "pages/kind/detail_1/detail_1", + "pages/homeindex/homeindex", "pages/kind/kind", - "pages/homeindex/result/result", "pages/homeindex/search/search", - - "pages/mine/mine", - "pages/kind/detail_1/detail_1", "pages/kind/firm_order2/firm_order2", "pages/kind/firm_order1/firm_order1", "pages/kind/success/success", diff --git a/pages/homeindex/homeindex.js b/pages/homeindex/homeindex.js index ffbad79..dde58e7 100644 --- a/pages/homeindex/homeindex.js +++ b/pages/homeindex/homeindex.js @@ -1,102 +1,216 @@ -// pages/homeindex/homeindex.js const app = getApp() Page({ - - /** - * 页面的初始数据 - */ - data: { - banner: [], - shop_class: [], - middle:'', - shop:[] - }, - look_category(e) { - app.globalData.cid = e.currentTarget.dataset.index - wx.switchTab({ - url: '/pages/kind/kind' - }) - }, - // 跳转页面 - btn_name() { - wx.navigateTo({ - url: '/pages/homeindex/search/search', - }) - }, - get_info() { - let that = this - let url = app.interface.index; - let header = { - 'XX-Device-Type': 'wxapp', - 'XX-Token': wx.getStorageSync('token') - } - - app.post(url, {}, header).then((res) => { - console.log(res) - that.setData({ - banner: res.data.banner, - shop_class: res.data.shop_class, - middle: res.data.middle, - shop:res.data.shop - }) - - }).catch((errMsg) => {}) - - }, - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function(options) { - let that = this - that.get_info() - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function() { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function() { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function() { - }, + /** + * 页面的初始数据 + */ + data: { + banner: [], + shop_class: [], + middle: '', + shop: [], + num: 1, + showModal: false, + class_id: '', + detailCon: {}, + id: '', + }, + look_category(e) { + console.log(e) + app.globalData.cid = e.currentTarget.dataset.index + app.globalData.class_id = e.currentTarget.dataset.class_id + console.log(app.globalData.cid) + wx.switchTab({ + url: '/pages/kind/kind' + }) + this.get_info() + }, + // 跳转页面 + btn_name() { + wx.navigateTo({ + url: '/pages/homeindex/search/search', + }) + }, + get_info() { + let that = this + let url = app.interface.index; + let header = { + 'XX-Device-Type': 'wxapp', + 'XX-Token': wx.getStorageSync('token') + } + let params = { + class_id: that.data.class_id + } + console.log(params) + app.post(url, params, header).then((res) => { + console.log(res) + that.setData({ + banner: res.data.banner, + shop_class: res.data.shop_class, + middle: res.data.middle, + shop: res.data.shop, + now_time: res.data.now_time + }) + that.countDown() + + + + }).catch((errMsg) => { }) + + }, + goConfirm: function (e) { + + this.setData({ + showModal: true, + index: e.currentTarget.dataset.index + }) + }, + m_close: function () { + this.setData({ + showModal: false, + }) + }, + // 点击加减 + bindMinus: function () { + var num = this.data.num; + if (num > 1) { + num--; + } + this.setData({ + num: num, + }); + }, + // 点击加 + bindPlus: function () { + var num = this.data.num; + num++; + this.setData({ + num: num, + }); + }, + + shoptail(e) { + console.log(e) + let id = e.currentTarget.dataset.shop_id; + wx.navigateTo({ + url: '/pages/kind/detail_1/detail_1?id=' + id, + }) + }, + // 去团购 + goFirm_order1(e) { + this.setData({ + + }) + wx.navigateTo({ + url: '/pages/kind/firm_order1/firm_order1?id=' + e.currentTarget.dataset.id + "&&num=" + this.data.num, + }) + }, + + timeFormat(param) { //小于10的格式化函数 + return param < 10 ? '0' + param : param; + }, + //团购倒计时 + countDown() { + let that = this + let objs = Object.assign([], that.data.shop) + let now_time = parseInt(new Date().getTime()) + // console.log(now_time) + + for (let obj of objs) { + + let end_time = obj.end_time * 1000 + // console.log(end_time) + let open_time = obj.open_time * 1000 + if (now_time < open_time) { + // console.log(333) + //活动未开始 + } else if (now_time > end_time) { + // console.log(222) + //活动结束 + } else { + // console.log(1111) + let time = (end_time - now_time) / 1000; + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + + obj.day = that.timeFormat(day), + obj.hou = that.timeFormat(hou), + obj.min = that.timeFormat(min), + obj.sec = that.timeFormat(sec) + + // console.log(obj.day, obj.hou, obj.min, obj.sec) + } + } + that.setData({ + shop: objs + }) + // console.log(that.data.shop) + setTimeout(that.countDown, 1000); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let that = this + that.get_info() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + let that = this + if (app.globalData.cid != null) { + that.setData({ + currentTab: app.globalData.cid + }) + console.log(this.data.aa) + } + that.get_info() + that.countDown() + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function() { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function() { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function() { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function() { - - } + } }) \ No newline at end of file diff --git a/pages/homeindex/homeindex.wxml b/pages/homeindex/homeindex.wxml index 56b3c6a..4cc1d3c 100644 --- a/pages/homeindex/homeindex.wxml +++ b/pages/homeindex/homeindex.wxml @@ -22,7 +22,7 @@ <view class='commodity'> <!-- <navigator url=''> </navigator> --> - <view class='jujia' wx:for='{{shop_class}}' wx:key="index" bindtap='look_category' data-index='{{index}}'> + <view class='jujia' wx:for='{{shop_class}}' wx:key="index" data-class_id="{{item.class_id}}" bindtap='look_category' data-index='{{index}}'> <image src='{{item.img}}'></image> <text>{{item.class_name}}</text> </view> @@ -50,12 +50,12 @@ </view> <view class='container'> <view class='mid'> - <view class='ware_box' wx:for='{{shop}}' wx:key="index"> + <view class='ware_box' bindtap="shoptail" wx:for='{{shop}}' data-shop_id='{{item.shop_id}}' wx:key="index"> <view class='ware_top'> <view class='ware_1'> <image src='{{item.thumb}}'></image> <view class='ware_1_time'> - 据结束2时22分 + 据结束{{item.day}}天{{item.hou}}时{{item.min}}分{{item.sec}}秒 </view> </view> <view class='ware_text'> @@ -64,21 +64,21 @@ <text class='ware_2Txt2'>{{item.origin}}</text> </view> <view class='ware_3'> - <progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> + <progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> </view> <view class='ware_4'> <text>现有{{item.numb}}份,目标{{item.group}}份</text> </view> <view class='ware_5'> <view> - <text class='ware5_t1'>{{item.money_sale}}</text> + <text class='ware5_t1'>¥{{item.money_sale}}/</text> <text class='ware5_t2'>{{item.shop_type}}</text> </view> <view class='ware5_box'> <view class='ware5_t3'>{{item.text_table}}</view> <view class='ware5_t4'>{{item.text_content}}</view> </view> - <view class='ware_6'> + <view class='ware_6' data-index="{{index}}" catchtap='goConfirm'> <view>立即参团</view> </view> </view> @@ -90,4 +90,35 @@ </view> </view> </view> +</view> +<!-- 弹窗 --> +<view class="mask" catchtouchmove="preventTouchMove" wx:if="{{showModal}}"></view> +<!-- 弹出层 --> +<view class="modalDlg" wx:if="{{showModal}}"> + <view class='modalDlg_p'> + <view class='m_top'> + <view class='m_topImg'> + <image src='{{shop[index].thumb}}'></image> + </view> + <view class='m_topTxt'> + <view class='m_topTxt1'> + <view class='m_topName'>{{shop[index].name}}</view> + <image bindtap='m_close' src='../../img/cha.png'></image> + </view> + <view class='m_topTxt2'> + <view class='m_topPrice'>¥{{shop[index].money_sale}}</view> + <view class='m_topHelf'>{{shop[index].shop_type}}</view> + </view> + </view> + </view> + <view class='m_number'> + <view class='m_numTxt'>购买数量</view> + <view class='minus_push'> + <view class='minus' bindtap="bindMinus">-</view> + <view class='num' bindchange="bindManual">{{num}}</view> + <view class='push' bindtap="bindPlus">+</view> + </view> + </view> + <button class='m_btn' bindtap='goFirm_order1' data-id="{{shop[index].shop_id}}">确认</button> + </view> </view> \ No newline at end of file diff --git a/pages/homeindex/homeindex.wxss b/pages/homeindex/homeindex.wxss index 6b706ed..988670c 100644 --- a/pages/homeindex/homeindex.wxss +++ b/pages/homeindex/homeindex.wxss @@ -1,45 +1,52 @@ /* pages/homeindex/homeindex.wxss */ -.search{ + +.search { padding: 16rpx 32rpx; height: 64rpx; - background: #6EAC3D; + background: #6eac3d; display: flex; justify-content: center; align-content: space-between; } -.search_inp{ + +.search_inp { box-sizing: border-box; width: 608rpx; height: 64rpx; border-radius: 32rpx; - display:flex; + display: flex; align-items: center; padding-left: 76rpx; padding-right: 32rpx; - background:#fff; + background: #fff; border: 0; outline: none; font-size: 26rpx; position: relative; + color: #666; } -.search_inp input{ + +.search_inp input { width: 100%; } -.search_inp image{ + +.search_inp image { position: absolute; left: 32rpx; top: 17rpx; width: 32rpx; height: 32rpx; } -.search_txt{ + +.search_txt { height: 64rpx; font-size: 30rpx; color: #fff; line-height: 64rpx; padding-left: 16rpx; } -.banner{ + +.banner { width: 688rpx; height: 336rpx; margin: 0 auto; @@ -47,86 +54,101 @@ position: relative; border-radius: 8rpx; } -.swiper{ + +.swiper { height: 100%; position: absolute; z-index: 99; } -.swiper-item{ + +.swiper-item { width: 688rpx; margin: 0 auto; height: 336rpx; border-radius: 8rpx; } -.swiper-item image{ + +.swiper-item image { height: auto; } -.banner_Mask{ - width:656rpx; + +.banner_Mask { + width: 656rpx; height: 336rpx; - background:rgba(181,222,150,1); - box-shadow:0rpx 6rpx 40rpx rgba(93,255,0,0.44); - opacity:0.3; + background: rgba(181, 222, 150, 1); + box-shadow: 0rpx 6rpx 40rpx rgba(93, 255, 0, 0.44); + opacity: 0.3; position: absolute; bottom: 16rpx; z-index: -1; left: 16rpx; border-radius: 8rpx; } -.commodity{ + +.commodity { width: 688rpx; /* margin: 0 auto; */ padding: 64rpx 32rpx; display: flex; - justify-content:space-around; + justify-content: space-around; align-items: center; font-size: 24rpx; - color: #333333; - border-bottom: 8px solid rgba(249,250,252,1); + color: #333; + border-bottom: 8px solid rgba(249, 250, 252, 1); } -.commodity view{ + +.commodity view { } + .introduce_list { display: flex; justify-content: space-around; align-items: center; padding: 36rpx 32rpx 48rpx 32rpx; } -.introduce_list .introduce_item{ + +.introduce_list .introduce_item { display: flex; justify-content: space-between; align-items: center; } -.introduce_list .introduce_item:first-child image{ + +.introduce_list .introduce_item:first-child image { width: 32rpx; height: 36rpx; } -.introduce_list .introduce_item:nth-child(2) image{ + +.introduce_list .introduce_item:nth-child(2) image { width: 36rpx; height: 31rpx; } -.introduce_list .introduce_item:nth-child(3) image{ + +.introduce_list .introduce_item:nth-child(3) image { width: 32rpx; height: 29rpx; } -.introduce_list .introduce_item text{ + +.introduce_list .introduce_item text { font-size: 28rpx; display: flex; align-items: center; margin-left: 16rpx; } -.introduce image{ + +.introduce image { width: 668rpx; height: 208rpx; display: block; margin: 0 auto; } -.commodity .jujia image,.commodity .fenlei image{ + +.commodity .jujia image, .commodity .fenlei image { width: 112rpx; height: 112rpx; margin: 0 auto; } -.commodity text{ + +.commodity text { display: flex; margin-top: 14rpx; text-align: center; @@ -134,219 +156,430 @@ align-items: center; } -.container{ +.container { width: 750rpx; display: flex; align-items: center; flex-flow: column; } -.mid{ + +.mid { margin-top: 16rpx; display: flex; flex-flow: column; } -.ware_box{ - width:688rpx; - height:400rpx; - margin:32rpx auto; - background:#F9FAFC; -} -.ware_top{ - overflow: hidden; - display: flex; - padding:32rpx 18rpx 0; -} -.ware_1{ - width:312rpx; - height:208rpx; - position: relative; -} -.ware_1 image{ - width:100%; - height:100%; -} -.ware_1_time{ - position: absolute; - bottom:0; - width:208rpx; - height:48rpx; - color: white; - text-align: center; - line-height:48rpx; - font-size:24rpx; - background:#FAC8C8; - font-family:PingFang SC; -} -.ware_text{ - margin-left:14rpx; - width:100%; -} -.ware_2{ + +.ware_box { + width: 688rpx; + height: 400rpx; + margin: 32rpx auto; + background: #f9fafc; +} + +.ware_top { + overflow: hidden; + display: flex; + padding: 32rpx 18rpx 0; +} + +.ware_1 { + width: 312rpx; + height: 208rpx; + position: relative; +} + +.ware_1 image { + width: 100%; + height: 100%; +} + +.ware_1_time { + position: absolute; + bottom: 0; + width: 208rpx; + height: 48rpx; + color: white; + text-align: center; + line-height: 48rpx; + font-size: 17rpx; + background: #fac8c8; + font-family: PingFang SC; +} + +.ware_text { + margin-left: 14rpx; + width: 100%; +} + +.ware_2 { display: flex; justify-content: space-between; align-content: center; } -.ware_2Txt1{ - font-size:32rpx; - font-family:PingFang SC; - font-weight:600; - line-height:44rpx; - color:rgba(51,51,51,1); -} -.ware_2Txt2{ - font-size:22rpx; - /* margin-left:98rpx; */ - font-family:PingFang SC; - font-weight:400; - line-height:32rpx; - color:rgba(204,204,204,1); -} -.ware_3 progress{ - width:370rpx; - color:#B5DE96; - margin-top:24rpx; -} -.ware_4 text,.ware5_t2{ - font-size:18rpx; - font-family:PingFang SC; - font-weight:400; - line-height:32rpx; - color:rgba(204,204,204,1); -} -.ware_5{ - display: flex; - display: -webkit-flex; - justify-content: space-between; -} -.ware5_t1{ - font-size:30rpx; - font-family:DIN 1451 Std Mittelschrift; - font-weight:400; - color:rgba(255,0,0,1); -} -.ware5_t3{ - font-size:22rpx; - font-family:PingFang SC; - font-weight:400; - line-height:30rpx; - color:rgba(51,51,51,1); -} -.ware5_t4{ - font-size:18rpx; - font-family:PingFang SC; - font-weight:400; - color:rgba(153,153,153,1); -} -.ware_6{ - width:144rpx; - height:48rpx; - background:rgba(249,150,20,1); - box-shadow:0px 2rpx 12rpx rgba(255,145,0,0.16); - border-radius:24rpx; -} -.ware_6 view{ - font-size:26rpx; - font-family:PingFang SC; - font-weight:400; - text-align: center; - line-height:48rpx; - color:rgba(255,255,255,1); -} -.ware_bot{ - width:670rpx; - height:80rpx; - margin: auto; - display: flex; - line-height:80rpx; - margin-top:32rpx; - background-color:#F1F7F1; -} -.ware_bot_tit{ - font-size:30rpx; - font-weight:bold; - margin-left:32rpx; - color:rgba(110,172,61,1); -} -.ware_bot_tit:after{ - content:""; - margin:0 38rpx; - border-right:1px solid #B5DE96; -} -.ware_bot_txt{ - font-size:24rpx; - font-family:PingFang SC; - font-weight:400; - color:rgba(153,153,153,1); + +.ware_2Txt1 { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 600; + line-height: 44rpx; + color: rgba(51, 51, 51, 1); +} + +.ware_2Txt2 { + font-size: 22rpx; + /* margin-left:98rpx; */ + font-family: PingFang SC; + font-weight: 400; + line-height: 32rpx; + color: rgba(204, 204, 204, 1); +} + +.ware_3 progress { + width: 370rpx; + color: #b5de96; + margin-top: 24rpx; +} + +.ware_4 text { + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + line-height: 32rpx; + color: rgba(204, 204, 204, 1); +} + +.ware5_t2 { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + width: 70rpx; + display: inline-block; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + line-height: 19rpx; + margin-left: 4rpx; + color: rgba(204, 204, 204, 1); +} + +.ware_5 { + display: flex; + display: -webkit-flex; + justify-content: space-between; +} + +.ware5_t1 { + width: 110rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 26rpx; + font-family: DIN 1451 Std Mittelschrift; + font-weight: 400; + color: rgba(255, 0, 0, 1); +} + +.ware5_t3 { + width: 104rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 20rpx; + font-family: PingFang SC; + font-weight: 400; + line-height: 30rpx; + color: rgba(51, 51, 51, 1); +} + +.ware5_t4 { + font-size: 18rpx; + font-family: PingFang SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + +.ware_6 { + width: 144rpx; + height: 48rpx; + background: rgba(249, 150, 20, 1); + box-shadow: 0px 2rpx 12rpx rgba(255, 145, 0, 0.16); + border-radius: 24rpx; } + +.ware_6 view { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 400; + text-align: center; + line-height: 48rpx; + color: rgba(255, 255, 255, 1); +} + +.ware_bot { + width: 670rpx; + height: 80rpx; + margin: auto; + display: flex; + line-height: 80rpx; + margin-top: 32rpx; + background-color: #f1f7f1; +} + +.ware_bot_tit { + font-size: 30rpx; + font-weight: bold; + margin-left: 32rpx; + color: rgba(110, 172, 61, 1); +} + +.ware_bot_tit:after { + content: ""; + margin: 0 38rpx; + border-right: 1px solid #b5de96; +} + +.ware_bot_txt { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + /* 规格 */ -.spec{ - width:100%; - padding:0 32rpx; - line-height:80rpx; - display: flex; - height:80rpx; - margin-top:8rpx; - background:white; -} -.spec_txt{ - font-size:32rpx; - font-family:PingFang SC; - font-weight:400; - color:rgba(51,51,51,1); -} -.spec_txt2{ - font-size:24rpx; - font-family:PingFang SC; - font-weight:400; - margin-left:108rpx; - color:rgba(153,153,153,1); + +.spec { + width: 100%; + padding: 0 32rpx; + line-height: 80rpx; + display: flex; + height: 80rpx; + margin-top: 8rpx; + background: white; +} + +.spec_txt { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 400; + color: rgba(51, 51, 51, 1); } + +.spec_txt2 { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + margin-left: 108rpx; + color: rgba(153, 153, 153, 1); +} + /* 商品详情 */ -.ware_detail{ - width:100%; - margin-top:8rpx; - margin-bottom:96rpx; - padding-bottom:66rpx; - background: white; -} -.ware_detail_tit{ - width:688rpx; - margin: auto; - display: flex; - padding:44rpx 0rpx 42rpx; - justify-content:space-around; - border-bottom:2rpx solid #F5F5F5; -} -.ware_detail .ware_active{ - color:#6EAC3D; - font-weight:600; -} -.ware_active:after{ - content: ""; - width:16rpx; - height: 6rpx; - margin: auto; - display: block; - margin-top:6rpx; - border-radius:8rpx; - background:rgba(110,172,61,1); -} -.ware_detail_tit view{ - font-size:28rpx; - font-family:PingFang SC; - font-weight:400; - color:rgba(153,153,153,1); -} -.ware_detailC{ - width:688rpx; - margin:26rpx auto 0; -} - -.ware_detailImg{ - width:688rpx; - height:470rpx; -} -.ware_detailImg image{ - width:100%; - height:100%; + +.ware_detail { + width: 100%; + margin-top: 8rpx; + margin-bottom: 96rpx; + padding-bottom: 66rpx; + background: white; +} + +.ware_detail_tit { + width: 688rpx; + margin: auto; + display: flex; + padding: 44rpx 0rpx 42rpx; + justify-content: space-around; + border-bottom: 2rpx solid #f5f5f5; +} + +.ware_detail .ware_active { + color: #6eac3d; + font-weight: 600; +} + +.ware_active:after { + content: ""; + width: 16rpx; + height: 6rpx; + margin: auto; + display: block; + margin-top: 6rpx; + border-radius: 8rpx; + background: rgba(110, 172, 61, 1); +} + +.ware_detail_tit view { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + +.ware_detailC { + width: 688rpx; + margin: 26rpx auto 0; +} + +.ware_detailImg { + width: 688rpx; + height: 470rpx; +} + +.ware_detailImg image { + width: 100%; + height: 100%; +} + +/* 遮罩层 */ + +.mask { + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + background: #000; + z-index: 9000; + opacity: 0.64; +} + +/* 弹出层 */ + +.modalDlg { + width: 100%; + height: 454rpx; + bottom: 0; + position: fixed; + z-index: 9999; + background-color: #fff; +} + +.modalDlg_p { + padding: 0 30rpx; +} + +.m_top { + display: flex; +} + +.m_topTxt1 { + display: flex; + align-self: center; + justify-content: space-between; + margin-top: 30rpx; +} + +.m_topTxt { + width: 100%; + margin-left: 16rpx; +} + +.m_topImg { + margin-top: -48rpx; + display: flex; +} + +.m_topImg image { + width: 208rpx; + height: 208rpx; +} + +.m_topTxt1 image { + width: 32rpx; + height: 32rpx; +} + +.m_topName { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 600; + color: rgba(51, 51, 51, 1); +} + +.m_topTxt2 { + display: flex; + margin-top: 16rpx; + align-items: center; +} + +.m_topPrice { + width: 120rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 28rpx; + font-family: DIN 1451 Std Mittelschrift; + font-weight: 400; + color: #f00; +} + +.m_topHelf { + width: 280rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 22rpx; + font-family: PingFang SC; + font-weight: 400; + margin-left: 16rpx; + color: rgba(204, 204, 204, 1); +} + +.m_number { + display: flex; + align-items: center; + margin-top: 18rpx; +} + +.minus_push { + display: flex; + margin-left: auto; + align-items: center; +} + +.m_numTxt { + font-size: 24rpx; + font-family: PingFang SC; + font-weight: 400; + color: rgba(153, 153, 153, 1); +} + +.minus, .push { + width: 48rpx; + height: 48rpx; + font-size: 40rpx; + text-align: center; + line-height: 48rpx; + border: 2px solid rgba(110, 172, 61, 1); + border-radius: 50%; +} + +.minus { + color: #6eac3d; +} + +.num { + margin: 0 26rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 400; + color: rgba(110, 172, 61, 1); +} + +.push { + color: white; + background: rgba(110, 172, 61, 1); +} + +.m_btn { + width: 688rpx; + height: 80rpx; + border: 0; + margin-top: 62rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 600; + color: rgba(255, 255, 255, 1); + background: linear-gradient(170deg, rgba(181, 222, 150, 1) 0%, rgba(169, 209, 33, 1) 100%); + box-shadow: 0rpx 6rpx 40rpx rgba(162, 255, 0, 0.15); + border-radius: 48rpx; } \ No newline at end of file diff --git a/pages/kind/detail_1/detail_1.js b/pages/kind/detail_1/detail_1.js index 3ccbd95..4478c57 100644 --- a/pages/kind/detail_1/detail_1.js +++ b/pages/kind/detail_1/detail_1.js @@ -2,186 +2,222 @@ const app = getApp(); var WxParse = require('../../../wxParse/wxParse.js'); Page({ - /** - * 页面的初始数据 - */ - data: { - index: 1, - showModal: false, - hide: false, - num: 1, - detail_id: null, - detailCon: {}, - assess: [], - id:'' - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - console.log(options) - this.setData({ - detail_id: options.id, - id:options.id - }) - this.detaiFun(options.id) - this.assessFun() - }, - goFirm_order1(e) { - - wx.navigateTo({ - url: '../firm_order1/firm_order1?id=' + e.currentTarget.dataset.id + "&&num=" + this.data.num, - }) - }, - - // 商品详情数据 - detaiFun(id) { - let that = this; - let url = "home/index/shopEdit"; - let params = { - shop_id: that.data.id - } - let header = { - "XX-Token": wx.getStorageSync('token'), - "XX-Device-Type": 'wxapp' - } - app.post(url, params, header).then((res) => { - console.log(res) - that.setData({ - detailCon: res.data, - content: res.content - }) - WxParse.wxParse('content', 'html', this.data.content, this, 5); - console.log(that.data.detailCon) - }).catch((err) => { - console.log(err) - }) - }, - // 商品评价页面 - assessFun() { - let that = this; - let url = "home/index/shopMessage"; - let header = { - "XX-Token": '123123', - "XX-Device-Type": 'wxapp' - } - let params = { - shop_id: that.data.detail_id, - } - app.post(url, params, header).then((res) => { - console.log(res) - that.setData({ - assess: res.data.list - }) - }).catch((err) => { - console.log(err) - }) - }, - // 加入收藏 - addFun() { - let that = this; - let url = "home/index/shopCollect"; - let params = { - shop_id: that.data.detail_id, - }; - let header = { - "XX-Token": '123123', - "XX-Device-Type": 'wxapp' - }; - app.post(url, params, header).then((res) => { - console.log(res) - // if(res.code == 20000){ - wx.showToast({ - title: res.msg, - icon: "none", - duration: 1500 - }) - - // } - }).catch((err) => { - console.log(err) - }) - }, - goy(e) { - this.setData({ - index: e.currentTarget.dataset.id, - }) - }, - goConfirm: function () { - this.setData({ - showModal: true, - }) - }, - m_close: function () { - this.setData({ - showModal: false, - }) - }, - // 点击加减 - bindMinus: function () { - var num = this.data.num; - if (num > 1) { - num--; + /** + * 页面的初始数据 + */ + data: { + index: 1, + showModal: false, + hide: false, + num: 1, + detail_id: null, + detailCon: {}, + assess: [], + id: '', + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + console.log(options) + this.setData({ + detail_id: options.id, + id: options.id + }) + this.detaiFun(options.id) + this.assessFun(); + }, + goFirm_order1(e) { + wx.navigateTo({ + url: '../firm_order1/firm_order1?id=' + e.currentTarget.dataset.id + "&&num=" + this.data.num, + }) + }, + + // 商品详情数据 + detaiFun(id) { + let that = this; + let url = "home/index/shopEdit"; + let params = { + shop_id: that.data.id + } + let header = { + "XX-Token": wx.getStorageSync('token'), + "XX-Device-Type": 'wxapp' + } + app.post(url, params, header).then((res) => { + console.log(res) + that.setData({ + detailCon: res.data, + content: res.content, + now_time: res.data.now_time, + }) + WxParse.wxParse('content', 'html', this.data.content, this, 5); + that.countDown() + }).catch((err) => { + console.log(err) + }) + }, + // 商品评价页面 + assessFun() { + let that = this; + let url = "home/index/shopMessage"; + let header = { + 'XX-Token': wx.getStorageSync('token'), + "XX-Device-Type": 'wxapp' + } + let params = { + shop_id: that.data.detail_id, + } + app.post(url, params, header).then((res) => { + console.log(res) + that.setData({ + assess: res.data.list + }) + }).catch((err) => { + console.log(err) + }) + }, + // 加入收藏 + addFun() { + let that = this; + let url = "home/index/shopCollect"; + let params = { + shop_id: that.data.detail_id, + }; + let header = { + 'XX-Token': wx.getStorageSync('token'), + "XX-Device-Type": 'wxapp' + }; + app.post(url, params, header).then((res) => { + console.log(res) + // if(res.code == 20000){ + wx.showToast({ + title: res.msg, + icon: "none", + duration: 1500 + }) + + // } + }).catch((err) => { + console.log(err) + }) + }, + goy(e) { + this.setData({ + index: e.currentTarget.dataset.id, + }) + }, + goConfirm: function() { + this.setData({ + showModal: true, + }) + }, + m_close: function() { + this.setData({ + showModal: false, + }) + }, + // 点击加减 + bindMinus: function() { + var num = this.data.num; + if (num > 1) { + num--; + } + this.setData({ + num: num, + }); + }, + // 点击加 + bindPlus: function() { + var num = this.data.num; + num++; + this.setData({ + num: num, + }); + }, + timeFormat(param) { //小于10的格式化函数 + return param < 10 ? '0' + param : param; + }, + + //团购倒计时 + countDown() { + let that = this; + let detail = that.data.detailCon; + let now_time = parseInt(new Date().getTime()) + // console.log(now_time) + let end_time = detail.end_time * 1000 + // console.log(end_time) + let open_time = detail.open_time * 1000 + if (now_time < open_time) { + // console.log(333) + //活动未开始 + } else if (now_time > end_time) { + // console.log(222) + //活动结束 + } else { + // console.log(1111) + let time = (end_time - now_time) / 1000; + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + detail.day = that.timeFormat(day), + detail.hou = that.timeFormat(hou), + detail.min = that.timeFormat(min), + detail.sec = that.timeFormat(sec) + } + that.setData({ + detailCon: detail + }) + setTimeout(that.countDown, 1000); + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + } - this.setData({ - num: num, - }); - }, - // 点击加 - bindPlus: function () { - var num = this.data.num; - num++; - this.setData({ - num: num, - }); - }, - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } }) \ No newline at end of file diff --git a/pages/kind/detail_1/detail_1.wxml b/pages/kind/detail_1/detail_1.wxml index 4db394c..8e87ac6 100644 --- a/pages/kind/detail_1/detail_1.wxml +++ b/pages/kind/detail_1/detail_1.wxml @@ -6,7 +6,7 @@ <view class='ware_1'> <image src='{{detailCon.thumb}}'></image> <view class='ware_1_time'> - {{detailCon.open_time}} + 据结束{{detailCon.day}}天{{detailCon.hou}}时{{detailCon.min}}分{{detailCon.sec}}秒 </view> </view> <view class='ware_text'> @@ -15,7 +15,7 @@ <text class='ware_2Txt2'>产地:{{detailCon.origin}}</text> </view> <view class='ware_3'> - <progress percent="42" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> + <progress percent="{{detailCon.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> </view> <view class='ware_4'> <text>已拼{{detailCon.numb}}份,目标{{detailCon.group}}份</text> @@ -29,7 +29,7 @@ <view class='ware5_t3'>{{detailCon.text_table}}</view> <view class='ware5_t4'>{{detailCon.text_content}}</view> </view> - <view class='ware_6'> + <view class='ware_6' bindtap='goConfirm'> <view>立即参团</view> </view> </view> @@ -76,26 +76,6 @@ </view> <view class='assess_time'>2019/07/01</view> </view> - <!-- <view class='ware_assess_li'> - <view class='assess_header'> - <view class='assess_headerImg'> - <image src='../../../img/jujia@2x.png'></image> - </view> - <view class='assess_headerTxt'>朱*明</view> - </view> - <view class='assess_say'> - 质量很不错,很喜欢。 - </view> - <view class='ware_pic'> - <view class='ware_picBox'> - <image src='../../../img/gerenzhingxinbeijing@2x.png'></image> - </view> - <view class='ware_picBox'> - <image src='../../../img/gerenzhingxinbeijing@2x.png'></image> - </view> - </view> - <view class='assess_time'>2019/07/01</view> - </view> --> <view class='whole'> 查看全部评价 </view> diff --git a/pages/kind/detail_1/detail_1.wxss b/pages/kind/detail_1/detail_1.wxss index 57c6a94..0aa9e4b 100644 --- a/pages/kind/detail_1/detail_1.wxss +++ b/pages/kind/detail_1/detail_1.wxss @@ -44,7 +44,7 @@ page { color: white; text-align: center; line-height: 48rpx; - font-size: 24rpx; + font-size: 18rpx; background: #fac8c8; font-family: PingFang SC; } diff --git a/pages/kind/firm_order1/firm_order1.js b/pages/kind/firm_order1/firm_order1.js index 4b964b3..087516d 100644 --- a/pages/kind/firm_order1/firm_order1.js +++ b/pages/kind/firm_order1/firm_order1.js @@ -1,99 +1,114 @@ // pages/kind/firm_order1/firm_order1.js const app = getApp(); Page({ - // 点击立即支付 - goFirm_order2: function (e) { - - }, - /** - * 页面的初始数据 - */ - data: { - shop_id: null, - order_list: {} - }, - - /** - * 生命周期函数--监听页面加载 - */ - onLoad: function (options) { - - console.log(options.num) - this.setData({ - shop_id: options.id - }) - console.log(options.id) - this.order(options.num) - }, - // 确认订单1数据 - order(num) { - let that = this; - let url = "home/index/goods"; - let header = { - "XX-Token": wx.getStorageSync('token'), - "XX-Device-Type": 'wxapp' - } - let params = { - shop_id: that.data.shop_id, - shop_numb: num - } - app.post(url, params, header).then((res) => { - console.log(res) - that.setData({ - order_list: res.data - }) - console.log(that.data.order_list) - }).catch((err) => { - console.log(err) - }) - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - - }, - - /** - * 生命周期函数--监听页面隐藏 - */ - onHide: function () { - - }, + // 点击立即支付 + goFirm_order2: function(e) { + + }, + /** + * 页面的初始数据 + */ + data: { + shop_id: null, + order_list: {} + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function(options) { + + console.log(options.num) + this.setData({ + shop_id: options.id + }) + console.log(options.id) + this.order(options.num) + }, + // 确认订单1数据 + order(num) { + let that = this; + let url = "home/index/goods"; + let header = { + "XX-Token": wx.getStorageSync('token'), + "XX-Device-Type": 'wxapp' + } + let params = { + shop_id: that.data.shop_id, + shop_numb: num + } + console.log(header); + console.log(params); + app.post(url,params,header).then((res) => { + console.log(res) + that.setData({ + order_list: res.data + }) + console.log(that.data.order_list) + }).catch((err) => { + console.log(err) + + }) + }, + //确认订单2地址接口 + // orderAddress(){ + // let that = this; + // let url = "home/index/pay"; + // let header = { + // "XX-Token": wx.getStorageSync('token'), + // "XX-Device-Type": 'wxapp' + // } + // let params = { + // address_id = + // } + + // } + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - - }, - - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, - - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - - } + } }) \ No newline at end of file diff --git a/pages/mine/addr_1/addr_1.js b/pages/mine/addr_1/addr_1.js index 3469a70..0e40b08 100644 --- a/pages/mine/addr_1/addr_1.js +++ b/pages/mine/addr_1/addr_1.js @@ -30,7 +30,7 @@ Page({ } let header = { - "XX-Token": '123123', + "XX-Token": wx.getStorageSync('token'), "XX-Device-Type": 'wxapp' } app.post(url, params, header).then((res) => { @@ -60,26 +60,25 @@ Page({ address_id: id } let header = { - "XX-Token": '123123', + "XX-Token": wx.getStorageSync('token'), "XX-Device-Type": 'wxapp' } app.post(url, params, header).then((res) => { console.log(res) - if (res == '') { - wx.showToast({ + // if (res == '') { + // wx.showToast({ + // title: '删除成功', + // icon: 'none' + // }) + wx.showToast({ title: '删除成功', icon: 'none' }) - setTimeout(function () { that.getaddresslist() }, 1000) - - } - // console.log('删除功能'+res); - // that.setData({ - // address_id: res.list - // }) + + }).catch((err) => { diff --git a/pages/mine/addr_2/addr_2.js b/pages/mine/addr_2/addr_2.js index 2fe1e86..8f789bb 100644 --- a/pages/mine/addr_2/addr_2.js +++ b/pages/mine/addr_2/addr_2.js @@ -76,23 +76,23 @@ Page({ address_id: that.data.address_id } let header = { - "XX-Token": '123123', + "XX-Token": wx.getStorageSync('token'), "XX-Device-Type": 'wxapp' } app.post(url, params, header).then((res) => { console.log(res); // 列表值 that.setData({ - addressEdit: res, - region: [res.province, res.city, res.county], - province: res.province, - name: res.name, - mobile: res.mobile, - status: res.status, - province: res.province, - city: res.city, - county: res.city, - address: res.address, + addressEdit: res.data, + region: [res.data.province, res.data.city, res.data.county], + province: res.data.province, + name: res.data.name, + mobile: res.data.mobile, + status: res.data.status, + province: res.data.province, + city: res.data.city, + county: res.data.city, + address: res.data.address, }) @@ -123,7 +123,7 @@ Page({ address: that.data.address } let header = { - "XX-Token": '123123', + "XX-Token": wx.getStorageSync('token'), "XX-Device-Type": 'wxapp' } app.post(url, params, header).then((res) => { diff --git a/pages/mine/collect/collect.js b/pages/mine/collect/collect.js index 8d0c68e..e733164 100644 --- a/pages/mine/collect/collect.js +++ b/pages/mine/collect/collect.js @@ -48,14 +48,14 @@ Page({ } let header = { - "XX-Token": '123123', + "XX-Token": wx.getStorageSync('token'), "XX-Device-Type": 'wxapp' } app.post(url, params, header).then((res) => { console.log(res); // 列表值 that.setData({ - collectList: res.list + collectList: res.data.list }) console.log(that.data.collectList) diff --git a/pages/mine/collect/collect.wxml b/pages/mine/collect/collect.wxml index 174f618..f71fbb7 100644 --- a/pages/mine/collect/collect.wxml +++ b/pages/mine/collect/collect.wxml @@ -1,6 +1,9 @@ <view class='container'> <view class='mid'> + + <view class="nodata" wx:if='{{collectList.length==0}}'>暂无数据</view> + <block wx:else> <view class='mid_item' wx:for="{{collectList}}" wx:key=""> <!-- 顶部 --> <view class='mid_item_top'> @@ -79,83 +82,8 @@ </view> </view> </view> + </block> - <view class='mid_item'> - <!-- 顶部 --> - <view class='mid_item_top'> - <!-- 左边 --> - <view class='mid_item_top_left'> - <view class='top_left_pic'> - <image src='../../../img/goods_1.png'></image> - - - </view> - <view class='text_color'> - 距开始2时22分距结束2时22分 - </view> - </view> - <!-- 右边 --> - <view class='mid_item_top_right'> - <!-- 右上 --> - <view class='right_top'> - <view class='right_top_lef'> - 纯进口有机菜花 - </view> - <view class='right_top_rig'> - 产地:罗利 - </view> - </view> - <!-- 右中1 --> - <view class='right_mid'> - <view class='right_mid_lef'> - <view class='right_mid_lef_color'></view> - </view> - <view class='right_mid_rig'> - 42% - </view> - </view> - <!-- 右中2 --> - <view class='right_text'> - 已拼300份,目标500份 - </view> - <!-- 右下 --> - <view class='right_bottom'> - <!-- 右下左 --> - <view class='right_bottom_lef'> - <span class='RBM'>¥</span> - <span class='number'>52/</span> - <span class='text'>1磅1份1磅1份</span> - - </view> - <!-- 右下中 --> - <view class='right_bottom_mid'> - <view class='right_bottom_mid_t'> - 40mm-50m - </view> - <view class='right_bottom_mid_b'> - 番茄果径 番茄果径番茄果径 - </view> - </view> - <!-- 右下右 --> - <view class='right_bottom_rig'> - 立即参团 - </view> - </view> - </view> - - - </view> - <view class='mid_item_bottom'> - <view class='mid_item_bottom_left'> - 经典推荐 - </view> - <!-- 竖线 --> - <view class='mid_line'></view> - <!-- 底部文本 --> - <view class='mid_item_bottom_bot'> - 智利进口,绿色健康,硕大饱满 - </view> - </view> - </view> + </view> </view> \ No newline at end of file diff --git a/pages/mine/collect/collect.wxss b/pages/mine/collect/collect.wxss index 030020c..4f3c2a3 100644 --- a/pages/mine/collect/collect.wxss +++ b/pages/mine/collect/collect.wxss @@ -36,7 +36,7 @@ flex-flow: column; } .top_left_pic{ - width: 208rpx; + width: 202rpx; height: 160rpx; display: flex; } @@ -248,4 +248,8 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; +} +.nodata{ + margin-top: 20rpx; + font-size: 30rpx; } \ No newline at end of file diff --git a/pages/mine/eOrder/eOrder.js b/pages/mine/eOrder/eOrder.js index 370adb4..0ad1eec 100644 --- a/pages/mine/eOrder/eOrder.js +++ b/pages/mine/eOrder/eOrder.js @@ -1,65 +1,165 @@ +const app = getApp(); +var that; Page({ /** * 页面的初始数据 */ data: { - + images: [], + uploadedImages: [], + goods_id: '', + text: '', + img: [], + eOrder: '', }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + that = this + // this.evaluateOrder() + }, + + submitComment() { + + let that = this; + let url = 'user/index/message'; + let params = { + goods_id : that.data.goods_id, + text : that.data.text, + img : that.data.img.join(",") + } + let header = { + "XX-Token": wx.getStorageSync('token'), + "XX-Device-Type": 'wxapp' + } + app.post(url, params, header).then((res) => { + console.log(res); + // 获取值 + that.setData({ + eOrder: res.data + }) + + + + + + }).catch((err) => { + + }) + }, + + + //----- 上传图片 ----- + //选择图片 + chooseImage: function () { + // 选择图片 + wx.chooseImage({ + count: 3, // 默认9 + sizeType: ['compressed'], + sourceType: ['album', 'camera'], + // 可以指定来源是相册还是相机,默认二者都有 + success: function (res) { + // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 + var tempFilePaths = res.tempFilePaths; + that.setData({ + images: that.data.images.concat(tempFilePaths) + }); + } + }) + }, + // 图片预览 + previewImage: function (e) { + console.log(this.data.images); + var current = e.target.dataset.src + wx.previewImage({ + current: current, + urls: this.data.images + }) + }, + submit: function () { + // // 提交图片,事先遍历图集数组 + // that.data.images.forEach(function (tempFilePath) { + // new AV.File('file-name', { + // blob: { + // uri: tempFilePath, + // }, + // }).save().then( + // // file => console.log(file.url()) + // function (file) { + // // 先读取 + // var uploadedImages = that.data.uploadedImages; + // uploadedImages.push(file.url()); + // // 再写入 + // that.setData({ + // uploadedImages: uploadedImages + // }); console.log(uploadedImages); + // } + // ).catch(console.error); + // }); + // wx.showToast({ + // title: '评价成功', success: function () { + // wx.navigateBack(); + // } + // }); + }, + delete: function (e) { + var index = e.currentTarget.dataset.index; + var images = that.data.images; + images.splice(index, 1); + that.setData({ + images: images + }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { - + }, /** * 生命周期函数--监听页面显示 */ onShow: function () { - + }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { - + }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { - + }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - + }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { - + } }) \ No newline at end of file diff --git a/pages/mine/eOrder/eOrder.wxml b/pages/mine/eOrder/eOrder.wxml index c36b5b8..f642ea6 100644 --- a/pages/mine/eOrder/eOrder.wxml +++ b/pages/mine/eOrder/eOrder.wxml @@ -11,16 +11,25 @@ </view> <!-- 图片 --> <view class='top_item'> - <view class='top_item_pic'> + <!-- <view class='top_item_pic' bindtap='chooseImage'> <image src='../../../img/tianjiatupian@2x.png'></image> - </view> + </view> --> + <view class="top_item_pic" wx:for="{{images}}" wx:key=""> + <image src="{{item}}" data-src="{{item}}" bindtap="previewImage" mode="aspectFill" /> + + <!-- 删除按钮 --> + <view class="delete" bindtap="delete" data-index="{{index}}">X</view> + </view> + <view class="top_item_pic" bindtap="chooseImage"> + <image src='../../../img/tianjiatupian@3x.png'></image> + </view> </view> </view> <view class='bottom'> - <view class='bottom_btn'> + <view class='bottom_btn' bindtap='submitComment'> 发表评价 </view> </view> diff --git a/pages/mine/eOrder/eOrder.wxss b/pages/mine/eOrder/eOrder.wxss index 7599c36..50c169c 100644 --- a/pages/mine/eOrder/eOrder.wxss +++ b/pages/mine/eOrder/eOrder.wxss @@ -40,6 +40,7 @@ page{ display: flex; margin-top: 30rpx; margin-right: 40rpx; + position: relative; } .top_item_pic image{ width: 100%; @@ -72,4 +73,10 @@ page{ font-family:PingFang SC; font-weight:600; color:rgba(255,255,255,1); +} +.delete{ + position: absolute; + right: 10rpx; + top: -3rpx; + font-size: 30rpx; } \ No newline at end of file diff --git a/pages/mine/myOrder/myOrder.js b/pages/mine/myOrder/myOrder.js index 08a1540..08d8974 100644 --- a/pages/mine/myOrder/myOrder.js +++ b/pages/mine/myOrder/myOrder.js @@ -4,6 +4,8 @@ Page({ * 页面的初始数据 */ data: { + + orderList:[], navbar: [{ name: '全部' }, @@ -30,15 +32,27 @@ Page({ } ], currentTab: 0, - orderList: '', + // orderList: '', page: 1, status: 0, - toCancel: false + toCancel: false, + delect_order: false, + + + //倒计时 + // countDownList: [], + // actEndTimeList: [] }, + + /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { + + + + this.myOrder() console.log(options) if (options.id == 1) { @@ -63,6 +77,12 @@ Page({ }) } }, + timeFormat(param) { //小于10的格式化函数 + return param < 10 ? '0' + param : param; + }, + + + // 我的订单 myOrder() { let that = this; @@ -78,20 +98,61 @@ Page({ } app.post(url, params, header).then((res) => { console.log(res); + // 列表值 that.setData({ - orderList: res.data.list + orderList: res.data.list, + now_time: res.data.now_time }) - - - - - + that.countDown() }).catch((err) => { }) }, + //团购倒计时 + countDown() { + let that = this + let objs = Object.assign([], that.data.orderList) + let now_time = parseInt(new Date().getTime()) + // console.log('现在的时间:'+now_time) + + for (let obj of objs) { + + let end_time = obj.end_time * 1000 + // console.log(end_time) + let open_time = obj.open_time * 1000 + if (now_time < open_time) { + // console.log(333) + //活动未开始 + } else if (now_time > end_time) { + // console.log(222) + //活动结束 + } else { + // console.log(1111) + let time = (end_time - now_time) / 1000; + let day = parseInt(time / (60 * 60 * 24)); + let hou = parseInt(time % (60 * 60 * 24) / 3600); + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + + obj.day = that.timeFormat(day), + obj.hou = that.timeFormat(hou), + obj.min = that.timeFormat(min), + obj.sec = that.timeFormat(sec) + + // console.log(obj.day, obj.hou, obj.min, obj.sec) + } + } + that.setData({ + orderList: objs + }) + console.log(that.data.orderList) + setTimeout(that.countDown, 1000); + }, + + + navbarTap: function (e) { @@ -186,63 +247,36 @@ Page({ } }, //评价按钮 - btn_eOrder() { + btn_eOrder(e) { + console.log(e); + let id=e.currentTab.dataset.id wx.navigateTo({ - url: '/pages/mine/eOrder/eOrder', + url: '/pages/mine/eOrder/eOrder?id='+id, }) }, - // 倒计时功能 - timeFunc(num) { - //let number = res.compare.surplus_time; - // 时间戳处理 - var totalSecond = num; - var interval = setInterval(function () { - // 秒数 - var second = totalSecond; - // 天数位 - var day = Math.floor(second / 3600 / 24); - var dayStr = day.toString(); - if (dayStr.length == 1) dayStr = '0' + dayStr; - // 小时位 - var hr = Math.floor((second - day * 3600 * 24) / 3600); - var hrStr = hr.toString(); - if (hrStr.length == 1) hrStr = '0' + hrStr; - // 分钟位 - var min = Math.floor((second - day * 3600 * 24 - hr * 3600) / 60); - var minStr = min.toString(); - if (minStr.length == 1) minStr = '0' + minStr; - // 秒位 - var sec = second - day * 3600 * 24 - hr * 3600 - min * 60; - var secStr = sec.toString(); - if (secStr.length == 1) secStr = '0' + secStr; - - that.setData({ - days: dayStr, - hours: hrStr, - minutes: minStr, - seconds: secStr, - }); - totalSecond--; - if (totalSecond <= 0) { - clearInterval(interval); - wx.showToast({ - title: '活动已结束', - }); - // 倒计时结束 - that.countDown(); - that.setData({ - days: '00', - hours: '00', - minutes: '00', - seconds: '00', - }); - } - }.bind(this), 1000); + // 删除订单 + // delectOrder(){ + // this.setData({ + // delect_order:true + // }) + // }, + // toDelect(){ + // this.setData({ + // delect_order:false + // }) + // }, + toDelect(){ + this.setData({ + delect_order:true + }) + }, + toDelect_close(){ + this.setData({ + delect_order:false + }) }, - - // 取消订单 cancelOrder() { diff --git a/pages/mine/myOrder/myOrder.wxml b/pages/mine/myOrder/myOrder.wxml index d43ceb6..7af81d6 100644 --- a/pages/mine/myOrder/myOrder.wxml +++ b/pages/mine/myOrder/myOrder.wxml @@ -10,7 +10,9 @@ <!-- 中部 --> <view class='mid'> + <view class="nodata" wx:if='{{orderList.length==0}}'>暂无数据</view> <!-- 全部 --> + <block wx:else> <view class='mid_item' wx:if='{{currentTab == 0}}' wx:for='{{orderList}}' wx:key=''> <!-- 上 --> <view class='mid_item_top'> @@ -36,11 +38,13 @@ <!-- 图片 --> <view class='mid_left_pic'> <!-- <image src='../../../img/goods_1.png'></image>--> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> - <view class='mid_left_text'> - 距结束23时52分 + <view class='mid_left_text' > + <!-- 距结束23时52分 --> + <!-- 距结束{{item.day}}天{{item.hou}}时{{item.min}}分{{item.sec}}秒 --> + 距结束{{item.hou}}小时{{item.min}}分{{item.sec}}秒 </view> </view> <!-- 中——右边 --> @@ -55,13 +59,15 @@ </view> <!-- 百分比 --> <view class='mid_right_m'> - <view class='right_m_left'> - <view class='right_m_left_content' ></view> - </view> + <!-- <view class='right_m_left'> --> + <!-- <view class='right_m_left_content' style="width:{{item.percent}}"></view> --> - <view class='right_m_right'> - 42% - </view> + <progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> + <!-- </view> --> + + <!-- <view class='right_m_right'> + {{item.percent}}% + </view> --> </view> <!-- 拼团份数 --> <view class='mid_right_bottom'> @@ -69,7 +75,7 @@ 已拼{{item.numb}}份,目标{{item.group}}份 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -78,15 +84,29 @@ <!-- 下 --> <view class='mid_item_bottom'> <view class='mid_item_bottom_lef'> - 共2件商品,实付 - <span class='color_red'>¥52</span> + 共{{item.goods_numb}}件商品,实付 + <span class='color_red'>¥{{item.goods_pay}}</span> </view> - <view class='mid_item_bottom_rig'> + <view class='mid_item_bottom_rig' wx:if="{{item.goods_status==2}}"> <view class='bottom_btn_left' bindtap='cancelOrder'>取消订单</view> <view class='bottom_btn_right'>立即付款</view> </view> + + <view wx:if="{{item.goods_status==1}}"> + <view class='mid_item_bottom_rig' wx:if="{{item.message_id==0}}"> + <view class='bottom_btn_left' bindtap='cancelOrder'>去评价</view> + <view class='bottom_btn_right'>确认订单</view> + </view> + + <view class='mid_item_bottom_rig' wx:else> + <view class='bottom_btn_left' bindtap='cancelOrder'>删除</view> + + </view> + </view> + </view> </view> + </block> <!-- 待付款 --> <view class='mid_item' wx:if='{{currentTab == 1}}' wx:for='{{orderList}}' wx:key=''> <!-- 上 --> @@ -113,11 +133,11 @@ <!-- 图片 --> <view class='mid_left_pic'> <!-- <image src='../../../img/goods_1.png'></image>--> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> <view class='mid_left_text'> - 距结束23时52分 + 距结束{{item.hou}}小时{{item.min}}分{{item.sec}}秒 </view> </view> <!-- 中——右边 --> @@ -126,19 +146,20 @@ <view class='right_top_lef'>{{item.shop_name}}</view> <view class='right_top_rig'> <span class='price_small'>¥</span> - <span class='font_big'>50</span> - <span class='font_small'>.00</span> + <span class='font_big'>{{item.money_sale}}</span> + <!-- <span class='font_small'>.00</span> --> </view> </view> <!-- 百分比 --> <view class='mid_right_m'> - <view class='right_m_left'> + <!-- <view class='right_m_left'> <view class='right_m_left_content'></view> </view> <view class='right_m_right'> 42% - </view> + </view> --> + <progress percent="{{item.percent}}" show-info color="#B5DE96" border-radius="8" font-size="24rpx" stroke-width="16rpx" /> </view> <!-- 拼团份数 --> <view class='mid_right_bottom'> @@ -146,7 +167,7 @@ 已拼{{item.numb}}份,目标{{item.group}}份 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -159,7 +180,7 @@ <span class='color_red'>¥52</span> </view> <view class='mid_item_bottom_rig'> - <view class='bottom_btn_left' bindtap='cancelOrder'>取消订单</view> + <view class='bottom_btn_left' bindtap='cancelOrder' >取消订单</view> <view class='bottom_btn_right'>立即付款</view> </view> </view> @@ -189,11 +210,11 @@ <view class='mid_item_mid_left'> <!-- 图片 --> <view class='mid_left_pic'> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> <view class='mid_left_text'> - 距结束23时52分 + 距结束{{item.hou}}小时{{item.min}}分{{item.sec}}秒 </view> </view> <!-- 中——右边 --> @@ -222,7 +243,7 @@ 已拼300份,目标500份 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -231,7 +252,7 @@ </view> <!-- 待发货 --> - <view class='mid_item' wx:if='{{currentTab == 3}}'> + <view class='mid_item' wx:if='{{currentTab == 3}}' wx:for='{{orderList}}' wx:key=''> <!-- 上 --> <view class='mid_item_top'> <!-- 订单号 --> @@ -242,12 +263,12 @@ </view> <!-- 订单号 --> <view class='top_left_text'> - 订单号:1003828041 + 订单号:{{item.goods}} </view> </view> <!-- 待发货 --> <view class='mid_item_top_right'> - 待发货 + {{item.goods_status}} </view> </view> <!-- 中 --> @@ -255,7 +276,7 @@ <view class='mid_item_mid_left'> <!-- 图片 --> <view class='mid_left_pic'> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> <view class='mid_left_text text_b'> @@ -265,11 +286,11 @@ <!-- 中——右边 --> <view class='mid_item_mid_right'> <view class='mid_right_top'> - <view class='right_top_lef'>纯进口有机菜花</view> + <view class='right_top_lef'>{{item.shop_name}}</view> <view class='right_top_rig'> <span class='price_small'>¥</span> - <span class='font_big'>52</span> - <span class='font_small'>.00</span> + <span class='font_big'>{{item.money_pay}}</span> + <!-- <span class='font_small'>.00</span> --> </view> </view> @@ -279,7 +300,7 @@ 拼团成功 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -288,7 +309,10 @@ </view> <!-- 待完成 --> - <view class='mid_item' wx:if='{{currentTab == 4}}'> + <view class='mid_item' wx:if='{{currentTab == 4}}' wx:for='{{orderList}}' wx:key=''> + <view class="nodata" wx:if="{{orderList.length==0}}">暂无数据</view> + <block wx:else > + <view wx:for='{{orderList}}'> <!-- 上 --> <view class='mid_item_top'> <!-- 订单号 --> @@ -299,12 +323,12 @@ </view> <!-- 订单号 --> <view class='top_left_text'> - 订单号:1003828041 + 订单号:{{item.goods}} </view> </view> <!-- 待完成 --> <view class='mid_item_top_right'> - 待完成 + {{item.goods_status}} </view> </view> <!-- 中 --> @@ -312,7 +336,7 @@ <view class='mid_item_mid_left'> <!-- 图片 --> <view class='mid_left_pic'> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> <view class='mid_left_text text_b'> @@ -322,11 +346,11 @@ <!-- 中——右边 --> <view class='mid_item_mid_right'> <view class='mid_right_top'> - <view class='right_top_lef'>纯进口有机菜花</view> + <view class='right_top_lef'>{{item.shop_name}}</view> <view class='right_top_rig'> <span class='price_small'>¥</span> - <span class='font_big'>52</span> - <span class='font_small'>.00</span> + <span class='font_big'>{{item.money_pay}}</span> + <!-- <span class='font_small'>.00</span> --> </view> </view> @@ -336,7 +360,7 @@ 拼团成功 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -352,9 +376,13 @@ <view class='bottom_btn_right'>确认订单</view> </view> </view> + </view> + + </block> + </view> <!-- 待评价 --> - <view class='mid_item' wx:if='{{currentTab == 5}}'> + <view class='mid_item' wx:if='{{currentTab == 5}}' wx:for='{{orderList}}' wx:key=''> <!-- 上 --> <view class='mid_item_top' > <!-- 订单号 --> @@ -365,12 +393,12 @@ </view> <!-- 订单号 --> <view class='top_left_text'> - 订单号:1003828041 + 订单号:{{item.goods}} </view> </view> <!-- 待评价 --> <view class='mid_item_top_right'> - 待评价 + {{item.goods_status}} </view> </view> <!-- 中 --> @@ -378,7 +406,7 @@ <view class='mid_item_mid_left'> <!-- 图片 --> <view class='mid_left_pic'> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> <view class='mid_left_text text_b'> @@ -388,11 +416,11 @@ <!-- 中——右边 --> <view class='mid_item_mid_right'> <view class='mid_right_top'> - <view class='right_top_lef'>纯进口有机菜花</view> + <view class='right_top_lef'>{{item.shop_name}}</view> <view class='right_top_rig'> <span class='price_small'>¥</span> - <span class='font_big'>52</span> - <span class='font_small'>.00</span> + <span class='font_big'>{{item.money_pay}}</span> + <!-- <span class='font_small'>.00</span> --> </view> </view> @@ -402,7 +430,7 @@ 拼团成功 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -414,13 +442,13 @@ </view> <view class='mid_item_bottom_rig'> - <view class='bottom_btn_left' bindtap='btn_eOrder'>去评价</view> + <view class='bottom_btn_left' bindtap='btn_eOrder' data-id="{{item.goods_id}}">去评价</view> <view class='bottom_btn_right'>确认订单</view> </view> </view> </view> <!-- 已完成 --> - <view class='mid_item' wx:if='{{currentTab == 6}}'> + <view class='mid_item' wx:if='{{currentTab == 6}}' wx:for='{{orderList}}' wx:key=''> <!-- 上 --> <view class='mid_item_top'> <!-- 订单号 --> @@ -431,12 +459,12 @@ </view> <!-- 订单号 --> <view class='top_left_text'> - 订单号:1003828041 + 订单号:{{item.goods}} </view> </view> <!-- 已完成 --> <view class='mid_item_top_right color_text'> - 已完成 + {{item.goods_status}} </view> </view> <!-- 中 --> @@ -444,7 +472,7 @@ <view class='mid_item_mid_left'> <!-- 图片 --> <view class='mid_left_pic'> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> <view class='mid_left_text text_b'> @@ -454,11 +482,11 @@ <!-- 中——右边 --> <view class='mid_item_mid_right'> <view class='mid_right_top'> - <view class='right_top_lef'>纯进口有机菜花</view> + <view class='right_top_lef'>{{item.shop_name}}</view> <view class='right_top_rig'> <span class='price_small'>¥</span> - <span class='font_big'>52</span> - <span class='font_small'>.00</span> + <span class='font_big'>{{item.money_pay}}</span> + <!-- <span class='font_small'>.00</span> --> </view> </view> @@ -468,7 +496,7 @@ 拼团成功 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -486,7 +514,7 @@ </view> </view> <!-- 已取消 --> - <view class='mid_item' wx:if='{{currentTab == 7}}'> + <view class='mid_item' wx:if='{{currentTab == 7}}' wx:for='{{orderList}}' wx:key=''> <!-- 上 --> <view class='mid_item_top'> <!-- 订单号 --> @@ -497,12 +525,12 @@ </view> <!-- 订单号 --> <view class='top_left_text'> - 订单号:1003828041 + 订单号:{{item.goods}} </view> </view> <!-- 已取消 --> <view class='mid_item_top_right color_red'> - 已取消 + {{item.goods_status}} </view> </view> <!-- 中 --> @@ -510,7 +538,7 @@ <view class='mid_item_mid_left'> <!-- 图片 --> <view class='mid_left_pic'> - <image src='../../../img/goods_1.png'></image> + <image src='{{item.thumb}}'></image> </view> <!-- 文字 --> <view class='mid_left_text text_b'> @@ -520,11 +548,11 @@ <!-- 中——右边 --> <view class='mid_item_mid_right'> <view class='mid_right_top'> - <view class='right_top_lef'>纯进口有机菜花</view> + <view class='right_top_lef'>{{item.shop_name}}</view> <view class='right_top_rig'> <span class='price_small'>¥</span> - <span class='font_big'>52</span> - <span class='font_small'>.00</span> + <span class='font_big'>{{item.money_pay}}</span> + <!-- <span class='font_small'>.00</span> --> </view> </view> @@ -534,7 +562,7 @@ 拼团成功 </view> <view class='mid_right_bottom_rig'> - x4 + {{item.goods_numb}} </view> </view> @@ -547,7 +575,7 @@ </view> <view class='mid_item_bottom_rig'> <view></view> - <view class='bottom_btn_delete'>删除</view> + <view class='bottom_btn_delete' bindtap='toDelect'>删除</view> </view> </view> </view> @@ -565,4 +593,15 @@ <view class='mask_mid_bottom_right' bindtap='toClose'>取消</view> </view> </view> +</view> + +<!-- 删除订单弹层 --> +<view class='mask' wx:if='{{delect_order}}'> + <view class='mask_mid'> + <view class='mask_mid_top'>您确定要删除吗?</view> + <view class='mask_mid_bottom'> + <view class='mask_mid_bottom_left'>确定</view> + <view class='mask_mid_bottom_right' bindtap='toDelect_close'>取消</view> + </view> + </view> </view> \ No newline at end of file diff --git a/pages/mine/myOrder/myOrder.wxss b/pages/mine/myOrder/myOrder.wxss index 0e0eecd..8ccd680 100644 --- a/pages/mine/myOrder/myOrder.wxss +++ b/pages/mine/myOrder/myOrder.wxss @@ -307,6 +307,12 @@ page{ opacity:1; } +progress { +width:370rpx; +color:#b5de96; +margin-top:24rpx; + +} .mask{ position: fixed; @@ -354,3 +360,7 @@ page{ text-align: center; background: #EBEBEB; } +.nodata{ + margin-top: 20rpx; + font-size: 30rpx; +} diff --git a/project.config.json b/project.config.json index 5af6d1d..159d8bc 100644 --- a/project.config.json +++ b/project.config.json @@ -13,8 +13,8 @@ }, "compileType": "miniprogram", "libVersion": "2.6.1", - "appid": "wx1f51f42105b63343", - "projectname": "shop-suh", + "appid": "wxd577c8d542ca150e", + "projectname": "shop", "debugOptions": { "hidedInDevtools": [] }, @@ -37,7 +37,7 @@ "list": [] }, "miniprogram": { - "current": 7, + "current": 8, "list": [ { "id": -1, @@ -92,7 +92,13 @@ "id": -1, "name": "搜索结果", "pathName": "pages/homeindex/result/result", + "query": "", "scene": null + }, + { + "id": -1, + "name": "首页", + "pathName": "pages/homeindex/homeindex" } ] }