Browse Source

修改

master
ljc 5 years ago
parent
commit
80844d35d0
14 changed files with 162 additions and 105 deletions
  1. +2
    -1
      laomenkuang_project/app.js
  2. +24
    -15
      laomenkuang_project/pages/buyTicket/buyTicket.js
  3. +3
    -3
      laomenkuang_project/pages/buyTicket/buyTicket.wxml
  4. +19
    -15
      laomenkuang_project/pages/givePage/givePage.js
  5. +3
    -3
      laomenkuang_project/pages/givePage/givePage.wxml
  6. +1
    -1
      laomenkuang_project/pages/index/index.js
  7. +10
    -19
      laomenkuang_project/pages/index/index.wxml
  8. +9
    -3
      laomenkuang_project/pages/index/index.wxss
  9. +55
    -27
      laomenkuang_project/pages/personalCenter/personalCenter.js
  10. +7
    -7
      laomenkuang_project/pages/personalCenter/personalCenter.wxml
  11. +13
    -6
      laomenkuang_project/pages/personalCenter/personalCenter.wxss
  12. +7
    -2
      laomenkuang_project/pages/receiveTicket/receiveTicket.js
  13. +7
    -1
      laomenkuang_project/pages/shop/shop.js
  14. +2
    -2
      laomenkuang_project/pages/shop/shop.wxml

+ 2
- 1
laomenkuang_project/app.js View File

}) })
}else{ }else{
this.globalData.openId = openid; this.globalData.openId = openid;
this.getUserType();
} }
// 获取用户信息 // 获取用户信息
// wx.getSetting({ // wx.getSetting({
url: '/pages/register/register' url: '/pages/register/register'
}) })
} else if (e.code == 202){//已注册 } else if (e.code == 202){//已注册
this.globalData.userInfo = e.data.user_phone
this.globalData.userInfo = e.data;
if (this.globalData.present_id){ if (this.globalData.present_id){
wx.reLaunch({ wx.reLaunch({
url: '/pages/receiveTicket/receiveTicket?shareId=' + this.globalData.present_id + "&number=" + this.globalData.number url: '/pages/receiveTicket/receiveTicket?shareId=' + this.globalData.present_id + "&number=" + this.globalData.number

+ 24
- 15
laomenkuang_project/pages/buyTicket/buyTicket.js View File

this.orderPay() this.orderPay()
}, },
}) })
} else if (e.code == -3003){
wx.showToast({
title: e.message,
duration:500
})
} }
}, this,"POST") }, this,"POST")
}, },
}, this,"POST") }, this,"POST")
}, },
getInputVal:function(e){ 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) console.log(this.data.buyNumber)
}, },
}) })

+ 3
- 3
laomenkuang_project/pages/buyTicket/buyTicket.wxml View File

<image src="../images/circle.png"></image> <image src="../images/circle.png"></image>
<text>使用期限</text> <text>使用期限</text>
</view> </view>
<view class="specify">购卖后30日内有效</view>
<view class="specify">{{ticketUser.duration}}</view>
</view> </view>
<view> <view>
<view class="timeLimit"> <view class="timeLimit">
<image src="../images/circle.png"></image> <image src="../images/circle.png"></image>
<text>使用条件</text> <text>使用条件</text>
</view> </view>
<view class="specify">点单金额需商于优惠金额,每单限使用一张不可叠加使用,不与其他优惠同享</view>
<view class="specify">{{ticketUser.coupon_condition_desc}}</view>
</view> </view>
<view> <view>
<view class="timeLimit"> <view class="timeLimit">
<image src="../images/circle.png"></image> <image src="../images/circle.png"></image>
<text>适用门店</text> <text>适用门店</text>
</view> </view>
<view class="specify">老门框所有门店</view>
<view class="specify">{{ticketUser.coupon_allow_shop}}</view>
</view> </view>
</view> </view>



+ 19
- 15
laomenkuang_project/pages/givePage/givePage.js View File

