@@ -43,6 +43,7 @@ App({ | |||
}) | |||
}else{ | |||
this.globalData.openId = openid; | |||
this.getUserType(); | |||
} | |||
// 获取用户信息 | |||
// wx.getSetting({ | |||
@@ -85,7 +86,7 @@ App({ | |||
url: '/pages/register/register' | |||
}) | |||
} else if (e.code == 202){//已注册 | |||
this.globalData.userInfo = e.data.user_phone | |||
this.globalData.userInfo = e.data; | |||
if (this.globalData.present_id){ | |||
wx.reLaunch({ | |||
url: '/pages/receiveTicket/receiveTicket?shareId=' + this.globalData.present_id + "&number=" + this.globalData.number |
@@ -119,6 +119,11 @@ Page({ | |||
this.orderPay() | |||
}, | |||
}) | |||
} else if (e.code == -3003){ | |||
wx.showToast({ | |||
title: e.message, | |||
duration:500 | |||
}) | |||
} | |||
}, this,"POST") | |||
}, | |||
@@ -133,21 +138,25 @@ Page({ | |||
}, this,"POST") | |||
}, | |||
getInputVal:function(e){ | |||
if (e.detail.value < 1) { | |||
wx.showToast({ | |||
title: "购买量最小为1", | |||
duration: 1000 | |||
}) | |||
this.setData({ | |||
buyNumber: 1, | |||
ticketNum: 1 | |||
}) | |||
} else { | |||
this.setData({ | |||
buyNumber: e.detail.value, | |||
num: e.detail.value | |||
}) | |||
} | |||
// if (e.detail.value < 1) { | |||
// wx.showToast({ | |||
// title: "购买量最小为1", | |||
// duration: 1000 | |||
// }) | |||
// this.setData({ | |||
// buyNumber: 1, | |||
// ticketNum: 1 | |||
// }) | |||
// } else { | |||
// this.setData({ | |||
// buyNumber: e.detail.value, | |||
// num: e.detail.value | |||
// }) | |||
// } | |||
this.setData({ | |||
buyNumber: e.detail.value, | |||
num: e.detail.value | |||
}) | |||
console.log(this.data.buyNumber) | |||
}, | |||
}) |
@@ -28,21 +28,21 @@ | |||
<image src="../images/circle.png"></image> | |||
<text>使用期限</text> | |||
</view> | |||
<view class="specify">购卖后30日内有效</view> | |||
<view class="specify">{{ticketUser.duration}}</view> | |||
</view> | |||
<view> | |||
<view class="timeLimit"> | |||
<image src="../images/circle.png"></image> | |||
<text>使用条件</text> | |||
</view> | |||
<view class="specify">点单金额需商于优惠金额,每单限使用一张不可叠加使用,不与其他优惠同享</view> | |||
<view class="specify">{{ticketUser.coupon_condition_desc}}</view> | |||
</view> | |||
<view> | |||
<view class="timeLimit"> | |||
<image src="../images/circle.png"></image> | |||
<text>适用门店</text> | |||
</view> | |||
<view class="specify">老门框所有门店</view> | |||
<view class="specify">{{ticketUser.coupon_allow_shop}}</view> | |||
</view> | |||
</view> | |||
@@ -120,21 +120,25 @@ Page({ | |||
getInputVal: function (e) { | |||
if (e.detail.value <= this.data.surplusNum){ | |||
console.log(this.data.buyNumber) | |||
if (e.detail.value < 1) { | |||
wx.showToast({ | |||
title: "赠送量最小为1", | |||
duration: 1000 | |||
}) | |||
this.setData({ | |||
buyNumber: 1, | |||
ticketNum: 1 | |||
}) | |||
}else{ | |||
this.setData({ | |||
buyNumber: e.detail.value, | |||
ticketNum: e.detail.value | |||
}) | |||
} | |||
// if (e.detail.value < 1) { | |||
// wx.showToast({ | |||
// title: "赠送量最小为1", | |||
// duration: 1000 | |||
// }) | |||
// this.setData({ | |||
// buyNumber: 1, | |||
// ticketNum: 1 | |||
// }) | |||
// }else{ | |||
// this.setData({ | |||
// buyNumber: e.detail.value, | |||
// ticketNum: e.detail.value | |||
// }) | |||
// } | |||
this.setData({ | |||
buyNumber: e.detail.value, | |||
ticketNum: e.detail.value | |||
}) | |||
} else{ | |||
wx.showToast({ | |||
title: "您赠送数量太大", |
@@ -36,21 +36,21 @@ | |||
<image src="../images/circle.png"></image> | |||
<text>使用期限</text> | |||
</view> | |||
<view class="specify">购卖后30日内有效</view> | |||
<view class="specify">{{ticketUser.duration}}</view> | |||
</view> | |||
<view> | |||
<view class="timeLimit"> | |||
<image src="../images/circle.png"></image> | |||
<text>使用条件</text> | |||
</view> | |||
<view class="specify">点单金额需商于优惠金额,每单限使用一张不可叠加使用,不与其他优惠同享</view> | |||
<view class="specify">{{ticketUser.coupon_condition_desc}}</view> | |||
</view> | |||
<view> | |||
<view class="timeLimit"> | |||
<image src="../images/circle.png"></image> | |||
<text>适用门店</text> | |||
</view> | |||
<view class="specify">老门框所有门店</view> | |||
<view class="specify">{{ticketUser.coupon_allow_shop}}</view> | |||
</view> | |||
</view> | |||
@@ -20,7 +20,7 @@ Page({ | |||
// console.log(e) | |||
if (e.code == 200) { | |||
this.setData({ | |||
dataList:e.data | |||
dataList:e.data[0] | |||
}) | |||
} | |||
}, this) |
@@ -1,34 +1,25 @@ | |||
<!--index.wxml--> | |||
<view class="container"> | |||
<!-- <view class="userinfo"> | |||
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button> | |||
<block wx:else> | |||
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> | |||
<text class="userinfo-nickname">{{userInfo.nickName}}</text> | |||
</block> | |||
</view> | |||
<view class="usermotto"> | |||
<text class="user-motto">{{motto}}</text> | |||
</view> --> | |||
<image class="buyBg" src="../images/buyBg.jpg"></image> | |||
<swiper duration="500" next-margin="70rpx"> | |||
<!-- <swiper duration="500" next-margin="70rpx"> --> | |||
<!-- <swiper duration="500"> | |||
<block wx:for="{{dataList}}" wx:key="*this"> | |||
<swiper-item data-index="{{item.coupon_sell_id}}" bindtap="skipPage"> | |||
<view class="botCont"> | |||
<swiper-item data-index="{{item.coupon_sell_id}}" bindtap="skipPage"> --> | |||
<view class="botCont" data-index="{{dataList.coupon_sell_id}}" bindtap="skipPage"> | |||
<view class="imgView"> | |||
<image src="{{item.coupon_img_small}}"></image> | |||
<image src="{{dataList.coupon_img_small}}"></image> | |||
</view> | |||
<view class="textView"> | |||
<text class="nameText">{{item.coupon_name}}</text> | |||
<text class="timeText">{{item.coupon_memo}}</text> | |||
<text class="timeText">(有效期:{{item.end_date}})</text> | |||
<text class="nameText">{{dataList.coupon_name}}</text> | |||
<text class="timeText">{{dataList.coupon_condition_desc}}</text> | |||
<text class="timeText">(有效期:{{dataList.end_date}})</text> | |||
</view> | |||
<view class="buyView">立即购买</view> | |||
</view> | |||
</swiper-item> | |||
<!-- </swiper-item> | |||
</block> | |||
</swiper> | |||
</swiper> --> | |||
</view> |
@@ -13,15 +13,16 @@ page{ | |||
top:0; | |||
left: 0; | |||
} | |||
swiper{ | |||
/* swiper{ | |||
width: 100%; | |||
height: 437rpx; | |||
position: absolute; | |||
left: 0; | |||
bottom: 0; | |||
} | |||
} */ | |||
.botCont{ | |||
width: 607rpx; | |||
/* width: 607rpx; */ | |||
width: 678rpx; | |||
border-radius:30rpx; | |||
background-color:#ffffff; | |||
display: flex; | |||
@@ -29,6 +30,11 @@ swiper{ | |||
flex-wrap: wrap; | |||
padding-top: 62rpx; | |||
padding-left: 75rpx; | |||
padding-bottom: 53rpx; | |||
position: absolute; | |||
left: 0; | |||
bottom: 0; | |||
} | |||
.imgView{ | |||
width: 254rpx; |
@@ -11,17 +11,16 @@ Page({ | |||
historyTicketArrows: false, | |||
getUser:false, | |||
getUserArr: [],//用户信息 | |||
userChuan:[], | |||
userPhone:"",//用户手机号 | |||
mydeg: -90, | |||
historydeg: -90, | |||
pageNum:1, | |||
pageCount:5, | |||
historyArr: [],//优惠券使用记录列表 | |||
myTicketArr: [ | |||
// { "coupon_img_small": "../images/smallTicket.jpg", "coupon_sell_id": 1, "coupon_name": "哈哈哈", "coupon_memo": "嘻嘻嘻","end_date":"2020/3/5"}, | |||
// { "coupon_img_small": "../images/smallTicket.jpg", "coupon_sell_id": 1, "coupon_name": "哈哈哈", "coupon_memo": "嘻嘻嘻", "end_date": "2020/3/5" }, | |||
// { "coupon_img_small": "../images/smallTicket.jpg", "coupon_sell_id": 1, "coupon_name": "哈哈哈", "coupon_memo": "嘻嘻嘻", "end_date": "2020/3/5" }, | |||
// { "coupon_img_small": "../images/smallTicket.jpg", "coupon_sell_id": 1, "coupon_name": "哈哈哈", "coupon_memo": "嘻嘻嘻", "end_date": "2020/3/5" }, | |||
// { "coupon_img_small": "../images/smallTicket.jpg", "coupon_sell_id": 1, "coupon_name": "哈哈哈", "coupon_memo": "嘻嘻嘻", "end_date": "2020/3/5" }, | |||
],//我的优惠券列表 | |||
getHistory: [],//每次接口拉取的数据 | |||
getHistoryArr: [],//全部使用数据 | |||
myTicketArr: [],//我的优惠券列表 | |||
}, | |||
/** | |||
@@ -35,6 +34,20 @@ Page({ | |||
app.globalData.openidSuccessFuc = this.myTicket; | |||
app.globalData.openidSuccessFuc = this.historyTicket; | |||
} | |||
console.log(app.globalData.userInfo) | |||
if (app.globalData.userInfo.item_state == 2) { | |||
var userArr = []; | |||
var phone=""; | |||
userArr.push(app.globalData.userInfo.headimgurl); | |||
userArr.push(app.globalData.userInfo.nickname); | |||
phone = app.globalData.userInfo.user_phone | |||
this.setData({ | |||
getUserArr: userArr, | |||
getUser: true, | |||
userPhone: phone | |||
}) | |||
} | |||
console.log(this.data.getUserArr) | |||
}, | |||
myTicket:function(){//获取我的优惠券列表 | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/validtype', {}, e => { | |||
@@ -47,17 +60,32 @@ Page({ | |||
}, this) | |||
}, | |||
historyTicket: function () {//获取优惠券使用列表 | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/history', {}, e => { | |||
this.data.getHistory = []; | |||
app.wxRequest(app.globalData.httpUrl + 'couponbuy/historyuse', {cur_page: this.data.pageNum, show_num: this.data.pageCount}, e => { | |||
console.log(e) | |||
if (e.code == 200) { | |||
for(var i=0;i<e.data.length;i++){ | |||
this.data.getHistoryArr.push(e.data[i]); | |||
} | |||
this.data.getHistory = e.data | |||
this.setData({ | |||
historyArr: e.data | |||
historyArr: this.data.getHistoryArr, | |||
}) | |||
} | |||
}, this) | |||
}, | |||
lower:function(){//检测上拉是否到底 | |||
console.log("到底了") | |||
if (this.data.getHistory.length!=0){ | |||
this.data.pageNum++; | |||
this.historyTicket() | |||
}else{ | |||
wx.showToast({ | |||
title: '没有更多数据了', | |||
icon: "none", | |||
duration: 1000 | |||
}) | |||
} | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
@@ -150,28 +178,28 @@ Page({ | |||
}, | |||
getUser:function(e){//点击登陆获取用户信息 | |||
console.log(e) | |||
console.log(app.globalData.getUserArr) | |||
if (app.globalData.getUserArr.length==0) { | |||
app.globalData.getUserArr = e.detail.userInfo; | |||
this.setData({ | |||
getUserArr: e.detail.userInfo | |||
}) | |||
this.setData({ | |||
userPhone: app.globalData.userInfo, | |||
getUser :true, | |||
}) | |||
this.submitUser(); | |||
} | |||
var userArr = []; | |||
var phone = ""; | |||
userArr.push(e.detail.userInfo.avatarUrl); | |||
userArr.push(e.detail.userInfo.nickName); | |||
phone = app.globalData.userInfo.user_phone | |||
this.data.userChuan = e.detail.userInfo; | |||
this.setData({ | |||
getUserArr: userArr, | |||
getUser: true, | |||
userPhone: phone | |||
}) | |||
this.submitUser(); | |||
console.log(this.data.getUserArr) | |||
}, | |||
submitUser:function(){//提交用户信息 | |||
var params={ | |||
"province": this.data.getUserArr.province, | |||
"language": this.data.getUserArr.language, | |||
"city": this.data.getUserArr.city, | |||
"gender": this.data.getUserArr.gender, | |||
"nickname": this.data.getUserArr.nickName, | |||
"headimgurl": this.data.getUserArr.avatarUrl, | |||
"province": this.data.userChuan.province, | |||
"language": this.data.userChuan.language, | |||
"city": this.data.userChuan.city, | |||
"gender": this.data.userChuan.gender, | |||
"nickname": this.data.userChuan.nickName, | |||
"headimgurl": this.data.userChuan.avatarUrl, | |||
} | |||
app.wxRequest(app.globalData.httpUrl + 'submit', params, e => { | |||
console.log(e) |
@@ -5,10 +5,10 @@ | |||
<image class="userCircle" src="../images/userCircle.png"></image> | |||
<view class="userAll"> | |||
<view class="userHeader"> | |||
<image class="userImg" src="{{getUserArr.avatarUrl}}"></image> | |||
<image class="userImg" src="{{getUserArr[0]}}"></image> | |||
</view> | |||
<button wx:if="{{!getUser}}" plain="true" size="mini" class="getUser" open-type="getUserInfo" bindgetuserinfo="getUser">登陆</button> | |||
<view class="userName">{{getUserArr.nickName}}</view> | |||
<view class="userName">{{getUserArr[1]}}</view> | |||
<view wx:if="{{getUser}}" class="userPhone">{{userPhone}}</view> | |||
</view> | |||
@@ -20,7 +20,7 @@ | |||
<image style="transform:rotate({{mydeg}}deg)" class="ticketArrows" src="../images/ticketArrows.png"></image> | |||
</view> | |||
<scroll-view class="scrollY1" scroll-y="true" wx:if="{{myTicketArrows}}" bindscrolltolower="lower"> | |||
<scroll-view class="scrollY1" scroll-y="true" wx:if="{{myTicketArrows}}"> | |||
<view class="contAll" wx:for="{{myTicketArr}}"> | |||
<view class="ticketCont" bindtap="lookTicket" data-id = "{{item.coupon_sell_id}}"> | |||
<view class="ticketImg"> | |||
@@ -28,7 +28,7 @@ | |||
</view> | |||
<view class="rigWord"> | |||
<view class="name">{{item.coupon_name}}</view> | |||
<view class="time">{{item.coupon_memo}}</view> | |||
<view class="time">{{item.coupon_condition_desc}}</view> | |||
<view class="time">(有效期:{{item.end_date}})</view> | |||
</view> | |||
</view> | |||
@@ -47,11 +47,11 @@ | |||
<image class="ticketArrows" src="../images/ticketArrows.png" style="transform:rotate({{historydeg}}deg)"></image> | |||
</view> | |||
<scroll-view class="scrollY2" scroll-y="true" wx:if="{{historyTicketArrows}}"> | |||
<scroll-view class="scrollY2" scroll-y="true" wx:if="{{historyTicketArrows}}" bindscrolltolower="lower"> | |||
<view class="history" wx:for="{{historyArr}}"> | |||
<view class="historyLeft"> | |||
<image class="historyTicketBg" src="../images/historyTicketBg.png"></image> | |||
<view class="ticketCode">券码:{{item.coupon_sell_id}}</view> | |||
<!-- <image class="historyTicketBg" src="../images/historyTicketBg.png"></image> --> | |||
<view class="ticketCode">{{item.coupon_code}}</view> | |||
</view> | |||
<view class="tickName">{{item.coupon_type}}</view> | |||
<view class="tickType">已使用</view> |
@@ -127,7 +127,7 @@ | |||
margin-top: 33rpx; | |||
} | |||
.scrollY2{ | |||
height: 200rpx; | |||
height: 300rpx; | |||
margin-top: 20rpx; | |||
} | |||
.historyIcon{ | |||
@@ -142,29 +142,33 @@ | |||
} | |||
.historyLeft{ | |||
position: relative; | |||
width: 179rpx; | |||
/* width: 179rpx; */ | |||
width: 300rpx; | |||
height: 36rpx; | |||
} | |||
.ticketCode{ | |||
width: 179rpx; | |||
/* width: 179rpx; */ | |||
width: 100%; | |||
text-align: center; | |||
font-size:20rpx; | |||
font-family:DIN; | |||
font-weight:500; | |||
color:rgba(255,255,255,1); | |||
/* color:rgba(255,255,255,1); */ | |||
position: absolute; | |||
top: 50%; | |||
transform: translateY(-50%); | |||
} | |||
.historyTicketBg{ | |||
width: 179rpx; | |||
/* width: 179rpx; */ | |||
width: 300rpx; | |||
height: 36rpx; | |||
display: none; | |||
} | |||
.tickName{ | |||
font-size:24rpx; | |||
color:rgba(102,102,102,1); | |||
margin-left: 95rpx; | |||
margin-left: 75rpx; | |||
} | |||
.tickType{ | |||
font-size:24rpx; | |||
@@ -178,4 +182,7 @@ | |||
height: 2rpx; | |||
background-color: #CCCCCC; | |||
margin: 0 auto 40rpx auto; | |||
} | |||
.contAll{ | |||
box-shadow: 50rpx 10rpx 20rpx #d4d2d2; | |||
} |
@@ -42,27 +42,32 @@ Page({ | |||
} else if (e.code == 202){ | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord:"此券已被领取" | |||
}) | |||
} else if (e.code == 203){ | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: "此券已失效" | |||
}) | |||
} else if (e.code == -201) { | |||
this.setData({ | |||
yesGet: false, | |||
ticketUser: e.data, | |||
titleWord: "没有相关赠送记录" | |||
}) | |||
} else if (e.code == 204) { | |||
this.setData({ | |||
yesGet: false, | |||
titleWord: "赠送优惠券不足,无法领取" | |||
ticketUser: e.data, | |||
titleWord: "赠送优惠券不足" | |||
}) | |||
} else if (e.code == 205) { | |||
this.setData({ | |||
yesGet: false, | |||
titleWord: "优惠券超限,无法领取" | |||
ticketUser: e.data, | |||
titleWord: "优惠券超限" | |||
}) | |||
} | |||
}, this) |
@@ -109,7 +109,13 @@ Page({ | |||
searchShop: function (search){//搜索 | |||
if (search) { | |||
console.log(111) | |||
if (this.data.provinceCityArr[0][0] == "") { | |||
this.data.provinceCityArr[0][0] = "全部" | |||
} | |||
if (this.data.provinceCityArr[1][0] == "") { | |||
this.data.provinceCityArr[1][0] = "全部"; | |||
} | |||
var province = ""; | |||
var city = ""; | |||
var activeArr = [this.data.provinceArr, this.data.cityArr[0]]; |
@@ -11,7 +11,7 @@ | |||
</view> | |||
<view class="searchView"> | |||
<image class="searchIcon" src="../images/searchIcon.png"></image> | |||
<input class="int" bindinput="getInputVal" value="{{inputVal}}" placeholder="输入搜索内容" placeholder-class="placeholderInt"></input> | |||
<input type='text' class="int" bindinput="getInputVal" value="{{inputVal}}" placeholder="输入搜索内容" placeholder-class="placeholderInt"></input> | |||
<image wx:if="{{inputVal}}" class="delete" bindtap="deleteVal" src="../images/delete.png"></image> | |||
</view> | |||
<view class="searchBtn" bindtap="searchFn">搜索</view> | |||
@@ -32,7 +32,7 @@ | |||
</view> | |||
<view class="phone"> | |||
<image class="phoneIcon" src="../images/phoneIcon.png"></image> | |||
<view class="iconRig">{{item.shop_phone}}</view> | |||
<view class="iconRig" data-index="{{index}}" bindtap="callPhone">{{item.shop_phone}}</view> | |||
</view> | |||
<view class="line"></view> | |||
</view> |