@@ -1,11 +1,34 @@ | |||||
//app.js | //app.js | ||||
App({ | App({ | ||||
onLaunch: function () { | |||||
data: { | |||||
appId: '' | |||||
}, | |||||
onLaunch: function() { | |||||
// 登录 | // 登录 | ||||
wx.login({ | wx.login({ | ||||
success: res => { | success: res => { | ||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId | |||||
console.log("login", res); | |||||
wx.request({ | |||||
url: 'https://ciformall.youlane.cn/C/api/user/login', | |||||
header: { | |||||
"content-type": "application/json;charset=UTF-8" | |||||
}, | |||||
data: { | |||||
appId: "wx649b3be73c1afe47", | |||||
code: res.code | |||||
}, | |||||
method: 'POST', | |||||
success: function(result) { | |||||
console.log(result) | |||||
} | |||||
}) | |||||
// Http.postResquest('/api/user/login', '登录中', { | |||||
// appId: "wx649b3be73c1afe47", | |||||
// code: result.code | |||||
// }, (res) => { | |||||
// console.log(res) | |||||
// }) | |||||
} | } | ||||
}) | }) | ||||
// 获取用户信息 | // 获取用户信息 | ||||
@@ -38,13 +61,13 @@ App({ | |||||
/** | /** | ||||
* 获取地址位置信息 | * 获取地址位置信息 | ||||
*/ | */ | ||||
getLocation:function (){ | |||||
getLocation: function() { | |||||
wx.getLocation({ | wx.getLocation({ | ||||
type: 'wgs84', | type: 'wgs84', | ||||
success: function (res) { | |||||
success: function(res) { | |||||
console.log("getLocation", res); | console.log("getLocation", res); | ||||
}, | }, | ||||
fail:error=>{ | |||||
fail: error => { | |||||
console.log(error); | console.log(error); | ||||
} | } | ||||
}) | }) | ||||
@@ -53,8 +76,12 @@ App({ | |||||
// 当前用户信息 | // 当前用户信息 | ||||
userInfo: null, | userInfo: null, | ||||
// 当前商场信息 | // 当前商场信息 | ||||
market:{ | |||||
name:"陕西大悦城" | |||||
market: { | |||||
name: "陕西大悦城" | |||||
} | } | ||||
}, | |||||
getAppid() { | |||||
let appId = "wx649b3be73c1afe47" | |||||
return appId | |||||
} | } | ||||
}) | }) |
@@ -1,8 +1,9 @@ | |||||
{ | { | ||||
"pages": [ | "pages": [ | ||||
"pages/login/index", | |||||
"pages/index/index", | |||||
"pages/market/index", | |||||
"pages/user/index", | "pages/user/index", | ||||
"pages/index/index", | |||||
"pages/login/index", | |||||
"pages/coupons/index/index", | "pages/coupons/index/index", | ||||
"pages/coupons/details/index", | "pages/coupons/details/index", | ||||
"pages/order/index/index", | "pages/order/index/index", | ||||
@@ -10,8 +11,7 @@ | |||||
"pages/rushToBuy/index", | "pages/rushToBuy/index", | ||||
"pages/shop/index/index", | "pages/shop/index/index", | ||||
"pages/shop/details/index", | "pages/shop/details/index", | ||||
"pages/success/index", | |||||
"pages/market/index" | |||||
"pages/success/index" | |||||
], | ], | ||||
"tabBar": { | "tabBar": { | ||||
"color":"#9F9F9F", | "color":"#9F9F9F", | ||||
@@ -16,11 +16,12 @@ Component({ | |||||
data: { | data: { | ||||
}, | }, | ||||
/** | |||||
* 组件的方法列表 | |||||
*/ | |||||
methods: { | methods: { | ||||
onLogin(e){ | |||||
let { id } = e.currentTarget.dataset.date; | |||||
wx.navigateTo({ | |||||
url: `../../pages/coupons/details/index?id=${id}`, | |||||
}) | |||||
} | |||||
} | } | ||||
}) | }) |
@@ -1,21 +1,21 @@ | |||||
<view class="coupons"> | <view class="coupons"> | ||||
<view class="coupons-img"> | <view class="coupons-img"> | ||||
<image src="{{data.img}}"></image> | |||||
<image src="{{data.coverImg}}"></image> | |||||
</view> | </view> | ||||
<view class="coupons-info"> | <view class="coupons-info"> | ||||
<view class="coupons-info-name">{{data.name}}</view> | <view class="coupons-info-name">{{data.name}}</view> | ||||
<view class="coupons-info-price"> | <view class="coupons-info-price"> | ||||
<text class="coupons-info-price-p">¥{{data.pPrice}}</text> | |||||
<text class="coupons-info-price-o">¥{{data.oPrice}}</text> | |||||
<text class="coupons-info-price-p">¥{{data.price}}</text> | |||||
<text class="coupons-info-price-o">¥{{data.salePrice}}</text> | |||||
</view> | </view> | ||||
<view class="coupons-info-distance"> | <view class="coupons-info-distance"> | ||||
<text class="iconfont icon-dingweib"></text> | <text class="iconfont icon-dingweib"></text> | ||||
{{data.distance}} | |||||
{{data.salePrice}} | |||||
</view> | </view> | ||||
<view class="coupons-info-address">{{data.address}}</view> | |||||
<view class="coupons-info-address">{{data.salePrice}}</view> | |||||
</view> | </view> | ||||
<view class="coupons-btn"> | <view class="coupons-btn"> | ||||
<i-button i-class="coupons-btn-gm" bind:click="onLogin">购买</i-button> | |||||
<i-button i-class="coupons-btn-gm" bind:click="onLogin" data-date='{{data}}'>购买</i-button> | |||||
</view> | </view> | ||||
<view class="coupons-border"></view> | <view class="coupons-border"></view> | ||||
</view> | </view> |
@@ -1,65 +1,17 @@ | |||||
Page({ | |||||
let Http = require('../../../utils/http.js') | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
Page({ | |||||
data: { | data: { | ||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
list:{} | |||||
}, | |||||
onLoad(e) { | |||||
console.log(this.data) | |||||
Http.getResquest('/wxCoupon/findById','加载中',{ | |||||
id: e.id | |||||
},(res)=>{ | |||||
this.setData({ | |||||
list: res.data | |||||
}) | |||||
}) | |||||
} | } | ||||
}) | }) |
@@ -1 +1,5 @@ | |||||
<text>pages/t/index.wxml</text> | |||||
<view class='coupons'> | |||||
<image src='{{list.coverImg}}'></image> | |||||
<text>{{list.subTitle}}</text> | |||||
<text>{{list.title}}</text> | |||||
</view> |
@@ -1,4 +1,6 @@ | |||||
// pages/index/sw/index.js | // pages/index/sw/index.js | ||||
let Http = require('../../../utils/http.js') | |||||
Component({ | Component({ | ||||
/** | /** | ||||
* 组件的属性列表 | * 组件的属性列表 | ||||
@@ -99,5 +101,15 @@ Component({ | |||||
current_scroll: detail.key | current_scroll: detail.key | ||||
}); | }); | ||||
}, | }, | ||||
}, | |||||
ready(){ | |||||
Http.getResquest("/wxCoupon/list",'加载中',{ | |||||
"pageNum":1, | |||||
"pageSize":10 | |||||
},(res)=>{ | |||||
this.setData({ | |||||
list:res.data.list | |||||
}) | |||||
}) | |||||
} | } | ||||
}) | }) |
@@ -14,76 +14,11 @@ Page({ | |||||
'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg' | 'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg' | ||||
], | ], | ||||
swiperCurrent: 0, | swiperCurrent: 0, | ||||
scrollTop: 0 | scrollTop: 0 | ||||
}, | }, | ||||
swiperChange: function (e) { | swiperChange: function (e) { | ||||
this.setData({ | this.setData({ | ||||
swiperCurrent: e.detail.current | swiperCurrent: e.detail.current | ||||
}) | }) | ||||
}, | }, | ||||
//页面滚动执行方式 | |||||
onPageScroll(event) { | |||||
// console.log(event.scrollTop); | |||||
// this.setData({ | |||||
// scrollTop: event.scrollTop | |||||
// }) | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
} | |||||
}) | }) |
@@ -1,68 +1,14 @@ | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
let app = getApp() | |||||
Page({ | |||||
data: { | |||||
appId: app.getAppid() | |||||
}, | }, | ||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
onLoad() { | |||||
}, | }, | ||||
onLogin: function () { | |||||
onLogin: function() { | |||||
console.log("登陆"); | console.log("登陆"); | ||||
} | } | ||||
}) | }) |
@@ -1,65 +1,55 @@ | |||||
Page({ | Page({ | ||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | data: { | ||||
tabs: [{ | |||||
key: 1, | |||||
name: "全部" | |||||
}, | |||||
{ | |||||
key: 2, | |||||
name: "待付款" | |||||
}, | |||||
{ | |||||
key: 3, | |||||
name: "已完成" | |||||
} | |||||
], | |||||
list:[ | |||||
{ | |||||
key:'1', | |||||
data:[ | |||||
{ | |||||
name:'111' | |||||
} | |||||
] | |||||
}, | |||||
{ | |||||
key: '2', | |||||
data: [ | |||||
{ | |||||
name: '222' | |||||
} | |||||
] | |||||
}, | |||||
{ | |||||
key: '3', | |||||
data: [ | |||||
{ | |||||
name: '333' | |||||
} | |||||
] | |||||
} | |||||
], | |||||
current:'', | |||||
current_scroll:'1' | |||||
}, | |||||
handleChange({detail}) { | |||||
this.setData({ | |||||
current: detail.key | |||||
}); | |||||
}, | |||||
handleChangeScroll({detail}) { | |||||
this.setData({ | |||||
current_scroll: detail.key | |||||
}); | |||||
}, | }, | ||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面初次渲染完成 | |||||
*/ | |||||
onReady: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面显示 | |||||
*/ | |||||
onShow: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面隐藏 | |||||
*/ | |||||
onHide: function () { | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面卸载 | |||||
*/ | |||||
onUnload: function () { | |||||
}, | |||||
/** | |||||
* 页面相关事件处理函数--监听用户下拉动作 | |||||
*/ | |||||
onPullDownRefresh: function () { | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
} | |||||
}) | }) |
@@ -1,6 +1,8 @@ | |||||
{ | { | ||||
"usingComponents": { | "usingComponents": { | ||||
"i-tab": "../../dist/tab/index", | |||||
"i-tabs": "../../dist/tabs/index", | |||||
"c-coupons": "../../components/coupons/index" | |||||
}, | }, | ||||
"navigationBarTitleText": "商场列表" | |||||
"navigationBarTitleText": "我的订单" | |||||
} | } |
@@ -1 +1,33 @@ | |||||
<text>pages/t/index.wxml</text> | |||||
<view class="market"> | |||||
<i-tabs class='tabs' current="{{ current_scroll }}" scroll bindchange="handleChangeScroll"> | |||||
<i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab> | |||||
</i-tabs> | |||||
<view class='section'> | |||||
<view class='detail_msg'> | |||||
<view> | |||||
<view> | |||||
<image src='http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg'></image> | |||||
</view> | |||||
<view> | |||||
<view> | |||||
<text>黑椒牛排</text> | |||||
<text>等待付款</text> | |||||
</view> | |||||
<view> | |||||
<text>购买数量:<text>1件</text></text> | |||||
</view> | |||||
<view> | |||||
<text>下单时间:<text>2018-07-10 11:30</text></text> | |||||
</view> | |||||
</view> | |||||
</view> | |||||
<view> | |||||
<text>¥1.00 <text>¥59.90</text></text> | |||||
<text>支付</text> | |||||
</view> | |||||
</view> | |||||
<!-- <view wx:for='{{list}}' wx:key='{{index}}' wx:if='{{current_scroll==item.key}}'> | |||||
<text wx:for='{{item.data}}' wx:key='{{index}}'>{{item.name}}</text> | |||||
</view> --> | |||||
</view> | |||||
</view> |
@@ -0,0 +1,33 @@ | |||||
.market{ | |||||
width: 100%; | |||||
} | |||||
.tabs{ | |||||
width: 100%!important; | |||||
height: 88rpx; | |||||
text-align: center; | |||||
} | |||||
.i-tab{ | |||||
width: 30%!important; | |||||
display: inline-block; | |||||
} | |||||
.detail_msg{ | |||||
width: 100%; | |||||
height: 416rpx!important; | |||||
background: #fff; | |||||
margin-top: 2%; | |||||
display: flex; | |||||
flex-direction: column; | |||||
} | |||||
.detail_msg>view:nth-child(1) { | |||||
width: 100%; | |||||
height: 244rpx; | |||||
} | |||||
.detail_msg>view:nth-child(1) view:nth-child(1) { | |||||
width: 248rpx; | |||||
height: 184rpx; | |||||
} | |||||
.detail_msg>view:nth-child(1)>view:nth-child(1) image{ | |||||
width: 100%; | |||||
height: 100%; | |||||
margin: 13.2% 0 0 13%; | |||||
} |
@@ -4,7 +4,7 @@ | |||||
"ignore": [] | "ignore": [] | ||||
}, | }, | ||||
"setting": { | "setting": { | ||||
"urlCheck": true, | |||||
"urlCheck": false, | |||||
"es6": true, | "es6": true, | ||||
"postcss": true, | "postcss": true, | ||||
"minified": true, | "minified": true, | ||||
@@ -12,8 +12,8 @@ | |||||
}, | }, | ||||
"compileType": "miniprogram", | "compileType": "miniprogram", | ||||
"libVersion": "2.2.2", | "libVersion": "2.2.2", | ||||
"appid": "wxff8123ffb9235426", | |||||
"projectname": "wx_luxuriant", | |||||
"appid": "wx649b3be73c1afe47", | |||||
"projectname": "C", | |||||
"isGameTourist": false, | "isGameTourist": false, | ||||
"condition": { | "condition": { | ||||
"search": { | "search": { | ||||
@@ -0,0 +1,70 @@ | |||||
let host = 'https://cinformall.youlane.cn/C'; | |||||
let openId="12313213"; | |||||
const postResquest = (url, message, postData, doSuccess, doFail) => { | |||||
let body={...postData}; | |||||
body["openid"] = openId; | |||||
if (message != "") { | |||||
wx.showLoading({ | |||||
title: message, | |||||
}) | |||||
} | |||||
wx.request({ | |||||
//项目的真正接口,通过字符串拼接方式实现 | |||||
url: host + url, | |||||
header: { | |||||
"content-type": "application/json;charset=UTF-8" | |||||
}, | |||||
data: body, | |||||
method: 'POST', | |||||
success: function (res) { | |||||
//参数值为res.data,直接将返回的数据传入 | |||||
if (message != "") { | |||||
wx.hideLoading() | |||||
}; | |||||
doSuccess(res.data); | |||||
}, | |||||
fail: function (res) { | |||||
if (message != "") { | |||||
wx.hideLoading() | |||||
}; | |||||
wx.showToast({ | |||||
title: '网络错误', | |||||
}) | |||||
}, | |||||
}) | |||||
} | |||||
const getResquest = (url, message, getData, doSuccess, doFail) => { | |||||
let body = { ...getData }; | |||||
body["openid"] = openId; | |||||
if (message != "") { | |||||
wx.showLoading({ | |||||
title: message, | |||||
}) | |||||
} | |||||
wx.request({ | |||||
url: host + url, | |||||
header: { | |||||
"content-type": "application/json;charset=UTF-8" | |||||
}, | |||||
data: body, | |||||
method: 'GET', | |||||
success: function (res) { | |||||
if (message != "") { | |||||
wx.hideLoading() | |||||
}; | |||||
doSuccess(res.data); | |||||
}, | |||||
fail: function (res) { | |||||
if (message != "") { | |||||
wx.hideLoading() | |||||
}; | |||||
wx.showToast({ | |||||
title: '网络错误', | |||||
}) | |||||
}, | |||||
}) | |||||
} | |||||
module.exports = { | |||||
postResquest: postResquest, | |||||
getResquest: getResquest | |||||
} |