getInputVal: function (e) { getInputVal: function (e) {
if (e.detail.value <= this.data.surplusNum){ if (e.detail.value <= this.data.surplusNum){
console.log(this.data.buyNumber) 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{ } else{
wx.showToast({ wx.showToast({
title: "您赠送数量太大", title: "您赠送数量太大",

+ 3
- 3
laomenkuang_project/pages/givePage/givePage.wxml View File

<image src="../images/circle.png"></image> <image src="../images/circle.png"></image>
<text>使用期限</text> <text>使用期限</text>
</view> </view>
<view class="specify">购卖后30日内有效</view>
<view class="specify">{{ticketUser.duration}}</view>
</view> </view>
<view> <view>
<view class="timeLimit"> <view class="timeLimit">
<image src="../images/circle.png"></image> <image src="../images/circle.png"></image>
<text>使用条件</text> <text>使用条件</text>
</view> </view>
<view class="specify">点单金额需商于优惠金额,每单限使用一张不可叠加使用,不与其他优惠同享</view>
<view class="specify">{{ticketUser.coupon_condition_desc}}</view>
</view> </view>
<view> <view>
<view class="timeLimit"> <view class="timeLimit">
<image src="../images/circle.png"></image> <image src="../images/circle.png"></image>
<text>适用门店</text> <text>适用门店</text>
</view> </view>
<view class="specify">老门框所有门店</view>
<view class="specify">{{ticketUser.coupon_allow_shop}}</view>
</view> </view>
</view> </view>



+ 1
- 1
laomenkuang_project/pages/index/index.js View File

// console.log(e) // console.log(e)
if (e.code == 200) { if (e.code == 200) {
this.setData({ this.setData({
dataList:e.data
dataList:e.data[0]
}) })
} }
}, this) }, this)

+ 10
- 19
laomenkuang_project/pages/index/index.wxml View File

<!--index.wxml--> <!--index.wxml-->
<view class="container"> <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> <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"> <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"> <view class="imgView">
<image src="{{item.coupon_img_small}}"></image>
<image src="{{dataList.coupon_img_small}}"></image>
</view> </view>
<view class="textView"> <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>
<view class="buyView">立即购买</view> <view class="buyView">立即购买</view>
</view> </view>
</swiper-item>
<!-- </swiper-item>
</block> </block>
</swiper>
</swiper> -->
</view> </view>

+ 9
- 3
laomenkuang_project/pages/index/index.wxss View File

top:0; top:0;
left: 0; left: 0;
} }
swiper{
/* swiper{
width: 100%; width: 100%;
height: 437rpx; height: 437rpx;
position: absolute; position: absolute;
left: 0; left: 0;
bottom: 0; bottom: 0;
}
} */
.botCont{ .botCont{
width: 607rpx;
/* width: 607rpx; */
width: 678rpx;
border-radius:30rpx; border-radius:30rpx;
background-color:#ffffff; background-color:#ffffff;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
padding-top: 62rpx; padding-top: 62rpx;
padding-left: 75rpx; padding-left: 75rpx;
padding-bottom: 53rpx;

position: absolute;
left: 0;
bottom: 0;
} }
.imgView{ .imgView{
width: 254rpx; width: 254rpx;

+ 55
- 27
laomenkuang_project/pages/personalCenter/personalCenter.js View File

historyTicketArrows: false, historyTicketArrows: false,
getUser:false, getUser:false,
getUserArr: [],//用户信息 getUserArr: [],//用户信息
userChuan:[],
userPhone:"",//用户手机号 userPhone:"",//用户手机号
mydeg: -90, mydeg: -90,
historydeg: -90, historydeg: -90,
pageNum:1,
pageCount:5,
historyArr: [],//优惠券使用记录列表 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: [],//我的优惠券列表
}, },


/** /**
app.globalData.openidSuccessFuc = this.myTicket; app.globalData.openidSuccessFuc = this.myTicket;
app.globalData.openidSuccessFuc = this.historyTicket; 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(){//获取我的优惠券列表 myTicket:function(){//获取我的优惠券列表
app.wxRequest(app.globalData.httpUrl + 'couponbuy/validtype', {}, e => { app.wxRequest(app.globalData.httpUrl + 'couponbuy/validtype', {}, e => {
}, this) }, this)
}, },
historyTicket: function () {//获取优惠券使用列表 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) console.log(e)
if (e.code == 200) { 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({ this.setData({
historyArr: e.data
historyArr: this.data.getHistoryArr,
}) })
} }
}, this) }, this)
}, },
lower:function(){//检测上拉是否到底 lower:function(){//检测上拉是否到底
console.log("到底了") console.log("到底了")
if (this.data.getHistory.length!=0){
this.data.pageNum++;
this.historyTicket()
}else{
wx.showToast({
title: '没有更多数据了',
icon: "none",
duration: 1000
})
}
}, },
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
}, },
getUser:function(e){//点击登陆获取用户信息 getUser:function(e){//点击登陆获取用户信息
console.log(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) console.log(this.data.getUserArr)
}, },
submitUser:function(){//提交用户信息 submitUser:function(){//提交用户信息
var params={ 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 => { app.wxRequest(app.globalData.httpUrl + 'submit', params, e => {
console.log(e) console.log(e)

+ 7
- 7
laomenkuang_project/pages/personalCenter/personalCenter.wxml View File

<image class="userCircle" src="../images/userCircle.png"></image> <image class="userCircle" src="../images/userCircle.png"></image>
<view class="userAll"> <view class="userAll">
<view class="userHeader"> <view class="userHeader">
<image class="userImg" src="{{getUserArr.avatarUrl}}"></image>
<image class="userImg" src="{{getUserArr[0]}}"></image>
</view> </view>
<button wx:if="{{!getUser}}" plain="true" size="mini" class="getUser" open-type="getUserInfo" bindgetuserinfo="getUser">登陆</button> <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 wx:if="{{getUser}}" class="userPhone">{{userPhone}}</view>
</view> </view>


<image style="transform:rotate({{mydeg}}deg)" class="ticketArrows" src="../images/ticketArrows.png"></image> <image style="transform:rotate({{mydeg}}deg)" class="ticketArrows" src="../images/ticketArrows.png"></image>
</view> </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="contAll" wx:for="{{myTicketArr}}">
<view class="ticketCont" bindtap="lookTicket" data-id = "{{item.coupon_sell_id}}"> <view class="ticketCont" bindtap="lookTicket" data-id = "{{item.coupon_sell_id}}">
<view class="ticketImg"> <view class="ticketImg">
</view> </view>
<view class="rigWord"> <view class="rigWord">
<view class="name">{{item.coupon_name}}</view> <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 class="time">(有效期:{{item.end_date}})</view>
</view> </view>
</view> </view>
<image class="ticketArrows" src="../images/ticketArrows.png" style="transform:rotate({{historydeg}}deg)"></image> <image class="ticketArrows" src="../images/ticketArrows.png" style="transform:rotate({{historydeg}}deg)"></image>
</view> </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="history" wx:for="{{historyArr}}">
<view class="historyLeft"> <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>
<view class="tickName">{{item.coupon_type}}</view> <view class="tickName">{{item.coupon_type}}</view>
<view class="tickType">已使用</view> <view class="tickType">已使用</view>

+ 13
- 6
laomenkuang_project/pages/personalCenter/personalCenter.wxss View File

margin-top: 33rpx; margin-top: 33rpx;
} }
.scrollY2{ .scrollY2{
height: 200rpx;
height: 300rpx;
margin-top: 20rpx; margin-top: 20rpx;
} }
.historyIcon{ .historyIcon{
} }
.historyLeft{ .historyLeft{
position: relative; position: relative;
width: 179rpx;
/* width: 179rpx; */
width: 300rpx;
height: 36rpx; height: 36rpx;
} }
.ticketCode{ .ticketCode{
width: 179rpx;
/* width: 179rpx; */
width: 100%;
text-align: center; text-align: center;
font-size:20rpx; font-size:20rpx;
font-family:DIN; font-family:DIN;
font-weight:500; font-weight:500;
color:rgba(255,255,255,1);
/* color:rgba(255,255,255,1); */


position: absolute; position: absolute;
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
} }
.historyTicketBg{ .historyTicketBg{
width: 179rpx;
/* width: 179rpx; */
width: 300rpx;
height: 36rpx; height: 36rpx;
display: none;
} }
.tickName{ .tickName{
font-size:24rpx; font-size:24rpx;
color:rgba(102,102,102,1); color:rgba(102,102,102,1);
margin-left: 95rpx;
margin-left: 75rpx;
} }
.tickType{ .tickType{
font-size:24rpx; font-size:24rpx;
height: 2rpx; height: 2rpx;
background-color: #CCCCCC; background-color: #CCCCCC;
margin: 0 auto 40rpx auto; margin: 0 auto 40rpx auto;
}
.contAll{
box-shadow: 50rpx 10rpx 20rpx #d4d2d2;
} }

+ 7
- 2
laomenkuang_project/pages/receiveTicket/receiveTicket.js View File

} else if (e.code == 202){ } else if (e.code == 202){
this.setData({ this.setData({
yesGet: false, yesGet: false,
ticketUser: e.data,
titleWord:"此券已被领取" titleWord:"此券已被领取"
}) })
} else if (e.code == 203){ } else if (e.code == 203){
this.setData({ this.setData({
yesGet: false, yesGet: false,
ticketUser: e.data,
titleWord: "此券已失效" titleWord: "此券已失效"
}) })
} else if (e.code == -201) { } else if (e.code == -201) {
this.setData({ this.setData({
yesGet: false, yesGet: false,
ticketUser: e.data,
titleWord: "没有相关赠送记录" titleWord: "没有相关赠送记录"
}) })
} else if (e.code == 204) { } else if (e.code == 204) {
this.setData({ this.setData({
yesGet: false, yesGet: false,
titleWord: "赠送优惠券不足,无法领取"
ticketUser: e.data,
titleWord: "赠送优惠券不足"
}) })
} else if (e.code == 205) { } else if (e.code == 205) {
this.setData({ this.setData({
yesGet: false, yesGet: false,
titleWord: "优惠券超限,无法领取"
ticketUser: e.data,
titleWord: "优惠券超限"
}) })
} }
}, this) }, this)

+ 7
- 1
laomenkuang_project/pages/shop/shop.js View File



searchShop: function (search){//搜索 searchShop: function (search){//搜索
if (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 province = "";
var city = ""; var city = "";
var activeArr = [this.data.provinceArr, this.data.cityArr[0]]; var activeArr = [this.data.provinceArr, this.data.cityArr[0]];

+ 2
- 2
laomenkuang_project/pages/shop/shop.wxml View File

</view> </view>
<view class="searchView"> <view class="searchView">
<image class="searchIcon" src="../images/searchIcon.png"></image> <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> <image wx:if="{{inputVal}}" class="delete" bindtap="deleteVal" src="../images/delete.png"></image>
</view> </view>
<view class="searchBtn" bindtap="searchFn">搜索</view> <view class="searchBtn" bindtap="searchFn">搜索</view>
</view> </view>
<view class="phone"> <view class="phone">
<image class="phoneIcon" src="../images/phoneIcon.png"></image> <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>
<view class="line"></view> <view class="line"></view>
</view> </view>

Loading…
Cancel
Save