This commit is contained in:
张慢慢
2021-05-24 13:56:00 +08:00
commit a7995d90bc
208 changed files with 13143 additions and 0 deletions

14
.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}

54
api/err.js Normal file
View File

@@ -0,0 +1,54 @@
/**
* 处理错误信息
* @property {Object} errInfo
*/
const errInfo = (obj) =>{
if(obj.status_code == 401){
wx.showModal({
title : "登录提示",
content : "长时间未操作,登录已过期,请重新登录",
showCancel : false,
confirmColor: "#0b0041",
confirmText : "确定",
success : ()=>{
// 清理客户端登录缓存
wx.removeStorageSync("token")
// 返回首页
wx.redirectTo({
url: "/pages/index/index",
})
}
})
}else if(obj.status_code == 422){
wx.showToast({
title: obj.message,
icon : "none"
})
}else if(obj.status_code == 400 || obj.status_code == 0){
wx.showToast({
title: obj.message,
icon : "none"
})
}else if(obj.status_code == 404){
wx.showToast({
title: "接口地址不存在,请联系系统管理员",
icon : "none"
})
}else if(obj.status_code == 500){
wx.showToast({
title: "服务端:" + obj.message,
icon : "none"
})
}else {
wx.showToast({
title: "code:" + obj.status_code + ", msg:" + obj.message,
icon : "none"
})
}
}
module.exports = {
errInfo
}

29
api/index.js Normal file
View File

@@ -0,0 +1,29 @@
/*
* 亿时代 v1.0.0 (2020-07-02 09:25:32)
*https://card.ysd-bs.com/api/
*/
// 首页
import index from "./interfaces/index"
// 授权登录
import enroll from "./interfaces/enroll"
// 个人中心
import user from "./interfaces/user"
// 地址管理
import address from "./interfaces/address"
// 兑换订单
import exchange from "./interfaces/exchange"
export default{
index,
enroll,
user,
address,
exchange
}

39
api/interfaces/address.js Normal file
View File

@@ -0,0 +1,39 @@
import {req} from "../request"
//我的地址列表
const index = () => req({url: "addresses"})
//获取省
const create = () => req({url: "addresses/create"})
// 获取市级列表
const children = (psn) => req({url: "areas/children", data: {psn: psn}})
// 获取已有地址信息
const edit = (addressId) => req({url: "addresses/" + addressId + '/edit'})
// 创建地址保存
const add = (name, mobile, province_id, city_id, district_id, address, def) => req({url: "addresses/store", method: "POST", data: {name: name, mobile: mobile, province_id: province_id, city_id: city_id, district_id: district_id, address: address, def: def}})
// 编辑地址保存
const keep = (addressId,name, mobile, province_id, city_id, district_id, address) => req({url: "addresses/" + addressId + '/update', method: "POST", data: {name: name, mobile: mobile, province_id: province_id, city_id: city_id, district_id: district_id, address: address}})
// 设为默认地址
const setdef = (addressId) => req({url: "addresses/" + addressId + '/setdef', method: "POST"})
// 删除地址
const remove = (addressId) => req({url: "addresses/" + addressId + '/destroy', method: "DELETE"})
export default({
index,
create,
children,
edit,
add,
keep,
setdef,
remove
})

18
api/interfaces/enroll.js Normal file
View File

@@ -0,0 +1,18 @@
import {req} from "../request"
//微信授权登录
const record = (code, iv, encryptedData) => req({url: "auth/openwx", method: "POST", data: {code: code, iv: iv, encryptedData: encryptedData}})
//微信手机授权
const bindmobile = (code, iv, mobile) => req({url: "auth/bindmobile", method: "POST", data: {code: code, iv: iv, mobile: mobile}})
//切换手机授权
const tel = (wechatUser_id, username) => req({url: "auth/loginbymobile", method: "POST", data: {wechatUser_id: wechatUser_id,username: username}})
export default({
record,
bindmobile,
tel
})

View File

@@ -0,0 +1,21 @@
import {req} from "../request"
//兑换订单列表
const index = (type) => req({url: "orders/index", data: {type: type}})
//兑换订单详情
const show = (orderid) => req({url: "orders/show?", data: {orderid: orderid}})
//取消兑换订单
const cancel = (orderid) => req({url: "orders/cancel?orderid=" + orderid , method: "POST"})
//兑换订单支付
const payments = (orderid) => req({url: "payments/order?orderid=" + orderid})
export default({
index,
show,
cancel,
payments
})

97
api/interfaces/index.js Normal file
View File

@@ -0,0 +1,97 @@
import {req} from "../request"
//首页权益
const index = (area_name, user_lng, user_lat) => req({url: "home", data: {area_name: area_name, user_lng: user_lng, user_lat:user_lat}})
//白金+钻石权益
const choice = (type, area_name, user_lng, user_lat) => req({url: "home/group", data: {type: type,area_name: area_name, user_lng: user_lng, user_lat:user_lat}})
//权益分类
const classify = (category_id) => req({url: "categories/" + category_id})
//周五福利详情
const welfares = (welfare_id) => req({url: "welfare/" + welfare_id})
//市区选择
const idxCity = (province_id) => req({url: "areas/citys?province_id=" + province_id || ''})
//活动商品列表
const redwine = () => req({url: "redwine/index"})
//活动商品详情
const redwinePay = (goodId) => req({url: "redwine/" + goodId + "/pay", method: "POST"})
//活动商品订单提交
const payment = (good_id, param_id, address_id, islogistics) => req({url: "redwine/payment", method: "POST", data: {good_id: good_id, param_id: param_id, address_id: address_id, islogistics: islogistics}})
//活动商品订单
const activityOrder = (type, page) => req({url: "activity/orders", data: {type: type, page: page}})
//活动商品取消订单
const cance = (orderId) => req({url: "activity/orders/" + orderId + '/cancel', method: "POST"})
//活动商品支付订单
const repay = (orderId) => req({url: "redwine/" + orderId + '/repay', method: "POST"})
//活动商品订单详情
const ordersInfo = (orderId) => req({url: "activity/orders/" + orderId + '/info', method: "POST"})
// 权益详情
const rightShow = (right_id, address_id, num, is_deliver) => req({url: "orders/create/", data: {right_id: right_id, address_id: address_id || '', num: num || '', is_deliver: is_deliver}})
// 权益购买提交
const rightStore = (right_id, address_id, is_deliver, qty) => req({url: "orders/store/", method: "POST", data: {right_id: right_id, address_id: address_id || '', is_deliver: is_deliver, qty: qty || ''}})
// 微信权益购买信息
const wechat = (trade_no) => req({url: "payments/wechat?",method: "POST", data: {trade_no: trade_no}})
// 沃支付权益购买信息
const wopay = (trade_no) => req({url: "unicom/buy?", data: {trade_no: trade_no}})
//获取openid地址-web
const unionpay = (callback_url, callback_type, right_id) => req({url: "unionpay/openid", data: {callback_url: callback_url, callback_type: callback_type, right_id: right_id}})
//领取权益优惠券
const receiveCode = (openid, event_no, right_id) => req({url: "unionpay/code", data: {openid: openid, event_no: event_no, right_id: right_id}})
//领取权益优惠券
const unionCode = (openid) => req({url: "unionpay/union_openid", data: {openid: openid}, method: "POST"})
//所有城市-最新无字母
const newCity = () => req({url: "ajax/all_right_citys"})
//市区选择-最新无字母
const newidxCity = (code) => req({url: "ajax/all_right_children", data: {code: code}})
//周五福利-获取支付信息
const fridayInfo = (orderId) => req({url: "welfare/order/" + orderId})
//周五福利-支付
const fridayPay = (trade_no) => req({url: "payments/welfare/wechat",method: "POST", data: {trade_no: trade_no}})
export default({
index,
choice,
classify,
welfares,
idxCity,
redwine,
redwinePay,
payment,
activityOrder,
cance,
repay,
ordersInfo,
rightShow,
rightStore,
wechat,
wopay,
unionpay,
receiveCode,
unionCode,
newCity,
newidxCity,
fridayInfo,
fridayPay
})

73
api/interfaces/user.js Normal file
View File

@@ -0,0 +1,73 @@
import {req} from "../request"
//用户信息
const index = () => req({url: "user"})
//切换用户登录
const mobiles = () => req({url: "user/mobiles"})
//卡券
const coupon = (status) => req({url: "coupons?status=" + status})
//卡券分组
const couponArr = (activityId, status, page) => req({url: "coupons/list", data:{activityId : activityId, status : status, page : page}})
//卡券详情
const couponinfo = (coupon_id, user_lng, user_lat) => req({url: "coupons/show", data:{coupon_id : coupon_id, user_lng : user_lng, user_lat : user_lat}})
//卡券二维码
const qrcode = (coupon_id) => req({url: "coupons/qrcode", data:{coupon_id : coupon_id}})
//卡券二维码
const barcode = (coupon_id) => req({url: "coupons/" + coupon_id + '/barcode'})
//门店列表
const stores = (coupon_id, province_id, city_id, district_id, title, user_lng, user_lat, page) => req({url: "coupons/new_stores", method: "POST", data:{coupon_id : coupon_id, province_id : province_id || '', city_id : city_id || '', district_id : district_id || '', title : title || '', user_lng : user_lng, user_lat : user_lat, page : page}})
//门店详情
const storesShow = (store_id, user_lng, user_lat) => req({url: "coupons/store/show", data:{store_id : store_id, user_lng : user_lng, user_lat : user_lat}})
//省市区
const areas = (psn) => req({url: "areas/children?psn=" + psn})
// 加入微信卡包
const jssdk = (coupon_id) => req({url: "coupons/jssdk?coupon_id=" + coupon_id})
// 积分卡激活
const cards = (code, pass) => req({url: "user/cards/activate", method: "POST", data:{code : code, pass : pass}})
// 积分账变记录
const logs = (type, page) => req({url: "account/logs", data:{type : type, page : page}})
// 冻结列表
const ungrants = (type,) => req({url: "account/ungrants", data:{type : type}})
// 发送短信
const send = (mobile, channel, type) => req({url: "sms/send", method: "POST", data:{mobile : mobile, channel : channel, type : type}})
// 领取红包
const unicom = (mobile, channel, code) => req({url: "unicom/get", method: "POST", data:{mobile : mobile, channel : channel, code : code}})
// 获取商家券信息
const merchant_card = (coupon_id) => req({url: "coupons/merchant_card", method: "GET", data:{coupon_id : coupon_id}})
export default({
index,
mobiles,
coupon,
couponArr,
couponinfo,
qrcode,
barcode,
stores,
storesShow,
areas,
jssdk,
cards,
logs,
ungrants,
send,
unicom,
merchant_card
})

66
api/request.js Normal file
View File

@@ -0,0 +1,66 @@
import {errInfo} from './err'
import {updToken} from './updateToken'
// 请求方式配置
// https://card.ysd-bs.com
const api = "https://lifetest.ysd-bs.com/api/" //正式地址
const header = {
"Accept" : "application/json"
}
/**
* 请求
* @property {Object} req
*/
const req = (obj) => {
// header
if(obj.token){
header.Authorization = obj.token || ''
} else {
header.Authorization = wx.getStorageSync("token") || ""
}
// 处理请求信息
return new Promise((resolve, reject) => {
// 组合header
obj.header = {
"Accept" : "application/json",
"Authorization" : wx.getStorageSync("token") || ""
}
wx.request({
url : api + obj.url,
header : obj.header || {},
method : obj.method || 'GET',
data : obj.data || {},
success : res => {
// 更新token
if (res.header.Authorization) updToken(res.header.Authorization)
// 处理信息
if (res.data.status_code == 200) {
resolve(res.data)
} else {
if (res.data.status_code == 401 || res.data.status_code == 400) {
reject({
login : false,
codeBeen: false
})
}
errInfo(res.data)
}
},
fail: err => {
wx.showToast({
title : err.errMsg,
icon : "none"
})
reject(err)
}
})
})
}
module.exports = {
req
}

17
api/updateToken.js Normal file
View File

@@ -0,0 +1,17 @@
/**
* 更新token
* @property {String} updToken
*/
const updToken = (token) =>{
// 更新全局存储器
getApp().globalData.token = token
// 更新客户端登录缓存
wx.setStorageSync('token', token)
}
module.exports = {
updToken
}

70
app.js Normal file
View File

@@ -0,0 +1,70 @@
/*
* 亿时代
*/
import api from "api/index"
var QQMapWX = require('utils/qqmap-wx-jssdk.min.js');
var qqmapsdk;
App({
onLaunch() {
// 获取系统信息
this.globalData.statusBarHeight = wx.getSystemInfoSync().statusBarHeight
// 检查用户登录状态
const token = wx.getStorageSync("token")
if (token) {
this.globalData.isUser = true
}
this.qqmapsdk = new QQMapWX({
key: '4KYBZ-LCAKF-QWOJN-NIDNZ-FZHLZ-2XFW7'
})
// 版本更新提示
const updateManager = wx.getUpdateManager()
updateManager.onUpdateReady(function () {
wx.showModal({
title : "更新提示",
content : "新版本已经准备好,是否重启应用?",
confirmText : "重启",
cancelColor : "#555",
confirmColor: "#26589f",
success: res => {
if (res.confirm) {
updateManager.applyUpdate()
}
}
})
})
// 获取系统信息
wx.getSystemInfo({
success: res=>{
this.globalData.systInfo = {
statusBarHeight: res.statusBarHeight,
safeArea : res.safeArea
}
}
})
// 挂载api
wx.$api = api
},
globalData: {
isUser : false,
userInfo : null,
token : "",
statusBarHeight : 0,
userCurrent : 0,
wechatUser : '',
city : "",
atcity : "",
adcode : '',
longitude : '',
latitude : ''
}
})

68
app.json Normal file
View File

@@ -0,0 +1,68 @@
{
"pages": [
"pages/index/index",
"pages/user/user",
"pages/coupon/coupon",
"pages/couponDetails/couponDetails",
"pages/store/store",
"pages/storeDetails/storeDetails",
"pages/chooseTel/chooseTel",
"pages/login/login",
"pages/couponArr/couponArr",
"pages/rights/rights",
"pages/activity/activity",
"pages/activityInfo/activityInfo",
"pages/address/address",
"pages/address_form/address_form",
"pages/activityOrder/activityOrder",
"pages/activityData/activityData",
"pages/order/order",
"pages/orderData/orderData",
"pages/activate/activate",
"pages/account/account",
"pages/switchcity/switchcity",
"pages/webView/webView",
"pages/packet/packet",
"pages/frozen/frozen",
"pages/welfare/welfare",
"pages/classify/classify"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "亿时代",
"navigationBarTextStyle": "black"
},
"tabBar": {
"list": [
{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "/static/tabBarIcon/00.png",
"selectedIconPath": "/static/tabBarIcon/00_active.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "/static/tabBarIcon/01.png",
"selectedIconPath": "/static/tabBarIcon/01_active.png"
}
],
"color": "#b6b9bb",
"selectedColor": "#000",
"borderStyle": "white"
},
"style": "v2",
"sitemapLocation": "sitemap.json",
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"plugins": {
"sendCoupon": {
"version" : "1.2.0",
"provider": "wxf3f436ba9bd4be7b"
}
}
}

96
app.wxss Normal file
View File

@@ -0,0 +1,96 @@
/**app.wxss**/
page {
background: #f7f7f7;
}
/* 下边框 */
.uni-border-top,
.uni-border-bottom {
position: relative;
}
.uni-border-top::after,
.uni-border-bottom::after {
position: absolute;
content: '';
left: 0;
width: 100%;
height: 2rpx;
background: #f3f3f3;
}
.uni-border-top::after {
top: 0;
}
.uni-border-bottom::after {
bottom: 0;
}
/*
* 文字截取
*/
.nowrap {
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.nowrap-multi {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
/*
* 水平居中
*/
.pack-center {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: -1;
}
/*
* 页面信息提醒
*/
.pages-hint {
text-align: center;
color: #747788;
font-size: 28rpx;
background: white;
}
.pages-hint image {
width: 188rpx;
height: 188rpx;
}
/* 上拉加载 */
.pagesLoding{
text-align: center;
line-height: 90rpx;
color: gray;
}
.pagesLoding-icon{
width: 28rpx;
height: 28rpx;
vertical-align: middle;
margin-right: 10rpx;
margin-bottom: 3rpx;
}

83
pages/account/account.js Normal file
View File

@@ -0,0 +1,83 @@
// pages/account/account.js
Page({
/**
* 页面的初始数据
*/
data: {
type : '', //卡类型
number : '', //账户余额
accounts : '', //账户列表
blockeds : '', //待发放余额
page : {}, //分页信息
lodingStats : false, //加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
type : options.type
})
},
onShow() {
// 获取账变记录
this.accountInfo();
},
/**
* 账变记录
*/
accountInfo(page) {
wx.$api.user.logs(this.data.type, page).then(res=>{
//判断金卡、银卡、钻石卡
let number
if(this.data.type == "silver") {
number = res.data.account.silver
} else if(this.data.type == "gold") {
number = res.data.account.gold
} else if(this.data.type == "drill") {
number = res.data.account.drill
} else {
return
}
let listArr = this.data.accounts,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
number : number,
blockeds : res.data.blockeds,
accounts : newData,
page : res.data.page
})
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取账变记录
this.accountInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取账变记录
this.accountInfo(pageNumber);
}
}
})

View File

@@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarTitleText": "账变记录",
"navigationBarBackgroundColor": "#dfb48b",
"navigationBarTextStyle": "white"
}

View File

@@ -0,0 +1,57 @@
<!-- 积分 -->
<view class="integra-top">
<view class="integra-name">
<block wx:if="{{type == 'silver'}}">白金账户余额</block>
<!-- <block wx:elif="{{type == 'gold'}}">金卡余额数</block> -->
<block wx:elif="{{type == 'drill'}}">钻石账户余额</block>
</view>
<view class="integra-info">
<view class="integra-right">
<view class="integra-title"><text>可用余额</text><image src="/static/icon/integra_icon00.png"></image></view>
<view class="integra-number">{{number}}</view>
<view class="integra-btn"><text>可用余额,入账记录</text></view>
</view>
<view class="integra-right">
<view class="integra-title"><text>待发放</text><image src="/static/icon/integra_icon01.png"></image></view>
<view class="integra-number">{{blockeds}}</view>
<navigator hover-class="none" url="/pages/frozen/frozen?type={{type}}&blockeds={{blockeds}}" class="integra-btn integra-blue">立即查询<image src="/static/icon/rightsArrow.png"></image></navigator>
</view>
</view>
</view>
<view class="integra-cont" wx:if="{{accounts != ''}}">
<view class="integra-cont-name">入账记录</view>
<view class="integra-list" wx:for="{{accounts}}" wx:key="integras">
<view class="integra-text">
<view class="integra-title">
{{item.title}}
</view>
<view class="integra-oints">
{{item.variable}}
</view>
</view>
<view class="integra-date">
<view class="integra-time">
<text>有效期:</text>
{{item.created_at}} 至 {{item.expired_at}}
</view>
<!-- <view class="integra-time">
<text>到期时间:</text>
</view> -->
</view>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<!-- 暂无内容 -->
<view class="pack-center pages-hint" wx:else>
<image src="https://storage.funnyzhibo.com/images/2020/05/06/staff_null.png"></image>
<view>抱歉,目前暂无内容~</view>
</view>

155
pages/account/account.wxss Normal file
View File

@@ -0,0 +1,155 @@
/* 积分 */
.integra-cont-name {
padding: 40rpx 20rpx 10rpx;
font-weight: 600;
}
.integra-list {
background: #fff;
border-radius: 10rpx;
width: calc(100% - 40rpx);
margin: 20rpx;
box-sizing: border-box;
}
.integra-top {
padding: 30rpx 20rpx 0;
background-color: #dfb48b;
border-radius: 0 0 100rpx 100rpx;
}
.integra-name {
color: #fff;
font-size: 32rpx;
margin-bottom: 30rpx;
}
.integra-title {
margin-bottom: 20rpx;
}
.integra-number {
font-size: 40rpx;
}
.integra-btn {
font-size: 28rpx;
margin-top: 20rpx;
color: #adadad;
display: flex;
}
.integra-btn text {
color: #dfb48b;
}
.integra-btn image {
width: 36rpx;
height: 36rpx;
margin-top: 2rpx;
}
.integra-blue {
color: #317afa;
}
.integra-info {
background-color: #fff;
text-align: center;
border-radius: 20rpx;
display: flex;
box-shadow: 0 10rpx 10rpx rgba(0, 0, 0, .1);
padding: 30rpx 20rpx;
box-sizing: border-box;
text-align: left;
}
.integra-right {
flex: 2;
position: relative;
}
.integra-right::after {
position: absolute;
content: '';
left: 0;
top: 0;
background-color: #eeeeee;
width: 2rpx;
height: 100%;
}
.integra-right:first-child {
padding-right: 20rpx;
box-sizing: border-box;
}
.integra-right:last-child {
padding-left: 30rpx;
box-sizing: border-box;
}
.integra-right:first-child::after {
display: none;
}
.integra-list {
padding: 30rpx 20rpx;
position: relative;
box-sizing: border-box;
}
.integra-list::after {
position: absolute;
content: '';
left: 0;
bottom: 0;
width: 100%;
height: 2rpx;
background: #eaeaea;
}
.integra-list:last-child::after {
display: none;
}
.integra-text {
display: flex;
margin-bottom: 20rpx;
}
.integra-title {
flex: 1;
font-size: 30rpx;
display: flex;
}
.integra-title text {
flex: 1;
}
.integra-title image {
width: 36rpx;
height: 36rpx;
}
.integra-oints {
color: #f0a479;
}
.integra-date {
display: flex;
}
.integra-time:last-child{
box-sizing: border-box;
}
.integra-time {
color: #999;
font-size: 28rpx;
}
.integra-time text {
color: #000;
}

View File

@@ -0,0 +1,70 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
carmi: '' //卡密
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
},
/**
* 卡激活
*/
cardform(e) {
let code = e.detail.value.code,
pass = this.data.carmi
wx.$api.user.cards(code, pass).then(res=>{
if(res.data.type == "silver") {
app.globalData.userCurrent = 0
}else if(res.data.type == "gold") {
app.globalData.userCurrent = 1
}else if(res.data.type == "drill") {
app.globalData.userCurrent = 2
}else {
return
}
// 写入缓存
wx.setStorage({
key : 'current',
data : app.globalData.userCurrent
})
wx.showToast({
title: res.data.message,
icon : 'none'
})
setTimeout(()=>{
wx.switchTab({
url: '/pages/user/user'
})
},2000)
})
},
/**
* 获取卡密
*/
carmiTab(e){
var number = e.detail.value
var change = number.replace(/(\d{4})(?=\d)/g, "$1-");//replace(/\s/g,'');
this.setData({
carmi: change
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "卡激活"
}

View File

@@ -0,0 +1,29 @@
<!-- 卡激活 -->
<view class="activate-back">
<image class="activate-img" src="/static/img/activate-back.jpg" mode="aspectFill"></image>
<view class="activate-cont">
<view class="activate-title">消费红包【储值卡】</view>
<form bindsubmit="cardform" class="activate-form">
<view class="activate-label">
<label>输入激活卡号16位 <text>例Byt2020090800020</text></label>
<input maxlength="16" name="code"></input>
</view>
<view class="activate-label">
<label>输入激活卡密16位 <text>例8888 8888 8888 8888</text></label>
<input maxlength="19" type="pass" bindinput="carmiTab" value="{{carmi}}"/>
</view>
<view class="activate-btn">
<button form-type="submit">立即激活</button>
</view>
</form>
<view class="activate-tips">
<view class="activate-tips-title">温馨提示:</view>
<view class="activate-tips-text">
尊敬的会员:储值后,将开启您,愉快的消费之旅!
</view>
<!-- <view class="activate-tips-img">
<image src="/static/img/card_img.png"></image>
</view> -->
</view>
</view>
</view>

View File

@@ -0,0 +1,129 @@
/* 卡激活 */
.activate-back {
width: 100%;
height: 100vh;
left: 0;
top: 0;
position: relative;
}
.activate-img {
position: relative;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 2;
}
.activate-cont {
position: absolute;
top: 0;
left: 0;
padding: 60rpx;
width: 100%;
box-sizing: border-box;
z-index: 9;
}
.activate-title {
font-size: 60rpx;
font-weight: 600;
text-align: center;
margin: 20rpx 0 100rpx;
}
.activate-label, .activate-pass {
margin-bottom: 60rpx;
}
.activate-label label, .activate-pass label {
margin-bottom: 40rpx;
display: block;
font-weight: 600;
font-size: 34rpx;
}
.activate-label input, .activate-pass input {
background: rgba(255, 255, 255, .3);
border-radius: 60rpx;
height: 90rpx;
line-height: 90rpx;
padding: 0 1rem;
box-sizing: border-box;
box-shadow: inset -2px 2px 4px 1.5px rgba(0, 0, 0, 0.7);
}
.activate-label input {
width: 100%;
}
.activate-label text {
display: block;
font-size: 32rpx;
margin-top: 10rpx;
font-weight: normal;
}
.activate-entry {
display: flex;
line-height: 80rpx;
color: #fff;
font-weight: 600;
}
.activate-entry input {
background: #fff;
border-radius: 60rpx;
width: calc(25% - 1rem);
margin: 0 .5rem;
height: 80rpx;
line-height: 80rpx;
}
.activate-btn {
width: 100%;
height: 90rpx;
border: none;
margin: 2rem 0 2.2rem;
}
.activate-btn button {
width: 100% !important;
height: 100%;
line-height: 90rpx;
border-radius: 50rpx;
background: #000;
border: none;
font-size: 40rpx;
color: #fff;
margin: 0;
padding: 0;
}
.activate-tips {
color: #000;
font-weight: 600;
font-size: 32rpx;
}
.activate-tips-text {
line-height: 46rpx;
margin-top: 20rpx;
}
.activate-tips-img {
width: 240rpx;
height: 240rpx;
border-radius: 50%;
margin: 2rem auto 0;
}
.activate-tips-img image {
width: 100%;
height: 100%;
}
.activate-tips-text {
text-indent: 2rem;
}

View File

@@ -0,0 +1,53 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
isUser : false, //用户登录状态
indexArr : '', //商品列表
page : '', //下一页
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
if(app.globalData.isUser){
this.setData({
isUser: app.globalData.isUser
})
}
wx.$api.index.redwine().then(res=>{
this.setData({
indexArr : res.data.data,
page : res.data.page
})
})
},
/**
* 处理未登录时的转跳
*/
userNav(e){
let pageUrl = e.currentTarget.dataset.url
if(this.data.isUser){
wx.navigateTo({
url: pageUrl
})
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/login?way=activity"
})
}
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "产品活动"
}

View File

@@ -0,0 +1,7 @@
<!-- 商品活动列表 -->
<view class="activityTitle">
<image src="/static/icon/activity_icon.png"></image>商品列表
</view>
<view class="activityList" bindtap="userNav" data-url="/pages/activityInfo/activityInfo?id={{item.id}}" wx:for="{{indexArr}}" wx:key="indexArr">
<image src="{{item.cover_path}}" mode="scaleToFill"></image>
</view>

View File

@@ -0,0 +1,36 @@
/* 活动列表 */
.activityTitle {
background: #000;
color: #fff;
border-radius: 40rpx 14rpx 14rpx 40rpx;
margin: 20rpx 24rpx 0;
padding: 10rpx;
width: 190rpx;
box-sizing: border-box;
display: flex;
font-size: 28rpx;
}
.activityTitle image {
width: 40rpx;
height: 40rpx;
margin-right: 5rpx;
}
.activityList {
width: calc(100% - 40rpx);
margin: 30rpx 20rpx;
box-sizing: border-box;
position: relative;
padding-top: 40%;
}
/* 5:2 */
.activityList image {
border-radius: 10rpx;
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}

View File

@@ -0,0 +1,138 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
statusHeight : app.globalData.statusBarHeight,
order : '' //订单详情
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 获取商品活动订单详情
this.orderInfo(options.id);
},
/**
* 商品活动订单详情
*/
orderInfo(id) {
wx.$api.index.ordersInfo(id).then(res=>{
this.setData({
order : res.data
})
})
},
/**
* 取消订单
*/
orderDelete(e) {
let orderId = e.currentTarget.dataset.id
wx.showModal({
title : '订单取消',
content : '确认取消吗?',
success : res=> {
if (res.confirm) {
wx.$api.index.cance(orderId).then(res=>{
wx.showToast({
title: res.data,
icon : 'none'
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/activityOrder/activityOrder',
})
},2000)
})
} else if (res.cancel) {
wx.showToast({
title : '取消',
icon : 'loading',
duration: 1000
})
}
}
})
},
/**
* 订单支付
*/
orderPay(e) {
let orderId = e.currentTarget.dataset.id
wx.login({
success: res=> {
wx.$api.index.repay(orderId).then(res=>{
let payInfo = JSON.parse(res.data.json)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/activityOrder/activityOrder',
})
},2000)
}
},
fail : res=>{
wx.reLaunch({
url: '/pages/activityOrder/activityOrder',
})
}
})
})
}
})
},
/**
* 返回上一页
*/
orderRun() {
wx.navigateBack({
delta: 1
})
},
/**
* 复制快递单号
*/
copyText (e) {
let text = e.currentTarget.dataset.text
wx.setClipboardData({
data : text,
success : res=> {
wx.getClipboardData({
success: res => {
wx.showToast({
title: '复制成功'
})
}
})
}
})
}
})

View File

@@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarTitleText": "订单详情",
"navigationBarBackgroundColor": "#f57e32",
"navigationBarTextStyle": "white"
}

View File

@@ -0,0 +1,115 @@
<!-- 订单状态 -->
<view class="order-statl">
{{order.status_text}}
<block wx:if="{{order.status == '0'}}">
<image src="/static/icon/order_icon_00.png" class="order-statl-icon"></image>
</block>
<block wx:elif="{{order.status == '1'}}">
<image src="/static/icon/order_icon_01.png" class="order-statl-icon"></image>
</block>
<block wx:elif="{{order.status == '2'}}">
<image src="/static/icon/order_icon_02.png" class="order-statl-icon"></image>
</block>
</view>
<!-- 收货人 -->
<view class="order-address" wx:if="{{order.address != ''}}">
<image class="address-icon" src="https://storage.funnyzhibo.com/images/2020/05/06/address_icon.png" mode="widthFix"></image>
<view class="order-address-name nowrap">
收货人:{{order.address.name}}
<text>{{order.address.mobile}}</text>
</view>
<view class="order-address-text">{{order.address.province}}{{order.address.city}}{{order.address.district}}{{order.address.info}}</view>
<image class="order-address-back" src="/static/img/address_back.png" mode="widthFix"></image>
</view>
<view class="order-goods">
<view class="goods-goods-li">
<image class="goods-img" src="{{order.param.cover}}" mode="aspectFill"></image>
<view class="goods-body">
<view class="goods-name nowrap">{{order.title}}</view>
<view class="goods-price nowrap">¥{{order.param.price}}
<text class="goods-qty">×{{order.param.number}}</text>
</view>
</view>
</view>
</view>
<!-- 券赠送 -->
<block wx:if="{order.have_coupon != 0}}">
<view class="ni-border-bottom goodsCoupon" wx:for="{{order.coupons}}" wx:key="coupons">
<view class="goodsCoupon-left">
<image class="goodsCoupon-img" mode="scaleToFill" src="/static/img/activity_coupon.png"></image>
<view class="goodsCoupon-number">
<text>¥</text>{{item.amount}}
</view>
<view class="nowrap goodsCoupon-btn">
超市券满减券
</view>
<view class="goodsCoupon-tips"><text>赠</text></view>
</view>
<view class="goodsCoupon-right">
<view class="nowrap goodsCoupon-name">{{item.title}}</view>
<view class="goodsCoupon-sheet">
<view>卡数(张)</view>
<text>x</text> {{item.number}}
</view>
</view>
</view>
</block>
<!-- 礼盒 -->
<block wx:if="{order.have_gift != 0}}">
<view class="goodsCoupon" wx:for="{{order.gifts}}" wx:key="gifts">
<view class="goodsCoupon-left goodsCoupon-box">
<image src="{{item.cover}}" mode="scaleToFill" class="goodsBox-img"></image>
<view class="goodsBox-tips"><text>赠</text></view>
</view>
<view class="goodsCoupon-right goodsCoupon-box-right">
<view class="nowrap goodsCoupon-name goodsCoupon-name-box">{{item.title}}</view>
<view class="nowrap goodsCoupon-text" wx:if="{{item.subtitle != null}}">{{item.subtitle}}</view>
<view class="goodsCoupon-cost">原价:{{item.amount}}元</view>
<view class="goodsCoupon-sheet">
<view class="goodsCoupon-price">活动0.00元</view>
<text>x</text> {{item.number}}
</view>
</view>
</view>
</block>
<view class="order-total">
<view class="order-total-li">
订单号
<text bindtap="copyText" data-text="{{order.order_id}}">{{order.order_id}}</text>
</view>
<!-- <view class="order-total-li">
下单时间
<text>{{order.order_id}}</text>
</view> -->
</view>
<view class="order-total" wx:if="{{order.ex_type_text != '无'}}">
<view class="order-total-li">
物流公司
<text data-text="">{{order.ex_type_text}}</text>
</view>
</view>
<view class="order-total" wx:if="{{order.ex_no != null}}">
<view class="order-total-li">
快递单号
<text bindtap="copyText" data-text="{{order.ex_no}}">{{order.ex_no}}</text>
</view>
</view>
<view class="order-total">
<view class="order-total-li">
实际支付
<text class="redCor">¥{{order.amount}}</text>
</view>
</view>
<view class="order-data-footer {{statusHeight > 30 ? 'iphoneX':''}}">
<view class="order-btn" bindtap="orderRun">返回订单</view>
<view class="order-btn" bindtap="orderDelete" data-id="{{order.id}}" wx:if="{{order.iscancel}}">取消订单</view>
<view class="order-btn order-btn-back" bindtap="orderPay" wx:if="{{order.ispay}}" data-id="{{order.id}}">立即支付</view>
</view>

View File

@@ -0,0 +1,427 @@
/*
* 亿时代
*/
.order-statl{
background-color: #f57e32;
padding: 0 30rpx 10rpx;
color: white;
line-height: 90rpx;
height: 90rpx;
position: relative;
}
.order-statl-icon{
width: 80rpx;
height: 80rpx;
vertical-align: middle;
position: absolute;
right: 30rpx;
top: 5rpx;
}
/* 收货人信息 */
.order-address{
padding: 30rpx 30rpx 30rpx 100rpx;
position: relative;
background: white;
}
.order-address-back{
position: absolute;
left: 0;
bottom: 0;
width: 100%;
vertical-align:bottom;
}
.order-address-name{
padding-right: 300rpx;
position: relative;
font-size: 33rpx;
padding-bottom: 10rpx;
}
.order-address-name text{
position: absolute;
right: 0;
top: 0;
width: 280rpx;
text-align: right;
}
.order-address-text{
color: #464854;
font-size: 26rpx;
}
.address-icon,
.arrows-right{
position: absolute;
}
.address-icon{
height: 42rpx;
width: 42rpx;
left: 30rpx;
top: calc(50% - 26rpx);
top: -webkit-calc(50% - 26rpx);
}
.arrows-right{
height: 28rpx;
width: 28rpx;
right: 30rpx;
top: calc(50% - 19rpx);
top: -webkit-calc(50% - 19rpx);
}
.order-add-address{
text-align: center;
padding: 30rpx 0;
}
.order-add-address navigator{
display: inline-block;
background: #e92344;
color: white;
line-height: 60rpx;
padding: 0 30rpx;
margin-right: 20rpx;
}
/* 订单商品 */
.order-content{
border-bottom: solid 100rpx transparent;
}
.order-goods{
margin-bottom: 20rpx;
}
.goods-goods-mall{
padding: 20rpx 30rpx 0 30rpx;
line-height: 50rpx;
}
.goods-goods-mall image{
width: 48rpx;
height: 48rpx;
vertical-align: middle;
margin-right: 15rpx;
margin-bottom: 2rpx;
}
.goods-goods-li{
padding: 20rpx 30rpx;
position: relative;
border-bottom: solid 1rpx #f2f2f2;
min-height: 130rpx;
background: white;
}
.goods-goods-li:last-child{
border-bottom: none;
}
.goods-img{
position: absolute;
top: 20rpx;
left: 30rpx;
height: 130rpx;
width: 130rpx;
background: #f5f6fa;
}
.goods-body{
padding-left: 150rpx;
}
.goods-name{
font-weight: bold;
padding: 10rpx 0 20rpx;
}
.goods-price{
color: #e92344;
}
.goods-qty{
color: gray;
font-weight: normal;
padding-left: 10rpx;
font-size: 28rpx;
}
.goods-params{
color: gray;
padding-bottom: 20rpx;
font-size: 28rpx;
}
/* 统计信息 */
.order-total{
background: white;
margin: 20rpx 0;
}
.order-total-li{
padding: 0 30rpx;
line-height: 90rpx;
position: relative;
font-size: 28rpx;
}
.order-total-li::before{
position: absolute;
content: " ";
left: 30rpx;
bottom: 0;
right: 0;
height: 1rpx;
background: #f2f2f2;
}
.order-total-li:last-child::before{
display: none;
}
.order-total-li text{
float: right;
color: #999;
}
.order-total-li .redCor {
color: #e92344;
font-size: 32rpx;
}
/* 购物券 */
.goodsCoupon {
background: #fff;
padding: 20rpx;
box-sizing: border-box;
position: relative;
}
.goodsCoupon-right {
width: calc(100% - 270rpx);
position: absolute;
left: 250rpx;
top: 20rpx;
right: 20rpx;
}
.goodsCoupon-text {
color: #999;
font-size: 26rpx;
margin-bottom: 24rpx;
}
.goodsCoupon-name {
margin-bottom: 40rpx;
font-size: 32rpx;
}
.goodsCoupon-name-box {
margin-bottom: 10rpx;
}
.goodsCoupon-sheet {
display: flex;
font-size: 28rpx;
color: #999;
}
.goodsCoupon-cost {
color: #000;
font-size: 28rpx;
margin: 14rpx 0;
}
.goodsCoupon-price {
font-size: 28rpx;
color: #f57e32;
}
.goodsCoupon-sheet view {
display: inline-block;
flex: 1;
}
.goodsCoupon-sheet text {
font-size: 24rpx;
line-height: 40rpx;
padding-right: 6rpx;
}
.goodsCoupon-left {
position: relative;
width: 200rpx;
height: 130rpx;
}
.goodsCoupon-box {
width: 200rpx;
height: 200rpx;
}
.goodsBox-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.goodsCoupon-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.goodsCoupon-number {
position: absolute;
top: 0;
left: 0;
z-index: 2;
width: 100%;
text-align: center;
font-size: 40rpx;
color: #f57e32;
height: 94rpx;
line-height: 94rpx;
font-weight: 600;
}
.goodsCoupon-number text {
font-size: 28rpx;
}
.goodsCoupon-btn {
position: absolute;
right: 10rpx;
left: 10rpx;
bottom: 4rpx;
z-index: 2;
background: #f57e32;
color: #fff;
font-size: 24rpx;
width: calc(100% - 20rpx);
text-align: center;
height: 40rpx;
line-height: 40rpx;
border-radius: 30rpx;
transform: scale(0.83, 0.83);
}
.goodsCoupon-tips {
position: absolute;
top: -4rpx;
left: 10rpx;
z-index: 2;
color: #fff;
transform: rotate(-45deg);
}
.goodsCoupon-tips text {
transform: scale(0.83, 0.83);
font-size: 24rpx;
display: inline-block;
}
.goodsBox-tips {
display: inline-block;
width: 49rpx;
padding: 8rpx 0 6rpx 0;
background: #EDBA19;
top: -10rpx;
left: 10rpx;
position: absolute;
text-align: center;
border-top-left-radius: 4rpx;
font-size: 24rpx;
color: #ffff;
transform: scale(.9, .9);
}
.goodsBox-tips:before, .goodsBox-tips:after {
content: "";
position: absolute;
}
.goodsBox-tips:before {
height: 0;
width: 0;
border-bottom: 10rpx solid #745800;
border-right: 10rpx solid transparent;
right: -10rpx;
top: 0;
}
.goodsBox-tips:after {
height: 0;
width: 0;
border-left: 25rpx solid #EDBA19;
border-right: 25rpx solid #EDBA19;
border-bottom: 25rpx solid transparent;
bottom: -22rpx;
left: 0;
}
.goodsLabel {
background: #fff;
text-align: right;
padding: 20rpx;
font-size: 32rpx;
}
.goodsLabel text {
font-weight: 600;
}
/* 底部工具栏 */
.order-data-footer{
position: fixed;
bottom: 0;
left: 0;
right: 0;
border-top: solid 1rpx #f2f2f2;
padding-top: 17rpx;
padding-right: 30rpx;
padding-left: 30rpx;
height: 83rpx;
background: white;
display: flex;
flex-wrap: wrap;
flex-direction:row-reverse;
}
.order-data-footer.iphoneX {
padding-bottom: 30rpx;
}
.order-btn{
margin-left: 20rpx;
height: 54rpx;
line-height: 50rpx;
box-sizing: border-box;
border:solid 1rpx #747788;
padding: 0 20rpx;
font-size: 26rpx;
border-radius: 40rpx;
margin-top: 10rpx;
}
.order-btn-back {
border-color: #f57e32;
color: #f57e32;
}

View File

@@ -0,0 +1,183 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
isUser : false, //用户登录状态
indexId : '', //tab状态
indexArr : '', //商品列表
page : '', //下一页
address : '', //收货地址
goodId : '', //商品id
goodCont : '', //商品信息
params : '', //商品数量组
paramsIndex : 0,
platIndex : 0, //选择提交方式下标
platformCp :[ //选择提交数组
{
id : 0,
name : '快递'
},
{
id : 1,
name : '自提'
}
],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// this.setData({
// goodId: options.id
// })
if(app.globalData.isUser){
this.setData({
isUser: app.globalData.isUser
})
}
// 活动商品列表
wx.$api.index.redwine().then(res=>{
this.setData({
indexArr : res.data.data,
indexId : res.data.data[1].id,
page : res.data.page
})
// 获取商品信息
this.redwineInfo(res.data.data[1].id)
})
},
/**
* 商品信息
*/
redwineInfo(id) {
wx.$api.index.redwinePay(id).then(res=>{
this.setData({
address : res.data.address,
goodCont : res.data.good,
params : res.data.params,
paramsIndex : res.data.params.findIndex(val => val.def == 1)
})
})
},
/**
* 商品数量选择
*/
goodsNumber(e) {
let onType = e.currentTarget.dataset.type,
atIndex = this.data.paramsIndex
// atIndex = this.data.params.findIndex(val => val.number == this.data.qty)
if(onType == 'plus' && atIndex < this.data.params.length - 1){
atIndex++
}else if(onType == 'remove' && atIndex >= 1){
atIndex--
}else{
return
}
this.setData({
paramsIndex: atIndex
})
},
/**
* 选择提交方式
*/
platBind(e) {
this.setData({
platIndex : e.detail.value
})
},
/**
* 订单提交
*/
submitOrder() {
let good_id = this.data.indexId,
param_id = this.data.params[this.data.paramsIndex].id,
address_id = this.data.address.id,
islogistics = this.data.platIndex
wx.login({
success: res=> {
wx.$api.index.payment(good_id, param_id, address_id, islogistics).then(res=>{
let payInfo = JSON.parse(res.data.json)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/activityOrder/activityOrder',
})
},2000)
}
},
fail : res=>{
wx.reLaunch({
url: '/pages/activityOrder/activityOrder',
})
}
})
})
}
})
},
/**
* 选择tab
*/
orderTab(e) {
let indexId = e.currentTarget.dataset.id
if (indexId != this.data.indexId) {
this.setData({
indexId : indexId
})
}
// 获取商品信息
this.redwineInfo(indexId)
},
/**
* 点击图片放大
*/
clickImg(e) {
let imgUrl = e.currentTarget.dataset.img
wx.previewImage({
urls : [imgUrl], //需要预览的图片http链接列表注意是数组
current : '' // 当前显示图片的http链接默认是第一个
})
},
/**
* 处理未登录时的转跳
*/
loginGo(e){
wx.navigateTo({
url: "/pages/login/login?way=activity"
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "商品购买"
}

View File

@@ -0,0 +1,134 @@
<view class="borderBottom">
<block wx:if="{{isUser}}">
<view class="order-address" wx:if="{{platIndex == 0}}">
<block wx:if="{{address != ''}}">
<navigator url="../address/address?type=selectAddress" hover-class="none">
<image class="address-icon" src="/static/icon/address_icon.png" mode="widthFix"></image>
<image class="arrows-right" src="/static/icon/arrow_left.png" mode="widthFix"></image>
<view class="order-address-name nowrap">
收货人:{{address.name}}<text>{{address.mobile}}</text>
</view>
<view class="order-address-text">收货地址:{{address.all_address}}</view>
</navigator>
</block>
<block wx:else>
<view class="order-add-address">
<navigator url="/pages/address/address?type=selectAddress">
<image class="order-add-address-img" src="/static/icon/add.png"></image>添加地址
</navigator>
</view>
</block>
<image class="order-address-back" src="/static/img/address_back.png" mode="widthFix"></image>
</view>
</block>
<!-- tab选项 -->
<view class="order-tab">
<view wx:for="{{indexArr}}" wx:key="indexArr" class="order-tab-item {{indexId == item.id ? 'active':''}}" data-id="{{item.id}}" bindtap="orderTab">
{{item.classtitle}}
</view>
</view>
<!-- 提示文字 -->
<view class="goods-tips">
<image src="/static/img/gift_box.png"></image>
平安好车主超级福利专享
</view>
<!-- 活动商品 -->
<view class="order-goods">
<view class="goods-goods-li">
<image class="goods-img" src="{{params[paramsIndex].cover}}" mode="aspectFill" bindtap="clickImg" data-img="{{params[paramsIndex].cover}}"></image>
<view class="goods-body">
<view class="nowrap goods-name">{{goodCont.title}}</view>
<view class="nowrap goods-text">{{goodCont.subtitle}}</view>
<view class="goods-cont">
<view class="goods-price"><text>¥</text>{{params[paramsIndex].price}}</view>
<view class="good-number">
<view class="good-number-btn" bindtap="goodsNumber" data-type="remove">-</view>
<input class="good-number-input" disabled value="{{params[paramsIndex].number}}" type="number" bindblur="goodsNumberInput"></input>
<view class="good-number-btn" bindtap="goodsNumber" data-type="plus">+</view>
</view>
</view>
</view>
</view>
</view>
<!-- 券赠送 -->
<block wx:if="{{params[paramsIndex].have_coupon != 0}}">
<view class="uni-border-bottom goodsCoupon" wx:for="{{params[paramsIndex].coupon}}" wx:key="coupon">
<view class="goodsCoupon-left">
<image class="goodsCoupon-img" mode="scaleToFill" src="/static/img/activity_coupon.png"></image>
<view class="goodsCoupon-number">
<text>¥</text>{{item.amount}}
</view>
<view class="goodsCoupon-btn">
比优特电子券
</view>
<view class="goodsCoupon-tips"><text>赠</text></view>
</view>
<view class="goodsCoupon-right">
<view class="goodsCoupon-name">{{item.title}}</view>
<view class="goodsCoupon-sheet">
<view>卡数(张)</view>
<text>x</text> {{item.number}}
</view>
</view>
</view>
</block>
<!-- 礼盒 -->
<block wx:if="{{params[paramsIndex].have_gift != 0}}">
<view class="goodsCoupon" wx:for="{{params[paramsIndex].gift}}" wx:key="gift">
<view class="goodsCoupon-left goodsCoupon-box">
<image src="{{item.cover}}" mode="scaleToFill" class="goodsBox-img" bindtap="clickImg" data-img="{{item.cover}}"></image>
<view class="goodsBox-tips"><text>赠</text></view>
</view>
<view class="goodsCoupon-right goodsCoupon-box-right">
<view class="goodsCoupon-name goodsCoupon-name-box">{{item.title}}</view>
<view class="goodsCoupon-text" wx:if="{{item.subtitle != null}}">{{item.subtitle}}</view>
<view class="goodsCoupon-cost">原价:{{item.amount}}元</view>
<view class="goodsCoupon-sheet">
<view class="goodsCoupon-price">活动0.00元</view>
<text>x</text> {{item.number}}
</view>
</view>
</view>
</block>
<!-- 小计 -->
<view class="uni-border-top goodsLabel">
小计<text>¥{{params[paramsIndex].amount}}</text>
</view>
<view class="rightsLabel">
<view class="rightsLabel-left">请选择提交方式</view>
<view class="rightsLabel-right rightsLabel-range">
<picker range="{{platformCp}}" range-key="name" value="{{platIndex}}" bindchange="platBind">
<view class="tabs-text">
{{platformCp[platIndex].name}}
</view>
</picker>
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
</view>
</view>
<view class="rightsLabel" wx:if="{{platIndex == 0}}">
<view class="rightsLabel-left">快递</view>
<view class="rightsLabel-free">
免运费 包邮
</view>
</view>
</view>
<view class="order-footer" wx:if="{{isUser}}">
<view class="order-footer-total nowrap">
应付金额:
<text class="order-footer-total-price">¥{{params[paramsIndex].amount}}</text>
</view>
<button class="order-footer-btn" size="mini" bindtap="submitOrder">微信支付</button>
</view>
<view class="order-login-footer" wx:else bindtap="loginGo">
请先微信授权登录
</view>

View File

@@ -0,0 +1,575 @@
/* 收货地址 */
.borderBottom {
border-bottom: 110rpx solid transparent;
}
.order-address {
padding: 20rpx 80rpx 30rpx 100rpx;
position: relative;
background: white;
}
.order-address-back {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
vertical-align: bottom;
}
.order-address-name {
padding-right: 300rpx;
position: relative;
font-size: 33rpx;
padding-bottom: 10rpx;
}
.order-address-name text {
position: absolute;
right: 0;
top: 0;
width: 280rpx;
text-align: right;
}
.order-address-text {
color: #464854;
font-size: 26rpx;
}
.address-icon,
.arrows-right {
position: absolute;
}
.address-icon {
height: 42rpx;
width: 42rpx;
left: 30rpx;
top: calc(50% - 26rpx);
top: -webkit-calc(50% - 26rpx);
}
.arrows-right {
height: 28rpx;
width: 28rpx;
right: 30rpx;
top: calc(50% - 19rpx);
top: -webkit-calc(50% - 19rpx);
}
.order-add-address {
text-align: center;
padding: 30rpx 0;
}
.order-add-address navigator {
display: inline-block;
background: #f57e32;
color: white;
line-height: 60rpx;
padding: 0 30rpx;
margin-right: 20rpx;
font-size: 28rpx;
border-radius: 4rpx;
}
.order-add-address-img {
width: 25rpx;
height: 25rpx;
margin-right: 10rpx;
vertical-align: -2rpx;
}
/* 订单商品 */
.order-goods {
margin: 0 0 20rpx;
}
.order-content {
border-bottom: solid 100rpx transparent;
}
.goods-goods-mall {
padding: 20rpx 30rpx 0 30rpx;
line-height: 50rpx;
}
.goods-goods-mall image {
width: 48rpx;
height: 48rpx;
vertical-align: middle;
margin-right: 15rpx;
margin-bottom: 2rpx;
}
.goods-goods-li {
padding: 20rpx 30rpx;
position: relative;
background: white;
display: flex;
height: 200rpx;
}
.goods-img {
position: absolute;
top: 20rpx;
left: 20rpx;
height: 200rpx;
width: 200rpx;
background: #f5f6fa;
border-radius: 4rpx;
}
.goods-body {
padding-left: 220rpx;
width: calc(100% - 220rpx);
}
.goods-name {
font-weight: bold;
padding-bottom: 20rpx;
font-size: 32rpx;
}
.goods-cont {
display: flex;
}
.goods-text {
color: #999;
font-size: 28rpx;
margin-bottom: 40rpx;
}
.goods-price {
flex: 1;
line-height: 50rpx;
font-size: 36rpx;
font-weight: 600;
color: #f57e32;
}
.goods-price text {
font-size: 26rpx;
}
.good-number {
display: flex;
width: 180rpx;
text-align: center;
height: 50rpx;
}
.good-number-btn {
width: 50rpx;
color: #000;
font-weight: 600;
}
.good-number-input {
flex: 1;
margin: 0 6rpx;
height: 50rpx;
line-height: 50rpx;
color: #000;
font-size: 26rpx;
}
.good-number-input {
background: #f7f7f7;
font-size: 24rpx;
}
.good-number-btn {
background: #f0f0f0;
}
/* 购物券 */
.goodsCoupon {
background: #fff;
padding: 20rpx;
box-sizing: border-box;
position: relative;
}
.goodsCoupon-right {
width: calc(100% - 270rpx);
position: absolute;
left: 250rpx;
top: 30rpx;
right: 20rpx;
}
.goodsCoupon-name {
margin-bottom: 30rpx;
font-size: 32rpx;
}
.goodsCoupon-text {
color: #999;
font-size: 26rpx;
margin-bottom: 24rpx;
}
.goodsCoupon-name-box {
margin-bottom: 10rpx;
}
.goodsCoupon-sheet {
display: flex;
font-size: 30rpx;
color: #999;
}
.goodsCoupon-cost {
color: #000;
font-size: 28rpx;
margin: 14rpx 0;
}
.goodsCoupon-price {
font-size: 28rpx;
color: #f57e32;
}
.goodsCoupon-box-right {
top: 16rpx;
}
.goodsCoupon-sheet view {
display: inline-block;
flex: 1;
}
.goodsCoupon-sheet text {
font-size: 24rpx;
line-height: 44rpx;
padding-right: 6rpx;
}
.goodsCoupon-left {
position: relative;
width: 200rpx;
height: 140rpx;
}
.goodsCoupon-box {
width: 200rpx;
height: 200rpx;
}
.goodsBox-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.goodsCoupon-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.goodsCoupon-number {
position: absolute;
top: 20rpx;
left: 0;
z-index: 2;
width: 100%;
text-align: center;
font-size: 40rpx;
color: #fff;
font-weight: 600;
text-shadow: 2rpx 2rpx 2rpx #d69e50;
}
.goodsCoupon-number text {
font-size: 28rpx;
}
.goodsCoupon-btn {
position: absolute;
right: 10rpx;
left: 10rpx;
bottom: 20rpx;
z-index: 2;
background-image: linear-gradient(#eacf90, #f7e09f, #ce9e4d);
color: #000;
font-size: 24rpx;
width: calc(100% - 20rpx);
text-align: center;
height: 40rpx;
line-height: 40rpx;
border-radius: 30rpx;
transform: scale(0.83, 0.83);
}
.goodsCoupon-tips {
position: absolute;
top: 6rpx;
left: 14rpx;
z-index: 2;
color: #fff;
transform: rotate(-48deg);
}
.goodsCoupon-tips text {
transform: scale(0.83, 0.83);
font-size: 24rpx;
display: inline-block;
}
.goodsBox-tips {
display: inline-block;
width: 49rpx;
padding: 8rpx 0 6rpx 0;
background: #EDBA19;
top: -10rpx;
left: 10rpx;
position: absolute;
text-align: center;
border-top-left-radius: 4rpx;
font-size: 24rpx;
color: #ffff;
transform: scale(.9, .9);
}
.goodsBox-tips:before,
.goodsBox-tips:after {
content: "";
position: absolute;
}
.goodsBox-tips:before {
height: 0;
width: 0;
border-bottom: 10rpx solid #745800;
border-right: 10rpx solid transparent;
right: -10rpx;
top: 0;
}
.goodsBox-tips:after {
height: 0;
width: 0;
border-left: 25rpx solid #EDBA19;
border-right: 25rpx solid #EDBA19;
border-bottom: 25rpx solid transparent;
bottom: -22rpx;
left: 0;
}
.goodsLabel {
background: #fff;
text-align: right;
padding: 20rpx;
font-size: 26rpx;
}
.goodsLabel text {
font-weight: 600;
font-size: 30rpx;
padding-left: 10rpx;
color: #f57e32;
}
/* 底部工具栏 */
.order-footer,
.order-login-footer {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
border-top: solid 1rpx #f2f2f2;
height: 100rpx;
line-height: 100rpx;
z-index: 99;
}
.order-footer {
background: white;
}
.order-login-footer {
background: #f57e32;
text-align: center;
color: #fff;
}
.order-footer-total {
padding-right: calc(30vw + 30rpx);
padding-right: -webkit-calc(30vw + 30rpx);
padding-left: 30rpx;
color: #737787;
font-size: 28rpx;
}
.order-footer-total text {
color: #f57e32;
}
.order-footer-total-price {
font-weight: bold;
font-size: 30rpx;
}
.order-footer-btn[size="mini"] {
width: 30vw;
background: #f57e32;
color: white;
border-radius: 0;
height: 100rpx;
line-height: 100rpx;
font-size: 30rpx;
position: absolute;
top: 0;
right: 0;
}
.order-footer-btn:after {
border: none;
}
.order-footer-btn.insufficient {
background: #737787;
text-align: center;
}
.order-textarea {
padding: 20rpx;
}
.rightsLabel {
background: #fff;
display: flex;
padding: 20rpx;
color: #6f7880;
font-size: 30rpx;
margin: 20rpx 0;
}
.rightsLabel .rightsLabel-left {
flex: 1;
color: #747d86;
}
.rightsLabel-black {
padding-top: 30rpx;
}
.rightsLabel-range {
display: flex;
color: #000;
font-weight: 600;
}
.rightsLabel-row {
width: 38rpx;
height: 38rpx;
margin: 2rpx 0 0 6rpx;
}
.rightsLabel-black .rightsLabel-right {
color: #000;
font-weight: 600;
font-size: 32rpx;
}
.rightsLabel-black .rightsLabel-left {
color: #000;
}
.rightsLabel-pay {
color: #000;
}
.rightsLabel-pay .rightsLabel-left {
flex: 1;
}
.rightsLabel-free {
color: #999;
padding-right: 20rpx;
}
/* tab */
.order-tab {
display: flex;
background: #fff;
padding: 20rpx 0 25rpx;
color: #999;
}
.order-tab-item {
flex: 2;
text-align: center;
position: relative;
}
.order-tab-item::after {
position: absolute;
left: calc(50% - 50rpx);
bottom: -25rpx;
width: 100rpx;
height: 4rpx;
border-radius: 20rpx;
content: '';
background: transparent;
}
.order-tab-item.active {
color: #e2952b;
font-weight: 600;
}
.order-tab-item.active::after {
background: #e2952b;
}
/* 提示 */
.goods-tips {
background: #fffbec;
color: #e2952b;
padding: 20rpx;
box-sizing: border-box;
font-size: 29rpx;
display: flex;
position: relative;
}
.goods-tips::after,
.goods-tips::before {
position: absolute;
content: '';
left: 0;
bottom: 0;
width: 100%;
height: 2rpx;
background: #fef5d1;
}
.goods-tips::after {
bottom: 0;
}
.goods-tips::before {
top: 0;
}
.goods-tips image {
width: 30rpx;
height: 30rpx;
margin-right: 14rpx;
margin-top: 3rpx;
}

View File

@@ -0,0 +1,146 @@
// pages/activityOrder/activityOrder.js
Page({
/**
* 页面的初始数据
*/
data: {
stateType : '', //状态
counts : '', //数量
orderArr : [], //列表
page : {}, //下一页
lodingStats : false //加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 获取商品活动订单
this.orderInfo();
},
/**
* 商品活动订单
*/
orderInfo(page) {
wx.$api.index.activityOrder(this.data.stateType, page).then(res=>{
let listArr = this.data.orderArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
counts : res.data.count,
orderArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
})
},
/**
* tabs
*/
orderTab(e){
if(this.data.stateType != e.currentTarget.dataset.state){
this.setData({
stateType: e.currentTarget.dataset.state
})
// 获取商品活动订单
this.orderInfo()
wx.pageScrollTo({
scrollTop: 0
})
}
},
/**
* 取消订单
*/
orderDelete(e) {
let orderId = e.currentTarget.dataset.id
wx.showModal({
title : '订单取消',
content : '确认取消吗?',
success : res=> {
if (res.confirm) {
wx.$api.index.cance(orderId).then(res=>{
// 获取商品活动订单
this.orderInfo()
wx.showToast({
title: res.data,
icon : 'none'
})
})
} else if (res.cancel) {
wx.showToast({
title : '取消',
icon : 'loading',
duration: 1000
})
}
}
})
},
/**
* 订单支付
*/
orderPay(e) {
let orderId = e.currentTarget.dataset.id
wx.login({
success: res=> {
wx.$api.index.repay(orderId).then(res=>{
let payInfo = JSON.parse(res.data.json)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
wx.redirectTo({
url: '/pages/activityOrder/activityOrder',
})
},2000)
}
},
fail : res=>{
wx.redirectTo({
url: '/pages/activityOrder/activityOrder',
})
}
})
})
}
})
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
this.orderInfo(pageNumber)
}
}
})

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "我的订单",
"enablePullDownRefresh": true
}

View File

@@ -0,0 +1,66 @@
<!-- 活动订单 -->
<view class="order-tab">
<view class="order-tab-item {{stateType == '' ? 'active':''}}" data-state="" bindtap="orderTab">
全部
</view>
<view class="order-tab-item {{stateType == '0' ? 'active':''}}" data-state="0" bindtap="orderTab">
未支付
<view class="state-tips" wx:if="{{counts.init != 0}}">{{counts.init}}</view>
</view>
<view class="order-tab-item {{stateType == '1' ? 'active':''}}" data-state="1" bindtap="orderTab">
已支付
<view class="state-tips" wx:if="{{counts.paid != 0}}">{{counts.paid}}</view>
</view>
<view class="order-tab-item {{stateType == '2' ? 'active':''}}" data-state="2" bindtap="orderTab">
已发货
<view class="state-tips" wx:if="{{counts.send != 0}}">{{counts.send}}</view>
</view>
</view>
<!-- 列表 -->
<view class="order-content" wx:if="{{orderArr != ''}}">
<view class="order-content-li" wx:for="{{orderArr}}" wx:key="orderArr">
<view class="order-name">
<image src="/static/icon/activity_icon.png"></image>
{{item.activity_name}}
</view>
<view class="uni-border-down order-store">
<view class="order-store-title nowrap">{{item.order_id}}</view>
<view class="order-store-stateText red" wx:if="{{item.status_text == '未支付'}}">{{item.status_text}}</view>
<view class="order-store-stateText green" wx:elif="{{item.status_text == '已支付'}}">{{item.status_text}}</view>
<view class="order-store-stateText" wx:else>{{item.status_text}}</view>
</view>
<view class="order-goods">
<image class="order-goods-cover" src="{{item.small_cover}}" mode="aspectFill"></image>
<view class="order-goods-content">
<view class="order-goods-content-name nowrap">{{item.title}}</view>
<view class="order-goods-content-price nowrap">
<text>¥{{item.price}}</text> × {{item.number}}
</view>
<view class="order-goods-tips">
<text class="order-goods-tips-color" wx:if="{{item.have_gift == 1}}">礼盒</text>
<text wx:if="{{item.have_coupon == 1}}">购物券</text>
</view>
</view>
</view>
<view class="uni-border-top order-btns">
<navigator class="order-btn" url="/pages/activityData/activityData?id={{item.id}}">订单详情</navigator>
<view class="order-btn" bindtap="orderDelete" data-id="{{item.id}}" wx:if="{{item.iscancel == true}}">取消订单</view>
<view class="order-btn order-btn-back" bindtap="orderPay" data-id="{{item.id}}" wx:if="{{item.ispay == true}}">立即支付</view>
</view>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="https://storage.funnyzhibo.com/images/2020/05/06/null_icon.png"></image>
<view>暂无订单</view>
</view>

View File

@@ -0,0 +1,228 @@
/*
* 亿时代
*/
.order-tab {
position: fixed;
left: 0;
top: 0;
width: 100%;
display: flex;
height: 80rpx;
line-height: 80rpx;
z-index: 9;
background: white;
}
.order-tab-item {
font-size: 28rpx;
width: 25%;
text-align: center;
border-bottom: solid 2rpx #f7f7f7;
color: #464854;
background: white;
position: relative;
}
.order-tab-item.active {
color: #f57e32;
}
.order-tab-item::after {
content: '';
position: absolute;
width: 30rpx;
height: 4rpx;
background: transparent;
left: calc(50% - 15rpx);
bottom: -2rpx;
}
.order-tab-item.active::after {
background: #f57e32;
}
.state-tips {
position: absolute;
top: 10rpx;
right: 14rpx;
background: #e92706;
color: #fff;
font-size: 24rpx;
transform: scale(.7, .7);
border-radius: 60rpx 60rpx 60rpx 0;
width: 48rpx;
height: 34rpx;
line-height: 34rpx;
}
/* 订单列表 */
.order-content {
padding: 80rpx 0 20rpx 0;
}
.order-content-li {
background: white;
margin-top: 20rpx;
position: relative;
}
.order-name {
background: #fff;
padding: 20rpx;
box-sizing: border-box;
border-bottom: solid 1rpx #f3f3f3;
display: flex;
}
.order-name image {
background: linear-gradient(#000, #000);
background-blend-mode: lighten;
background-size: cover;
width: 26rpx;
height: 26rpx;
border-radius: 50%;
margin: 8rpx 14rpx 0 0;
}
.order-store {
padding: 20rpx;
border-bottom: solid 1rpx #f3f3f3;
display: flex;
}
.order-goods-tips {
display: flex;
}
.order-goods-tips text {
display: inline-block;
background: #e92706;
color: #fff;
border-radius: 20rpx;
padding: 0 20rpx;
height: 42rpx;
line-height: 42rpx;
font-size: 24rpx;
transform: scale(.8, .8);
}
text.order-goods-tips-color {
background: #e6b329;
}
.order-store-stateText {
color: #e6b329;
font-size: 26rpx;
}
.order-store-stateText.red {
color: #e92344;
}
.order-store-stateText.green {
color: #79b300;
}
.order-store-title {
flex: 1;
color: #999;
font-size: 28rpx;
}
.order-store-orderid {
color: #747788;
font-size: 25rpx;
}
.order-store-title text {
color: white;
font-size: 24rpx;
background: #e92344;
margin-right: 10rpx;
padding: 0 10rpx;
}
.order-goods {
padding: 20rpx;
box-sizing: border-box;
position: relative;
}
.order-goods-cover {
width: 150rpx;
height: 150rpx;
vertical-align: top;
border-radius: 4rpx;
}
.order-goods-content {
position: absolute;
left: 190rpx;
top: 20rpx;
right: 20rpx;
width: calc(100% - 210rpx);
}
.order-goods-content-name {
margin-bottom: 15rpx;
font-size: 28rpx;
font-weight: 600;
}
.order-goods-content-price {
color: #747788;
display: flex;
margin-bottom: 14rpx;
font-size: 28rpx;
}
.order-goods-content-price text {
color: #f57e32;
display: inline-block;
margin-right: 10rpx;
font-size: 30rpx;
}
.order-total {
padding: 20rpx;
box-sizing: border-box;
font-size: 26rpx;
line-height: 50rpx;
color: #747788;
display: flex;
}
.order-total view {
margin-right: 30rpx;
}
.order-total text {
color: #e92344;
font-weight: bold;
}
.order-btns {
font-size: 25rpx;
display: flex;
padding: 20rpx;
box-sizing: border-box;
flex-wrap: wrap;
flex-direction: row-reverse;
}
.order-btn {
margin-left: 20rpx;
height: 52rpx;
line-height: 50rpx;
box-sizing: border-box;
border: solid 1rpx #747788;
padding: 0 20rpx;
border-radius: 30rpx;
}
.order-btn-back {
border-color: #f57e32;
color: #f57e32;
}

102
pages/address/address.js Normal file
View File

@@ -0,0 +1,102 @@
// pages/address/address.js
Page({
/**
* 页面的初始数据
*/
data: {
type : '', //来源类型
addressArr : [] //收货地址
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
type: options.type
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow(){
this.addressInfo();
},
/* 地址列表
*/
addressInfo(){
wx.$api.address.index().then(res=>{
this.setData({
addressArr: res.data
})
})
},
/**
* 删除地址
*/
addressRemove(e){
let id = e.target.dataset.id,
index = e.target.dataset.index,
list = this.data.addressArr
list.splice(index,1)
wx.showModal({
title : '提示',
content : '是否删除地址',
success : res=> {
if (res.confirm) {
wx.showLoading({
title: '删除中',
})
wx.$api.address.remove(id).then(res=>{
this.setData({
addressArr: list
})
wx.showToast({
title: res.data,
icon : "none"
})
wx.hideLoading()
})
}
}
})
},
/**
* 设为默认地址
*/
addressDefault(e){
let id = e.currentTarget.dataset.id
wx.$api.address.setdef(id).then(res=>{
this.addressInfo();
wx.showToast({
title: res.data,
icon : "none"
})
})
},
/**
* 选择地址
*/
selectAddress(e){
let atAdds = this.data.addressArr[e.currentTarget.dataset.index]
let pages = getCurrentPages(),
prepage = pages[pages.length-2]
prepage.setData({
address: atAdds
})
wx.navigateBack()
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "我的地址"
}

View File

@@ -0,0 +1,40 @@
<view class="address-list" wx:if="{{addressArr != ''}}">
<view class="address" wx:for="{{addressArr}}" wx:key="addressList" wx:for-index="addressIndex">
<view class="address-name">{{item.name}}<text>{{item.mobile}}</text></view>
<view class="address-info">
<block wx:if="{{type == 'selectAddress'}}">
<text class="address-info-tag" wx:if="{{item.is_default}}">默认</text>
</block>
{{item.all_address}}
</view>
<view class="address-tool" wx:if="{{type == 'selectAddress'}}">
<view class="address-tool-btn yellow" bindtap="selectAddress" data-index="{{addressIndex}}">
<image src="/static/icon/choice.png"></image>
选择地址
</view>
</view>
<view class="address-tool" wx:else>
<view class="address-tool-btn" bindtap="addressRemove" data-index="{{addressIndex}}" data-id="{{item.id}}">删除</view>
<navigator class="address-tool-btn" url="/pages/address_form/address_form?type=Compile&id={{item.id}}">编辑</navigator>
<block wx:if="{{item.is_default == 0}}">
<view class="address-tool-btn acitve" bindtap="addressDefault" data-index="{{addressIndex}}" data-id="{{item.id}}">
<image src="/static/icon/select.png"></image>设为默认地址
</view>
</block>
<block wx:else>
<view class="address-tool-btn acitve">
<image src="/static/icon/select_avtive.png"></image>默认地址
</view>
</block>
</view>
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="https://www.lvmeimall.com/assets/mobile/img/address_null_icon.png"></image>
<view>还未添加收货地址</view>
</view>
<view class="address-footer">
<navigator url="/pages/address_form/address_form?type=Add">添加地址</navigator>
</view>

112
pages/address/address.wxss Normal file
View File

@@ -0,0 +1,112 @@
/**
* 亿时代
*/
.address-list{
border-bottom: 110rpx solid transparent;
}
.address{
padding: 20rpx 30rpx;
border-bottom: solid 20rpx #f2f2f2;
background: white;
}
.address-name{
font-size: 32rpx;
line-height: 50rpx;
}
.address-name text{
color: #747788;
padding-left: 10rpx;
font-size: 28rpx;
}
.address-info{
padding-bottom: 20rpx;
display: flex;
}
.address-tool{
overflow: hidden;
}
.address-info-tag{
background: #30bb29;
margin-right: 20rpx;
padding: 0 10rpx;
height: 32rpx;
line-height: 32rpx;
color: white;
font-size: 22rpx;
border-radius: 4rpx;
margin-top: 6rpx;
}
.address-tool-btn{
margin-left: 30rpx;
float: right;
border:solid 1rpx #c0c0c0;
height: 46rpx;
line-height: 44rpx;
padding: 0 30rpx;
border-radius: 6rpx;
font-size: 24rpx;
}
.address-tool-btn.yellow {
border:solid 1rpx #f57e32;
color: #f57e32;
padding: 0 14rpx;
height: 50rpx;
line-height: 50rpx;
}
.address-tool-btn.acitve{
float: left;
margin-left: 0;
padding: 0;
border: none;
color: #747788;
font-size: 26rpx;
}
.address-tool-btn.acitve image{
margin-right: 10rpx;
vertical-align: -7rpx;
}
.address-tool-btn image {
width: 30rpx;
height: 30rpx;
margin-right: 4rpx;
vertical-align: -6rpx;
}
/* footer */
.address-footer{
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding-left: 30rpx;
padding-right: 30rpx;
background: white;
z-index: 9;
height: 110rpx;
}
.address-footer navigator{
width: 100%;
line-height: 80rpx;
height: 80rpx;
margin: 15rpx 0;
text-align: center;
background: #f57e32;
font-size: 30rpx;
color: white;
border-radius: 10rpx
}

View File

@@ -0,0 +1,240 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
addressInfo: '',
type : '', //类型
addressId : '',
defaultVal :'',
name : '',
mobile : '',
address : '',
//省份选择
areas : [],
areaSn : '',
areaIndex : 0,
//市级选择
cityList : [],
cityId : 0,
cityIndex : 0,
//区域选择
regiList : [],
regiId : 0,
regiIndex : 0,
cityLayer : false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
type : options.type
})
if (options.type == 'Add') {
wx.setNavigationBarTitle({
title: '添加收货地址'
})
// 获取位置
wx.getLocation({
type: 'gcj02',
success: res=> {
this.setData({
longitude : res.longitude,
latitude : res.latitude
})
// 解析坐标
getApp().qqmapsdk.reverseGeocoder({
location: {
latitude : res.latitude,
longitude : res.longitude
},
success: res=>{
if(res.message == "query ok"){
let addressInfo = res.result.address_component
let areaIndex = this.data.areas.findIndex(val => val.name == addressInfo.province)
this.setData({
areaIndex : areaIndex
})
this.getProvince()
}else{
wx.showToast({
title: res.message,
icon : 'none'
})
}
}
})
}
})
this.getProvince()
} else if (options.type == 'Compile') {
wx.setNavigationBarTitle({
title: '编辑收货地址'
})
this.setData({
addressId: options.id
})
this.getUserAddress()
}
},
/**
* 获取收货人信息
*/
getUserAddress(){
wx.$api.address.edit(this.data.addressId).then(res=>{
let areasValue = res.data.provinces.findIndex(val=> val.name == res.data.address.province_name),
cityValue = res.data.cities.findIndex(val=> val.name == res.data.address.city_name),
regiValue = res.data.districts.findIndex(val=> val.name == res.data.address.district_name)
this.setData({
name : res.data.address.name,
mobile : res.data.address.mobile,
areas : res.data.provinces,
cityList : res.data.cities,
regiList : res.data.districts,
areaIndex : areasValue,
cityIndex : cityValue,
regiIndex : regiValue,
areaSn : res.data.address.province_id,
cityId : res.data.address.city_id,
regiId : res.data.address.district_id,
address : res.data.address.address,
defaultList : res.data.address,
isDefault : res.data.address.is_default
})
})
},
/**
* 获取省信息
*/
getProvince() {
wx.$api.address.create().then(res=>{
let areaArr = res.data.provinces,
areaIndex = this.data.areaIndex
this.citylist(areaArr[areaIndex].code)
this.setData({
areaSn : areaArr[areaIndex].code,
areas : areaArr
})
})
},
/**
* 所在省份
*/
areasChange(e) {
let area = this.data.areas,
index = e.detail.value,
atcode = area[index].code
if (index != this.data.areaIndex) {
this.setData({
areaIndex : index,
areaSn : atcode
})
// 获取市级列表
this.citylist(atcode)
}
},
/**
* 市级列表
*/
citylist(code) {
wx.$api.address.children(code).then(res=>{
let cityArr = res.data
this.regilist(cityArr[0].code)
this.setData({
cityId : cityArr[0].code,
cityList : cityArr,
cityIndex : 0
})
})
},
/**
* 市级下拉筛选
*/
city(e) {
let city = this.data.cityList,
index = e.detail.value,
citycode = city[index].code
if (index != this.data.areaIndex) {
this.setData({
cityIndex: index,
cityId : citycode
})
// 获取市级列表
this.regilist(citycode)
}
},
/**
* 区列表
*/
regilist(areaCode) {
wx.$api.address.children(areaCode).then(res=>{
this.setData({
regiList : res.data,
regiId : res.data[0].code,
regiIndex : 0
})
})
},
/**
* 区下拉筛选
*/
regi(e) {
let newIndex = e.detail.value
this.setData({
regiIndex : newIndex,
regiId : this.data.regiList[newIndex].code
})
},
/**
* 保存信息
*/
siteform(e) {
if(this.data.type == 'Compile') {
// 编辑地址
wx.$api.address.keep(this.data.addressId, e.detail.value.name, e.detail.value.mobile, this.data.areaSn, this.data.cityId, this.data.regiId, e.detail.value.address).then(res=>{
wx.navigateBack()
})
} else {
// 创建地址
wx.$api.address.add(e.detail.value.name, e.detail.value.mobile, this.data.areaSn, this.data.cityId, this.data.regiId, e.detail.value.address, this.data.defaultVal).then(res=>{
wx.navigateBack()
})
}
},
/**
* 设为默认地址
*/
addressDefault(e) {
let val = e.detail.value
this.setData({
defaultVal: val
})
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,71 @@
<form bindsubmit="siteform" class="site-form">
<view class="site-input">
<label>收货人</label>
<input placeholder="请输入收货人姓名" name="name" value="{{name}}"></input>
</view>
<view class="site-input">
<label>手机号码</label>
<input placeholder="请输入手机号码" name="mobile" type="number" value="{{mobile}}"></input>
</view>
<view class="site-input">
<label>所在省份</label>
<picker bindchange="areasChange" value="{{areaIndex}}" range="{{areas}}" range-key="name" name="province_id">
<view class="picker">
{{areas[areaIndex].name}}
</view>
<image src="/static/icon/rightsArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在城市</label>
<picker bindchange="city" value="{{cityIndex}}" range="{{cityList}}" range-key="name" class="conneColor" name="city_id">
<view class="picker">
{{cityList[cityIndex].name}}
</view>
<image src="/static/icon/rightsArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在区域</label>
<picker bindchange="regi" value="{{regiIndex}}" range="{{regiList}}" range-key="name" class="conneColor" name="district_id">
<view class="picker">
{{regiList[regiIndex].name}}
</view>
<image src="/static/icon/rightsArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>收货地址</label>
<input placeholder="请输入详细地址" name="address" value="{{address}}"></input>
</view>
<view class="site-switch" wx-if="{{type != 'Compile'}}">
<text>设置默认地址</text>
<switch style='zoom:.6;' bindchange="addressDefault" color="#f57e32"/>
</view>
<view class="site-btn">
<button form-type="submit" size="mini">保存</button>
</view>
<view class="pickerView-back {{cityLayer? 'active':''}}" bindtap="cityLayer"></view>
<view class="pickerView-layer {{cityLayer? 'active':''}}">
<view class="pickerView-btn">
<view class="pickerView-cancel" bindtap="cityLayer">取消</view>
<view class="pickerView-determine" bindtap="cityDetermine">确定</view>
</view>
<picker-view class="pickerView" mask-class="pickerView-mask" value="{{pickerValue}}" indicator-class="pickerView-indicator" bindchange="pickerCity">
<picker-view-column>
<view class="pickerView-name nowrap" wx:for="{{provinceArr}}" wx:key="province">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view class="pickerView-name nowrap" wx:for="{{cityArr}}" wx:key="city">{{item.name}}</view>
</picker-view-column>
<picker-view-column>
<view class="pickerView-name nowrap" wx:for="{{districtArr}}" wx:key="district">{{item.name}}</view>
</picker-view-column>
</picker-view>
</view>
</form>

View File

@@ -0,0 +1,148 @@
/**
* 亿时代
*/
.site-form {
background: white;
display: block;
}
.site-btn {
padding: 20rpx 30rpx;
}
.site-input {
padding: 0 30rpx 0 200rpx;
position: relative;
line-height: 90rpx;
min-height: 90rpx;
}
.site-input label {
position: absolute;
left: 30rpx;
top: 0;
}
.site-input input {
height: 90rpx;
}
.site-input image {
width: 38rpx;
height: 38rpx;
position: absolute;
right: 20rpx;
top: calc(50% - 19rpx);
}
.conneColor {
width: calc(100%- 100rpx);
}
.site-input::before {
position: absolute;
bottom: 0;
left: 30rpx;
right: 0;
height: 1rpx;
content: "";
background: #e4e6f2;
}
.site-input:last-child::before {
display: none;
}
.tui-picker-detail {
width: 33%;
}
.site-btn button[size="mini"] {
width: 100%;
background: #f57e32;
height: 80rpx;
line-height: 80rpx;
font-size: 30rpx;
color: white;
padding: 0;
}
/* pickerView */
.pickerView-back {
background: rgba(0, 0, 0, .3);
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: none;
}
.pickerView-back.active {
display: block;
}
.pickerView-layer {
position: fixed;
bottom: -571rpx;
left: 0;
width: 100%;
background: white;
transition: all .3s;
}
.pickerView-layer.active {
bottom: 0;
}
.pickerView-btn {
line-height: 90rpx;
font-size: 30rpx;
padding: 0 30rpx;
display: flex;
justify-content: space-between;
}
.pickerView {
height: 480rpx;
padding: 0 10rpx;
}
.pickerView-name {
line-height: 80rpx;
padding: 0 20rpx;
text-align: center;
}
.pickerView-mask {
border-top: solid 1rpx #e4e6f2;
}
.pickerView-indicator {
height: 80rpx;
}
.pickerView-determine {
color: #f57e32;
}
.pickerView-cancel {
color: #747788;
}
.site-switch {
font-size: 32rpx;
margin: 30rpx;
display: flex;
line-height: 40rpx;
}
.site-switch text {
flex: 1;
}
.site-switch-active {
color: #797979;
}

View File

@@ -0,0 +1,151 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
wechatUserId: "",
loginCode : "",
userInfo : "",
isLogin : false,
iv : '',
enData : '',
loginTel : [] //用户手机号
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 登录方式-活动
this.setData({
way : options.way
})
if(options.type == "mobiles") {
wx.$api.user.mobiles().then(res=>{
this.setData({
loginTel : res.data
})
})
}else {
// 获取用户手机列表
const logintel = wx.getStorageSync("users")
this.setData({
loginTel : logintel
})
}
},
/**
* 生命周期函数--页面显示
*/
onShow() {
wx.login({
success: res => {
this.setData({
loginCode: res.code
})
}
})
},
/**
* 绑定手机号码
*/
mobile(e){
if(e.detail.errMsg == "getPhoneNumber:ok"){
this.setData({
isLogin : true,
iv : e.detail.iv,
enData : e.detail.encryptedData
})
this.binMobel()
}else{
wx.showToast({
title: '拒绝了手机号码授权',
icon : 'none'
})
}
},
/**
* 绑定手机号码
*/
binMobel(){
let code = this.data.loginCode,
iv = this.data.iv,
mobile = this.data.enData
wx.$api.enroll.bindmobile(code, iv, mobile).then(res=>{
this.setData({
isLogin: false
})
getApp().globalData.token = res.data.token
// 更新全局存储器用户状态
getApp().globalData.isUser = true
// 写入缓存
wx.setStorage({
key : 'token',
data : res.data.token
})
if(this.data.way == "activity") {
// 回到活动首页
wx.reLaunch({
url: '/pages/activityInfo/activityInfo'
})
} else {
// 回到个人中心
wx.switchTab({
url: '/pages/user/user'
})
}
})
},
/**
* 点击账号登录
*/
loginGo(e) {
let username = e.currentTarget.dataset.name,
wechatUser_id = app.globalData.wechatUser
wx.$api.enroll.tel(wechatUser_id, username).then(res=>{
app.globalData.token = res.data.token
app.globalData.isUser = true
// 写入缓存
wx.setStorage({
key : 'token',
data : res.data.token
})
if(this.data.way == "activity") {
// 回到活动首页
wx.reLaunch({
url: '/pages/activityInfo/activityInfo'
})
} else {
// 回到个人中心
wx.switchTab({
url: '/pages/user/user'
})
}
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "绑定手机号"
}

View File

@@ -0,0 +1,26 @@
<!-- 切换手机号 -->
<view class="chooseTel-title" wx:if="{{loginTel != ''}}">
<text>切换手机号登录</text>
轻触账户以登录
</view>
<!-- 用户列表 -->
<block wx:if="{{loginTel != ''}}">
<view class="chooseList" wx:for="{{loginTel}}" wx:key="loginTel" bindtap="loginGo" data-name="{{item.username}}">
<view class="chooseList-left">
<image class="chooseList-img" src="{{item.avatar}}" mode="aspectFill"></image>
<view class="chooseList-tel">{{item.username}}</view>
</view>
<view class="chooseList-btn" wx:if="{{item.isThisUser}}">当前登录</view>
</view>
</block>
<!-- 用户列表 -->
<block wx:else>
<view class="chooseTips">
<image src="/static/img/tel_img.png" mode="aspectFill"></image>
<text>您还没有绑定手机号</text>
</view>
</block>
<button hover-class="none" class="chooseAdd" open-type="getPhoneNumber" bindgetphonenumber="mobile" disabled="{{isLogin}}">绑定手机号码</button>

View File

@@ -0,0 +1,75 @@
/* 切换手机号 */
.chooseTel-title {
background: #fff;
padding: 40rpx 30rpx;
color: #999;
}
.chooseTel-title text {
font-size: 36rpx;
font-weight: 600;
margin-bottom: 20rpx;
display: block;
color: #000;
}
.chooseList {
display: flex;
background: #fff;
line-height: 100rpx;
padding: 20rpx;
box-sizing: border-box;
}
.chooseList-left {
display: flex;
}
.chooseList-img {
width: 90rpx;
height: 90rpx;
border-radius: 50%;
margin-right: 30rpx;
}
.chooseList-btn {
font-size: 24rpx;
background: #00c12d;
border-radius: 30rpx;
height: 42rpx;
line-height: 42rpx;
color: #fff;
padding: 0 15rpx;
margin-top: 28rpx;
margin-left: 30rpx;
}
.chooseAdd {
width: calc(100% - 60rpx);
margin: 60rpx auto 0;
background: #fff;
border-radius: 50rpx;
line-height: 80rpx;
height: 80rpx;
text-align: center;
box-shadow: 0 0 10rpx rgba(0, 0,0, .05);
padding: 0;
}
.chooseTips {
background: #fff;
text-align: center;
padding: 30rpx 0 50rpx;
}
.chooseTips image {
width: 400rpx;
height: 350rpx;
display: block;
margin: 0 auto 20rpx;
}
.chooseTips text {
font-size: 34rpx;
color: #999;
}

View File

@@ -0,0 +1,84 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
noticeData : '', //公告
infoData : '', //权益数据
content : '', //内容简介
noticeShow : '', //公告开关
infoItems : [], //卡券专区
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.indexNav(options.id)
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
},
/**
* 卡权益分类
*/
indexNav(id) {
wx.$api.index.classify(id).then(res=>{
this.setData({
noticeData : res.data.notice,
infoData : res.data.info,
infoItems : res.data.items,
content : res.data.info.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
})
}).catch(err=>{
if(!err.login){
// 写入缓存
wx.setStorage({
key : 'token',
data : ''
})
}
})
},
/**
* 须知展开收起状态
*/
noticeTap() {
this.setData({
noticeShow : !this.data.noticeShow
})
},
/**
* 处理未登录时的转跳
*/
userNav(e){
let id = e.currentTarget.dataset.id
wx.getStorage({
key : 'token',
success:res=>{
wx.navigateTo({
url: '/pages/rights/rights?rightsId=' + id
})
},
fail: (err) => {
wx.navigateTo({
url: "/pages/login/login"
})
}
})
}
})

View File

@@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "卡券权益"
}

View File

@@ -0,0 +1,70 @@
<view class="cont">
<view class="contBack">
<image class="classBack" src="/static/img/class_back_01.png" mode="scaleToFill"></image>
<view class="classCircle"></view>
<view class="rightsCont">
<view class="rightsCont-tips" wx:if="{{infoData.two_title != null}}">
{{infoData.two_title}}
</view>
<view class="nowrap rightsCont-title">
{{infoData.three_title == null ? '' : infoData.three_title}}
</view>
<view class="nowrap rightsCont-btn">
{{infoData.two_description}}
</view>
</view>
</view>
</view>
<!-- 提示 -->
<view class="indexNews indexColor">
<image src="/static/icon/news_icon.png"></image>
<view class="marquee_container" style="--marqueeWidth--:-30em">
<view class="marquee_text {{ noticeData.length > 20 ? 'active' : ''}}">{{noticeData}}</view>
</view>
</view>
<!-- 卡券专区 -->
<view class="special">
<view class="special-title">卡券专区</view>
<view class="special-list">
<block wx:if="{{infoItems.length > 0}}">
<view bindtap="userNav" class="special-label" wx:for="{{infoItems}}" wx:key="infoItems"
data-id="{{item.right_config_id}}">
<view class="special-rebate" wx:if="{{item.label != ''}}">{{item.label}}</view>
<scroll-view scroll-x class="welfareCont-top" scroll-with-animation>
<view class="welfareCont-list-img" wx:for="{{item.logos}}" wx:key="logos" wx:for-item="items">
<image src="{{items}}" mode="aspectFill"></image>
</view>
</scroll-view>
<view class="special-text">
<view class="nowrap special-name">{{item.title}}</view>
<view class="special-tips">{{item.subtitle}}</view>
</view>
</view>
</block>
<block wx:else>
<view class="legalTips">
<image src="/static/img/null_icon.png"></image>
<text>抱歉, 暂无内容</text>
</view>
</block>
</view>
</view>
<!-- 购买须知 -->
<view class="notice indexColor">
<view class="noticeTitle" bindtap="noticeTap">
<view class="noticeTitle-flex">
<image class="noticeTitle-img" src="/static/icon/notice_icon.png"></image>
购买前请仔细阅读内容介绍
</view>
<image class="noticeTitle-row {{noticeShow ? 'active' : ''}}" src="/static/icon/arrow_right_black.png"></image>
</view>
<view class="noticeText {{noticeShow ? 'active' : ''}}">
<!-- <view class="noticeText-top">内容介绍</view> -->
<view class="noticeText-cont">
<rich-text nodes="{{content}}"></rich-text>
</view>
</view>
</view>

View File

@@ -0,0 +1,319 @@
/* 卡券权益 */
.cont {
width: 100%;
overflow: hidden;
}
.contBack {
position: relative;
width: 200%;
height: 400rpx;
left: -50%;
text-align: center;
background: #000000;
border-radius: 0 0 100% 100%;
overflow: hidden;
}
.contBack::after {
width: 100%;
height: 30rpx;
position: absolute;
left: 0;
bottom: 0;
z-index: 2;
content: '';
background-image: linear-gradient(transparent, rgba(0,0,0,.25));
}
.classBack {
position: absolute;
left: 30%;
right: 30%;
width: 40%;
top: 40rpx;
}
.classCircle {
position: relative;
}
.classCircle::after,
.contBack::before {
position: absolute;
border-radius: 50%;
content: '';
z-index: 1;
background-color: rgba(255,255,255,.1);
}
.classCircle::after {
left: 20%;
top: -20rpx;
width: 260rpx;
height: 260rpx;
}
.contBack::before {
right: 20%;
top: 55%;
width: 300rpx;
height: 300rpx;
}
.rightsCont {
position: absolute;
z-index: 3;
left: calc(30% - 2rpx);
right: calc(30% - 2rpx);
width: calc(40% + 4rpx);
top: 58rpx;
}
.rightsCont-title {
color: #63320a;
font-size: 60rpx;
margin: 60rpx 0 20rpx;
padding: 0 20rpx;
box-sizing: border-box;
}
.rightsCont-btn {
background-color: #f4dfcc;
width: 100%;
line-height: 70rpx;
font-size: 38rpx;
color: #2d2d2d;
padding: 0 20rpx;
box-sizing: border-box;
}
.rightsCont-tips {
color: #fff;
}
/* 须知 */
.notice,
.indexNews,
.special {
border-radius: 10rpx;
padding: 25rpx 20rpx;
box-sizing: border-box;
background: #fff;
margin: 30rpx 20rpx;
}
.indexColor {
background: #c4c4c4;
}
.noticeTitle {
color: #747d86;
display: flex;
line-height: 46rpx;
}
.noticeTitle-flex {
flex: 1;
display: flex;
font-size: 30rpx;
color: #000;
}
.noticeTitle-img {
width: 46rpx;
height: 46rpx;
margin-right: 20rpx;
}
.noticeText {
font-size: 26rpx;
height: 0;
overflow: hidden;
}
.noticeText.active {
height: auto;
}
.noticeText-top {
margin: 30rpx 0 10rpx;
font-weight: 600;
}
.noticeText-cont {
line-height: 60rpx;
}
.noticeTitle-row {
width: 32rpx;
height: 32rpx;
margin-top: 6rpx;
transform:rotate(-180deg);
}
.noticeTitle-row.active {
transform: rotate(90deg);
}
/* 公告 */
.indexNews {
display: flex;
font-size: 28rpx;
line-height: 46rpx;
}
.indexNews image {
width: 42rpx;
height: 42rpx;
margin: 4rpx 20rpx 0 0;
}
/* 卡券专区 */
.special-list {
margin: 20rpx -10rpx 0;
flex-wrap: wrap;
display: flex;
}
.special-label {
margin: 10rpx;
width: calc(50% - 20rpx);
height: 330rpx;
flex: 0 0 calc(50% - 20rpx);
border: 4rpx solid #fb9b00;
background-color: #ffe0b8;
border-radius: 10rpx;
text-align: center;
padding: 20rpx 0;
box-sizing: border-box;
position: relative;
}
.special-label:last-child {
margin-bottom: 0;
}
.special-rebate {
position: absolute;
top: -30rpx;
right: 10rpx;
background: #fe0002;
color: #fff;
border-radius: 30rpx;
line-height: 52rpx;
height: 52rpx;
font-size: 26rpx;
padding: 0 20rpx;
font-weight: 600;
}
.welfareCont-top{
white-space: nowrap;
flex-direction: row;
align-items: center;
justify-content: space-around;
width: 100%;
padding: 0 10rpx;
box-sizing: border-box;
margin: 10rpx 0;
}
.welfareCont-list-img {
border: 2rpx solid #eccc69;
border-radius: 50%;
width: 100rpx;
height: 100rpx;
display: inline-block;
margin: 0 10rpx;
overflow: hidden;
}
.welfareCont-list-img image {
width: 100%;
height: 100%;
}
.special-text {
padding: 0 15rpx;
box-sizing: border-box;
position: relative;
font-size: 26rpx;
border-top: 4rpx dashed #fb9b00;
margin-top: 20rpx;
padding-top: 20rpx;
}
.special-name {
color: #6f4a2d;
font-weight: 600;
font-size: 28rpx;
}
.special-tips {
background-color: #242424;
color: #fff;
border-radius: 10rpx;
padding: 4rpx 20rpx;
line-height: 46rpx;
height: 46rpx;
margin-top: 20rpx;
font-size: 24rpx;
display: inline-block;
overflow: hidden;
text-overflow: ellipsis;
}
/* 滚动 */
/*首页跑马灯效果*/
@keyframes around {
from {
margin-left: 60rpx;
}
to {
/* var接受传入的变量 */
margin-left: var(--marqueeWidth--);
}
}
.marquee_container {
width: calc(100% - 40rpx);
overflow: hidden;
}
.marquee_container:hover {
/* 不起作用 */
animation-play-state: paused;
}
.marquee_text {
font-size: 28rpx;
display: inline-block;
white-space: nowrap;
}
.marquee_text.active {
animation-name: around;
animation-duration: 20s;
/*过渡时间*/
animation-iteration-count: infinite;
animation-timing-function: linear;
}
/* 权益提示 */
.legalTips {
text-align: center;
font-size: 26rpx;
color: #999;
}
.legalTips image {
width: 180rpx;
height: 180rpx;
display: block;
margin: 0 auto;
}

96
pages/coupon/coupon.js Normal file
View File

@@ -0,0 +1,96 @@
// pages/coupon/coupon.js
Page({
/**
* 页面的初始数据
*/
data: {
couponArr : '',
coupons : [],
count : '',
couponLabel : [
{ title : "未使用", used: 0 },
{ title : "已使用", used: 1 },
{ title : "已过期", used: 2 }
],
stateType : '0', //卡券状态
barHeight : getApp().globalData.statusBarHeight,
type : ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
type : options.type
})
},
/**
* tabs
*/
orderTab(e){
if(this.data.stateType != e.currentTarget.dataset.state){
this.setData({
stateType: e.currentTarget.dataset.state
})
// 获取卡权益
this.couponInfo()
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
// 获取列表
this.couponInfo();
},
/**
* 卡券列表
*/
couponInfo() {
wx.$api.user.coupon(this.data.stateType).then(res=>{
this.setData({
count : res.data.count,
coupons : res.data.list
})
})
},
/**
* 去使用卡券
*/
// applyTap(e) {
// let id = e.currentTarget.dataset.id
// wx.navigateTo({
// url: '/pages/couponDetails/couponDetails?id=' + id
// })
// },
/**
* 查看优惠券分组
*/
couponTap(e) {
let id = e.currentTarget.dataset.id,
status = e.currentTarget.dataset.status
wx.navigateTo({
url: '/pages/couponArr/couponArr?id=' + id + '&status=' + status
})
},
publicTap() {
if(this.data.type == 'couponPublic'){
wx.switchTab({
url: '/pages/user/user'
})
}else {
wx.navigateBack({
delta: 1
})
}
}
})

4
pages/coupon/coupon.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents" : {},
"navigationStyle" : "custom"
}

71
pages/coupon/coupon.wxml Normal file
View File

@@ -0,0 +1,71 @@
<view class="publicHeader" style="padding-top:{{barHeight}}px;">
<image style="top:{{barHeight}}px" class="publicHeader-icon" src="/static/icon/arrow_right_black.png" mode="widthFix" bindtap="publicTap"></image>
<view class="publicHeader-title">我的卡券</view>
</view>
<!-- 我的卡券 -->
<view class="couponTab">
<view class="couponTab-label {{stateType == item.used ? 'active' : ''}}" bindtap="orderTab" wx:for="{{couponLabel}}" wx:key="couponLabel" data-index="{{index}}" data-state="{{item.used}}">
{{item.title}}
<view wx:if="{{item.used == 0}}">({{count.init}}张)</view>
<view wx:elif="{{item.used == 1}}">({{count.used}}张)</view>
<view wx:else>({{count.pass}}张)</view>
</view>
</view>
<!-- 卡券列表 -->
<view class="coupon" wx:if="{{coupons != ''}}">
<view class="couponCont {{item.status != 0 ? 'active' : ''}}" wx:for="{{coupons}}" wx:key="coupons">
<navigator hover-class="none" class="couponList" url="{{item.status == 0 ? '/pages/couponDetails/couponDetails?id=' + item.coupon_id : ''}}">
<view class="couponList-left">
<image class="couponList-img" src="/static/img/coupon_img.png"></image>
<!-- 优惠券 -->
<view class="couponList-icon" wx:if="{{item.type == 'physical'}}">
<image src="/static/img/coupon_icon_01.png"></image>
</view>
<!-- 实物 -->
<view class="couponList-icon" wx:else>
<image src="/static/img/coupon_icon_00.png"></image>
</view>
</view>
<view class="couponList-center {{item.used_at != '' || item.status == 0 ? 'active' : ''}}">
<view class="nowrap couponList-title">{{item.name}}</view>
<view class="couponList-time">{{item.startTime}} 至 {{item.endTime}}</view>
<view class="nowrap couponList-used" wx:if="{{item.status == 0}}">活动来源: {{item.activity_name}}</view>
<view class="couponList-used" wx:if="{{item.used_at != ''}}">使用时间:{{item.used_at}}</view>
</view>
<block wx:if="{{item.status == 0}}">
<view class="couponList-right">
去使用
</view>
</block>
<!-- <block wx:elif="{{item.status == 1}}">
<view class="couponList-right active">
已使用
</view>
</block>
<block wx:else>
<view class="couponList-right active">
已过期
</view>
</block> -->
<image wx:if="{{item.status == 1}}" src="/static/img/coupon_tips_00.png" class="coupoTips"></image>
<image wx:if="{{item.status == 2}}" src="/static/img/coupon_tips_01.png" class="coupoTips"></image>
</navigator>
<view class="couponMore" wx-if="{{item.count > 1}}" >
<view class="couponMore-text" bindtap="couponTap" data-id="{{item.activityId}}" data-status="{{item.status}}">
<view class="couponMore-title">查看全部{{item.count}}张卡券</view>
<image class="couponMore-arrow" src="/static/icon/arrow_left.png"></image>
</view>
</view>
</view>
</view>
<!-- 优惠券为空 -->
<view class="pack-center pages-hint" wx:else>
<image src="/static/img/coupon_tips.png"></image>
<view>暂无优惠券</view>
</view>

247
pages/coupon/coupon.wxss Normal file
View File

@@ -0,0 +1,247 @@
.publicHeader {
position: fixed;
top: 0;
left: 0;
z-index: 9;
width: 100%;
height: 90px;
display: flex;
line-height: 44px;
background: #fff;
text-align: center;
}
.publicHeader-icon {
width: 20px;
height: 20px;
position: absolute;
left: 20rpx;
z-index: 9;
margin-top: 12px;
}
.publicHeader-title {
width: 100%;
text-align: center;
}
/* 优惠券 */
.couponTab {
display: flex;
background: #fff;
position: fixed;
width: 100%;
left: 0;
height: 100rpx;
top: 90px;
z-index: 99;
}
.couponTab-label {
flex: 3;
text-align: center;
position: relative;
padding: 10rpx 0 0;
font-size: 26rpx;
}
.couponTab-label::after {
position: absolute;
content: '';
left: calc(50% - 20rpx);
bottom: 0;
width: 40rpx;
background: transparent;
height: 6rpx;
border-radius: 30%;
}
.couponTab-label.active {
color: #f57e32
}
.couponTab-label.active::after {
background: #f57e32
}
.couponTab-label view {
font-size: 24rpx;
margin-top: 6rpx;
}
/* 列表 */
.coupon {
margin-top: 170px;
}
.couponCont {
margin: 0 20rpx 20rpx;
width: calc(100% - 40rpx);
border-radius: 10rpx;
overflow: hidden;
}
.couponList {
background: #fff;
width: 100%;
height: 160rpx;
position: relative;
}
.couponList-left {
position: relative;
left: 0;
top: 0;
width: 160rpx;
height: 160rpx;
}
.couponList-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.couponList-icon {
position: absolute;
left: calc(50% - 56rpx);
top: calc(50% - 50rpx);
z-index: 2;
width: 100rpx;
height: 100rpx;
background: #fff;
border-radius: 50%;
padding: 20rpx;
box-sizing: border-box;
}
.couponList-icon image {
width: 100%;
height: 100%;
}
.couponList-center {
position: absolute;
left: 180rpx;
top: 35rpx;
width: calc(100% - 330rpx);
}
.couponList-center.active {
top: 15rpx;
}
.couponList-title {
margin-bottom: 10rpx;
font-size: 28rpx;
font-weight: 600;
}
.couponList-time,
.couponList-used {
font-size: 24rpx;
color: grey;
}
.couponList-used {
margin-top: 14rpx;
color: grey;
}
.couponList-right {
background: #ee8e44;
color: #fff;
border-radius: 30rpx;
width: 110rpx;
text-align: center;
height: 50rpx;
line-height: 50rpx;
position: absolute;
right: 20rpx;
top: 55rpx;
font-size: 24rpx;
}
.couponList-right.active {
background: #dddddd;
}
.couponMore {
font-size: 28rpx;
color: #686868;
position: relative;
height: 120rpx;
}
.couponMore::after,
.couponMore::before {
position: absolute;
content: '';
height: 20rpx;
border-radius: 10rpx;
background: #fff;
box-shadow: 0 0 20rpx rgba(0, 0, 0, .1);
z-index: 1;
height: 30rpx;
}
.couponMore::after {
width: calc(100% - 40rpx);
top: 70rpx;
left: 20rpx;
}
.couponMore::before {
width: calc(100% - 80rpx);
top: 90rpx;
left: 40rpx;
}
.couponMore-text {
display: flex;
position: absolute;
left: 0;
top: 0;
width: 100%;
z-index: 99;
height: 80rpx;
border-radius: 0 0 10rpx 10rpx;
line-height: 80rpx;
padding: 0 30rpx;
box-sizing: border-box;
background: #fff;
box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
}
.couponMore-title {
flex: 1;
}
.couponMore-arrow {
width: 28rpx;
height: 28rpx;
margin-top: 26rpx;
}
.couponCont.active .couponList-img,
.couponCont.active .couponList-icon {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
}
.coupoTips {
position: absolute;
top: 22rpx;
right: 20rpx;
z-index: 99;
width: 120rpx;
height: 120rpx;
}

View File

@@ -0,0 +1,78 @@
// pages/couponArr/couponArr.js
Page({
/**
* 页面的初始数据
*/
data: {
id : '',
status : '',
couponArr : '', //卡券组列表
page : 1, //分页
lodingStats : false //加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
id : options.id,
status : options.status
})
// 获取卡券组列表
this.couponInfo();
},
/**
* 卡券组列表
*/
couponInfo(page) {
wx.$api.user.couponArr(this.data.id, this.data.status, page || '').then(res=>{
let listArr = this.data.couponArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
couponArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取团购列表
this.couponInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
this.couponInfo(pageNumber)
}
}
/**
* 去使用卡券
*/
// applyTap(e) {
// let id = e.currentTarget.dataset.id
// wx.navigateTo({
// url: '/pages/couponDetails/couponDetails?id=' + id
// })
// }
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "我的卡券"
}

View File

@@ -0,0 +1,65 @@
<!-- 卡券列表 -->
<view class="coupon" wx:if="couponArr != ''">
<navigator class="couponCont {{item.status != 0 ? 'active' : ''}}" wx:for="{{couponArr}}" wx:key="couponArr" hover-class="none" url="{{item.status == 0 ? '/pages/couponDetails/couponDetails?id=' + item.id : ''}}">
<view class="couponList">
<view class="couponList-left">
<image class="couponList-img" src="/static/img/coupon_img.png"></image>
<!-- 优惠券 -->
<view class="couponList-icon" wx:if="{{item.right.type == 'physical'}}">
<image src="/static/img/coupon_icon_01.png"></image>
</view>
<!-- 实物 -->
<view class="couponList-icon" wx:else>
<image src="/static/img/coupon_icon_00.png"></image>
</view>
</view>
<view class="couponList-center {{item.used_at != '' || item.status == 0 ? 'active' : ''}}">
<view class="nowrap couponList-title">{{item.name}}</view>
<view class="couponList-time">{{item.startTime}} 至 {{item.endTime}}</view>
<view class="nowrap couponList-used" wx:if="{{item.status == 0}}">活动来源: {{item.activity_name}}</view>
<view class="couponList-used" wx:if="{{item.used_at != ''}}">使用时间:{{item.used_at}}</view>
</view>
<block wx:if="{{item.status == 0}}">
<view class="couponList-right">
去使用
</view>
</block>
<!-- <block wx:elif="{{item.status == 1}}">
<view class="couponList-right active">
已使用
</view>
</block>
<block wx:else>
<view class="couponList-right active">
已过期
</view>
</block> -->
<image wx:if="{{item.status == 1}}" src="/static/img/coupon_tips_00.png" class="coupoTips"></image>
<image wx:if="{{item.status == 2}}" src="/static/img/coupon_tips_01.png" class="coupoTips"></image>
</view>
<view class="couponMore" wx-if="{{item.count > 1}}" >
<view class="couponMore-text" bindtap="couponTap" data-id="{{item.activityId}}" data-status="{{item.status}}">
<view class="couponMore-title">查看全部{{item.count}}张卡券</view>
<image class="couponMore-arrow" src="/static/icon/arrow_left.png"></image>
</view>
</view>
</navigator>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<!-- 优惠券为空 -->
<view class="pack-center pages-hint" wx:else>
<image src="/static/img/coupon_tips.png"></image>
<view>暂无优惠券</view>
</view>

View File

@@ -0,0 +1,173 @@
/* 列表 */
.coupon {
margin: 20rpx 0;
}
.couponCont {
margin: 0 20rpx 20rpx;
width: calc(100% - 40rpx);
border-radius: 10rpx;
overflow: hidden;
}
.couponList {
background: #fff;
width: 100%;
height: 160rpx;
position: relative;
}
.couponList-left {
position: relative;
left: 0;
top: 0;
width: 160rpx;
height: 160rpx;
}
.couponList-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.couponList-icon {
position: absolute;
left: calc(50% - 56rpx);
top: calc(50% - 50rpx);
z-index: 2;
width: 100rpx;
height: 100rpx;
background: #fff;
border-radius:50%;
padding: 20rpx;
box-sizing: border-box;
}
.couponList-icon image {
width: 100%;
height: 100%;
}
.couponList-center {
position: absolute;
left: 180rpx;
top: 35rpx;
width: calc(100% - 330rpx);
}
.couponList-center.active {
top: 15rpx;
}
.couponList-title {
margin-bottom: 10rpx;
font-size: 28rpx;
font-weight: 600;
}
.couponList-time, .couponList-used {
font-size: 24rpx;
color: grey;
}
.couponList-used {
margin-top: 14rpx;
}
.couponList-right {
background: #ee8e44;
color: #fff;
border-radius: 30rpx;
width: 110rpx;
text-align: center;
height: 50rpx;
line-height: 50rpx;
position: absolute;
right: 20rpx;
top: 55rpx;
font-size: 24rpx;
}
.couponList-right.active {
background: #dddddd;
}
.couponMore {
font-size: 28rpx;
color: #686868;
position: relative;
height: 120rpx;
}
.couponMore::after, .couponMore::before {
position: absolute;
content: '';
height: 20rpx;
border-radius: 10rpx;
background: #fff;
box-shadow: 0 0 20rpx rgba(0, 0,0, .1);
z-index: 1;
height: 30rpx;
}
.couponMore::after {
width: calc(100% - 40rpx);
top: 70rpx;
left: 20rpx;
}
.couponMore::before {
width: calc(100% - 80rpx);
top: 90rpx;
left: 40rpx;
}
.couponMore-text {
display: flex;
position: absolute;
left: 0;
top: 0;
width: 100%;
z-index: 99;
height: 80rpx;
border-radius: 0 0 10rpx 10rpx;
line-height: 80rpx;
padding: 0 30rpx;
box-sizing: border-box;
background: #fff;
box-shadow: 0 0 10rpx rgba(0, 0,0, .1);
}
.couponMore-title {
flex: 1;
}
.couponMore-arrow {
width: 28rpx;
height: 28rpx;
margin-top: 26rpx;
}
.couponCont.active .couponList-img, .couponCont.active .couponList-icon {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
}
.coupoTips {
position: absolute;
top: 22rpx;
right: 20rpx;
z-index: 99;
width: 120rpx;
height: 120rpx;
}

View File

@@ -0,0 +1,213 @@
// pages/couponDetails/couponDetails.js
Page({
/**
* 页面的初始数据
*/
data: {
id : 0, //优惠券id
longitude : 0, //经度
latitude : 0, //纬度
details : '', //优惠券信息
stores : [], //商家列表
content : '', //内容介绍
remark : '', //使用须知
qrcode : '', //二维码
barcode : '', //条形码
merchantcardinfo:'', //商家券信息
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 优惠券id
this.setData({
id :options.id
})
// 获取二维码
this.detailsCode()
// 获取条形码
this.detailsBarcode()
},
onShow(){
this.getCity();
// 检查定位是否为空
// if(this.data.latitude == 0 && this.data.longitude == 0){
// wx.getSetting({
// success: res=>{
// this.getCity()
// }
// })
// }
},
/**
* 获取城市信息
*/
getCity(){
wx.getLocation({
success: res => {
this.setData({
latitude    : res.latitude,
                    longitude   : res.longitude
                })
},
complete: () => {
// 获取详情信息
this.detailsInfo();
}
})
},
/**
* 二维码
*/
detailsCode() {
let coupon_id = this.data.id
wx.$api.user.qrcode(coupon_id).then(res=>{
this.setData({
qrcode : res.data.qrcode
})
})
},
/**
* 条形码
*/
detailsBarcode() {
let coupon_id = this.data.id
wx.$api.user.barcode(coupon_id).then(res=>{
this.setData({
barcode : res.data.barcode
})
})
},
/**
* 详情信息
*/
detailsInfo() {
let coupon_id = this.data.id,
user_lng = this.data.longitude,
user_lat = this.data.latitude
wx.$api.user.couponinfo(coupon_id, user_lng, user_lat).then(res=>{
let stores = res.data.stores
stores.map(res=>{
let distance = res.distance
if(res.distance > 1000){
distance = (distance / 1000) + "km"
}else{
distance = distance + "m"
}
res.km = distance
})
this.setData({
details : res.data.info,
stores : stores,
remark : res.data.info.right.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
content : res.data.info.right.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
})
//获取商家券信息
if(res.data.info.card_type=='merchant_card'){
this.getMerchantCardInfo()
}
})
},
/**
* 拨打电话
*/
tel(e) {
let tel = e.currentTarget.dataset.tel
wx.showActionSheet({
itemList : ['呼叫商家电话'],
success : res =>{
if(res.tapIndex==0){
wx.makePhoneCall({
phoneNumber: tel
})
}
}
})
},
/**
* 查看门店详情页
*/
detailsTap(e) {
let store_id = e.currentTarget.dataset.id,
user_lng = this.data.longitude,
user_lat = this.data.latitude
wx.navigateTo({
url: '/pages/storeDetails/storeDetails?store_id=' + store_id + '&user_lng=' + user_lng + '&user_lat=' + user_lat,
})
},
/**
* 加入微信卡包
*/
join(e) {
let cardId = this.data.id
wx.$api.user.jssdk(cardId).then(res=>{
let pay = JSON.parse(res.data)
wx.addCard({
cardList : pay,
success : res => {
// 获取详情信息
this.detailsInfo();
},fail : res=> {
}
})
})
},
/**
* 商家券信息
*/
getMerchantCardInfo(){
let coupon_id = this.data.id
wx.$api.user.merchant_card(coupon_id).then(res=>{
this.setData({
merchantcardinfo : res.data
})
})
},
/**
* 小程序插件领取
*/
getcoupon(params) {
let detail = params.detail
if(detail.errcode !=='OK'){
wx.showToast({
title : detail.errmsg,
icon : 'none'
})
}else{
if(detail.send_coupon_result[0].code !=='SUCCESS'){
wx.showToast({
title : detail.send_coupon_result[0].message,
icon : 'none'
})
}else{
wx.showToast({
title : '领取成功',
icon : 'none'
})
}
}
}
})

View File

@@ -0,0 +1,6 @@
{
"usingComponents": {
"send-coupon": "plugin://sendCoupon/send-coupon"
},
"navigationBarTitleText": "卡券详情"
}

View File

@@ -0,0 +1,114 @@
<!-- 卡券详情 -->
<view class="details">
<view class="detailsTop">
<view class="detailsTop-name">
{{details.name}}
</view>
<view class="detailsTop-time">
有效期: {{details.startTime}} - {{details.endTime}}
</view>
</view>
<view class="source">活动来源 {{details.activity_name}}</view>
<view class="detailsBar">
<view class="detailsCode-text">劵码</view>
<image src="{{barcode}}" mode="widthFix"></image>
</view>
<view class="detailsCode-text">
{{details.code}}
</view>
<view class="detailsCode">
<image src="{{qrcode}}"></image>
<view class="detailsCode-text">
<text>请出示以上券码给网点工作人员</text>
</view>
<block wx:if="{{details.card_type == 'merchant_card'}}">
<view class="detailsCode-join {{details.is_get == true ? 'active':''}}">
<send-coupon send_coupon_params="{{merchantcardinfo.send_coupon_params}}" sign="{{ merchantcardinfo.sign }}" send_coupon_merchant="{{merchantcardinfo.send_coupon_merchant}}" wx:if="{{details.is_get == true}}">
已加入微信卡包
</send-coupon>
<send-coupon send_coupon_params="{{merchantcardinfo.send_coupon_params}}" sign="{{ merchantcardinfo.sign }}" send_coupon_merchant="{{merchantcardinfo.send_coupon_merchant}}" bindcustomevent="getcoupon" wx:else>
加入微信卡包
</send-coupon>
</view>
</block>
<block wx:if="{{details.card_type == 'card'}}">
<view class="detailsCode-join {{details.is_get == true ? 'active':''}}" wx:if="{{details.is_get == true}}">
已加入微信卡包
</view>
<view class="detailsCode-join {{details.is_get == true ? 'active':''}}" bindtap="join" wx:else>
加入微信卡包
</view>
</block>
</view>
<!-- 门店定位 -->
<view class="detailsStore">
<view class="detailsStore-top">
<view class="detailsStore-title">
适用门店
</view>
<navigator class="detailsStore-row" hover-class="none" url="/pages/store/store?id={{details.id}}" wx:if="{{longitude != 0 && latitude != 0}}">
查看所有
<image src="/static/icon/arrow_left.png"></image>
</navigator>
</view>
<view class="location" wx:if="{{longitude == 0 && latitude == 0}}">
<image class="location-img" src="/static/img/location_img.jpg"></image>
<text>您尚未授权本时生活开启定位服务</text>
<text>不能看到附近的商家哦,点击下方按钮开启</text>
<button class="location-btn" size="mini" open-type="openSetting">
开启定位服务
</button>
</view>
<view wx:else>
<block wx:if="{{stores != ''}}">
<view class="detailsStore-list" data-id="{{item.store_id}}" wx:for="{{stores}}" wx:key="stores"
bindtap="detailsTap">
<image src="{{item.cover}}" class="detailsStore-logo"></image>
<view class="detailsStore-cont">
<view class="detailsStore-left">
<view class="nowrap detailsStore-name">
{{item.title}}
</view>
<view class="detailsStore-place">
<text class="nowrap">{{item.address}}</text>
{{item.km}}
</view>
</view>
<image class="detailsStore-tel" src="/static/icon/tel.png" catchtap="tel"
data-tel="{{item.mobile}}"></image>
</view>
</view>
</block>
<block wx:else>
<view class="pages-hint">
<image src="/static/img/null_icon.png"></image>
<view>暂无门店</view>
</view>
</block>
</view>
</view>
</view>
<!-- 使用须知 -->
<view class="detailsText">
<view class="detailsText-title">
使用须知
</view>
<view class="detailsText-tips">
<rich-text nodes="{{remark}}"></rich-text>
</view>
</view>
<!-- 内容介绍 -->
<view class="detailsText">
<view class="detailsText-title">
内容介绍
</view>
<view class="detailsText-tips" wx:if="{{content != null}}">
<rich-text nodes="{{content}}"></rich-text>
</view>
</view>

View File

@@ -0,0 +1,215 @@
/* 卡券详情 */
.details {
background: #fff;
margin: 20rpx;
width: calc(100% - 40rpx);
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
box-shadow: 0 0 20rpx rgba(0, 0,0, .1);
}
.detailsTop {
border-bottom: 2rpx dashed #c8c8c8;
padding-bottom: 40rpx;
}
.detailsTop-name {
font-size: 36rpx;
font-weight: 600;
margin-bottom: 20rpx;
}
.detailsTop-time {
color: #7e7e7e;
font-size: 26rpx;
}
.detailsCode {
text-align: center;
padding: 0 0 20rpx;
margin: 40rpx 0 30rpx;
}
.detailsCode image {
width: 300rpx;
height: 300rpx;
margin-bottom: 30rpx;
}
.detailsCode-text, .detailsStore-row {
color: #949494;
font-size: 28rpx;
}
.detailsCode-text {
text-align: center;
font-size: 32rpx;
font-weight: 600;
color: #000;
}
.detailsCode-text text {
color: #999;
font-weight: normal;
font-size: 26rpx;
}
.detailsStore {
border-top: 2rpx #c8c8c8 solid;
padding-top: 40rpx;
}
.detailsStore-top, .detailsStore-row {
display: flex;
line-height: 30rpx;
margin-bottom: 20rpx;
}
.detailsStore-title {
flex: 1;
font-weight: 600;
}
.detailsStore-row image {
width: 26rpx;
height: 26rpx;
margin: 3rpx 0 0 6rpx;
}
.detailsStore-list {
position: relative;
margin-bottom: 40rpx;
}
.detailsStore-list:last-child {
margin-bottom: 0;
}
.detailsStore-logo {
width: 100rpx;
height: 100rpx;
border-radius: 10rpx;
}
.detailsStore-cont {
position: absolute;
left: 130rpx;
top: 0;
width: calc(100% - 130rpx);
display: flex;
}
.detailsStore-left {
width: calc(100% - 90rpx);
margin-right: 30rpx;
}
.detailsStore-tel {
width: 60rpx;
height: 60rpx;
margin-top: 25rpx;
}
.detailsStore-place {
font-size: 24rpx;
line-height: 40rpx;
color: #5a5a5a;
display: flex;
}
.detailsStore-place text {
flex: 1;
display: inline-block;
font-size: 28rpx;
margin-right: 20rpx;
}
.detailsStore-name {
margin-bottom: 20rpx;
}
.detailsText {
padding: 30rpx 30rpx 20rpx;
box-sizing: border-box;
}
.detailsText-title {
font-size: 32rpx;
font-weight: 600;
margin-bottom: 20rpx;
}
.detailsText-tips {
font-size: 26rpx;
line-height: 50rpx;
color: #555557;
padding-bottom: 20rpx;
}
.detailsCode-join {
color: #ee8e44;
font-size: 24rpx;
border-radius: 50rpx;
border: 2rpx solid #ee8e44;
padding: 10rpx 20rpx;
display: inline-block;
margin-top: 30rpx;
}
.detailsCode-join.active {
border: 2rpx solid #999;
color: #999;
}
.source{
margin: 30rpx 0;
font-size: 28rpx;
}
.location {
background: white;
width: 100%;
text-align: center;
margin: 60rpx 0 0;
}
.location text {
font-size: 28rpx;
display: block;
line-height: 46rpx;
color: #999;
}
.location-btn[size="mini"] {
background-color: #ee8e44;
color: #fff;
font-size: 26rpx;
line-height: 66rpx;
margin-top: 30rpx;
}
.location-img {
width: 150rpx;
height: 120rpx;
margin-bottom: 20rpx;
}
.detailsBar {
text-align: center;
padding: 0 50rpx;
box-sizing: border-box;
margin-top: 60rpx;
margin-bottom: 40rpx;
}
.detailsBar image {
width: 100%;
}
.detailsBar .detailsCode-text {
margin-bottom: 10px;
color: #000;
}

40
pages/frozen/frozen.js Normal file
View File

@@ -0,0 +1,40 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
type : '', //类型
frozenData : [], //数组列表
blockeds : '', //待发放金额
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
type : options.type,
blockeds : options.blockeds
})
// 获取冻结列表
this.frozenInfo()
},
/**
* 冻结列表
*/
frozenInfo() {
wx.$api.user.ungrants(this.data.type).then(res=>{
this.setData({
frozenData: res.data
})
})
}
})

4
pages/frozen/frozen.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "待发放"
}

28
pages/frozen/frozen.wxml Normal file
View File

@@ -0,0 +1,28 @@
<!-- 分期 -->
<view class="frozenTop">
<view class="frozenTop-text">
<view class="frozenTop-name">待发放(额度)</view>
<view class="frozenTop-number">{{blockeds}}</view>
</view>
<view class="frozenTop-tips"><image src="/static/img/grant_icon.png"></image>待发放期数详情</view>
<view class="frozenTop-btn">共 {{frozenData.length}} 期</view>
</view>
<view class="frozenCont" wx:if="{{frozenData.length > 0}}">
<view class="frozenTitle uni-border-bottom">分期</view>
<view class="frozenList uni-border-bottom" wx:for="{{frozenData}}" wx:key="frozenData">
<view class="frozenList-left">
<view class="frozenList-name"><image src="/static/img/frozen_time.png"></image>第{{item.num}}期</view>
<view class="frozenList-time">发放时间:{{item.start_at}}</view>
</view>
<view class="frozenList-number">
<view class="frozenList-yellow">+{{item.variable}}</view>
<view class="frozenList-variable">发放额度</view>
</view>
</view>
</view>
<!-- 暂无内容 -->
<view class="pack-center pages-hint" wx:else>
<image src="https://storage.funnyzhibo.com/images/2020/05/06/staff_null.png"></image>
<view>抱歉,目前暂无内容~</view>
</view>

101
pages/frozen/frozen.wxss Normal file
View File

@@ -0,0 +1,101 @@
/* 待发放 */
.frozenTop {
background: #3e3c37;
color: #e7e4d5;
margin: 20rpx;
padding: 40rpx;
box-sizing: border-box;
border-radius: 20rpx;
font-size: 34rpx;
position: relative;
overflow: hidden;
}
.frozenTop-number {
font-size: 40rpx;
font-weight: 600;
margin-top: 30rpx;
}
.frozenTop-tips {
position: absolute;
top: 0;
right: 0;
background: #030200;
color: #fff;
font-size: 28rpx;
padding: 12rpx 20rpx;
border-radius: 0 0 20rpx 20rpx;
display: flex;
}
.frozenTop-tips image {
width: 30rpx;
height: 30rpx;
margin: 4rpx 10rpx 0 0;
}
.frozenTop-btn {
position: absolute;
top: 110rpx;
right: 40rpx;
background: #dab684;
color: #fff;
font-size: 28rpx;
border-radius: 80rpx;
padding: 8rpx 30rpx;
}
.frozenCont {
background-color: #fff;
margin: 30rpx 20rpx;
border-radius: 20rpx;
font-size: 36rpx;
}
.frozenTitle {
padding: 20rpx;
box-sizing: border-box;
color: #9c9c9c;
}
.frozenList {
padding: 20rpx;
display: flex;
font-size: 32rpx;
}
.frozenList-left {
flex: 1;
line-height: 50rpx;
}
.frozenList-number {
line-height: 50rpx;
text-align: center;
}
.frozenList-name {
display: flex;
}
.frozenList-name image {
width: 32rpx;
height: 32rpx;
margin: 10rpx 10rpx 0 0;
}
.frozenList-time {
padding-left: 40rpx;
}
.frozenList-variable,
.frozenList-time {
font-size: 26rpx;
color: #aaaaaa;
}
.frozenList-yellow {
color: #317afa;
font-weight: 600;
}

240
pages/index/index.js Normal file
View File

@@ -0,0 +1,240 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
swiperCurrent :0,
current :0, //轮播图当前的下标
dots :true,
cityAll : '',
statusBarHeight : getApp().globalData.systInfo.statusBarHeight,
longitude : 0, //经度
latitude : 0, //纬度
adverts : [], //轮播图
stateType : "silver",
cardArr : [], //权益数组
activities : [], //周五福利
isUser : false, //用户登录状态
noticeData : '', //首页公告
loading : true, //骨架屏加载
address : {
city: "", //市
area: "", //区
city_code: "", //市编号
area_code: "" //区编号
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
this.locaTion()
// 获取用户登录状态
this.setData({
isUser : getApp().globalData.isUser
})
},
/**
* 获取位置
*/
locaTion(){
wx.getLocation({
success: res => {
this.setData({
latitude    : res.latitude,
                    longitude   : res.longitude
                })
},
complete: () => {
// 获取卡权益
this.indexInfo();
}
})
},
/**
* 卡权益
*/
indexInfo() {
if(this.data.stateType == 'shaky') {
wx.$api.index.index(this.data.city, this.data.longitude, this.data.latitude).then(res=>{
this.setData({
adverts : res.data.adverts,
cardArr : res.data.rights,
activities : res.data.activities,
noticeData : res.data.notice,
loading : false,
address : {
city: res.data.location.city_name,
area: res.data.location.district_name || "",
city_code: res.data.location.city_id,
area_code: res.data.location.district_id || ""
}
})
wx.stopPullDownRefresh()
}).catch(err=>{
if(!err.login){
// 写入缓存
wx.setStorage({
key : 'token',
data : ''
})
}
})
} else {
wx.$api.index.choice(this.data.stateType,this.data.city, this.data.longitude, this.data.latitude).then(res=>{
this.setData({
adverts : res.data.adverts,
cardArr : res.data.categorys,
noticeData : res.data.notice,
cityName : res.data.city_name,
loading : false,
address : {
city: res.data.location.city_name,
area: res.data.location.district_name || "",
city_code: res.data.location.city_id,
area_code: res.data.location.district_id || ""
}
})
wx.stopPullDownRefresh()
}).catch(err=>{
if(!err.login){
// 写入缓存
wx.setStorage({
key : 'token',
data : ''
})
}
})
}
},
/**
* tabs
*/
orderTab(e){
if(this.data.stateType != e.currentTarget.dataset.state){
this.setData({
stateType: e.currentTarget.dataset.state
})
// 获取卡权益
this.indexInfo()
// 重置轮播图
this.setData({
current : 0,
swiperCurrent: 0
});
}
},
/**
* 处理未登录时的转跳
*/
userNav(e){
let id = e.currentTarget.dataset.id
wx.getStorage({
key : 'token',
success:res=>{
wx.navigateTo({
url: '/pages/classify/classify?id=' + id
})
},
fail: (err) => {
wx.navigateTo({
url: "/pages/login/login"
})
}
})
},
/**
* 点击图片放大
*/
clickImg(e) {
if(e.currentTarget.dataset.img == "") return
let imgUrl = [e.currentTarget.dataset.img]
wx.previewImage({
urls : imgUrl, //需要预览的图片http链接列表注意是数组
current : imgUrl[0] // 当前显示图片的http链接默认是第一个
})
},
/**
* 周五福利抢购
*/
Snapup(e) {
let canBuy = e.currentTarget.dataset.can,
canText = e.currentTarget.dataset.text,
canId = e.currentTarget.dataset.id
if(!canBuy) {
wx.showToast({
title : canText,
icon : 'none',
duration: 2000
})
return
}
// 跳转分类页
wx.navigateTo({
url: '/pages/welfare/welfare?id=' + canId
})
},
/**
* 活动中心权益跳转详情
*/
rightNav(e) {
let id = e.currentTarget.dataset.id
wx.getStorage({
key : 'token',
success:res=>{
wx.navigateTo({
url: '/pages/rights/rights?id=' + id
})
},
fail: (err) => {
wx.navigateTo({
url: "/pages/login/login"
})
}
})
},
/**
* 下拉刷新
*/
onPullDownRefresh(){
// 获取卡权益
this.indexInfo();
this.locaTion();
},
/**
* 防止swiper控件卡死
*/
swiperChange(e){
if (this.data.current == 0 && this.data.swiperCurrent>1 ) {//卡死时重置current为正确索引
this.setData({ current: this.data.swiperCurrent });
}
else {//正常轮转时,记录正确页码索引
this.setData({ swiperCurrent: e.detail.current });
}
}
})

10
pages/index/index.json Normal file
View File

@@ -0,0 +1,10 @@
{
"usingComponents": {},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#000000",
"backgroundColor": "#f4f4f4",
"navigationBarTextStyle": "white",
"navigationStyle" : "custom",
"backgroundTextStyle" : "dark",
"enablePullDownRefresh" : true
}

View File

@@ -0,0 +1,95 @@
<!--
此文件为开发者工具生成,生成时间: 2021/4/22 下午3:55:40
使用方法:
在 H:\工作项目\亿时代-本时生活-2021-04-13\本时生活\pages\index\index.wxml 引入模板
```
<import src="index.skeleton.wxml"/>
<template is="skeleton" wx-if="{{loading}}" />
```
在 H:\工作项目\亿时代-本时生活-2021-04-13\本时生活\pages\index\index.wxss 中引入样式
```
@import "./index.skeleton.wxss";
```
更多详细信息可以参考文档https://developers.weixin.qq.com/miniprogram/dev/devtools/skeleton.html
-->
<template name="skeleton">
<view class="sk-container">
<view class="locationPicker" style="padding-top:44px;">
<image class="locationPicker-icon sk-image"></image>
<navigator class="cityCont" hover-class="none">
<view class="nowrap sk-transparent">
<text class="sk-transparent sk-text-30-0000-789 sk-text">哈尔滨市</text>南岗区
</view>
<image class="sk-image"></image>
</navigator>
</view>
<view class="indexTab" style="top:84px;">
<view class="indexTab-lable active sk-transparent sk-image" data-state="shaky">活动中心
</view>
<view class="indexTab-lable sk-transparent sk-text-32-2222-11 sk-text" data-state="silver" style="background-position-x: 50%;">白金会员
</view>
<view class="indexTab-lable sk-transparent sk-text-32-2222-270 sk-text" data-state="drill" style="background-position-x: 50%;">钻石会员
</view>
</view>
<view class="indexTop" style="padding-top:124px;">
<view class="indexBanner sk-pseudo sk-pseudo-circle">
<view class="banner">
<swiper autoplay="false" class="banner-swiper" current="0" interval="3000">
<swiper-item style="position: absolute; width: 100%; height: 100%; transform: translate(0%, 0px) translateZ(0px);">
<image class="banner-img sk-image" data-img="true" data-index="0" mode="aspectFill" show-menu-by-longpress="true"></image>
<i class="light"></i>
</swiper-item>
</swiper>
</view>
</view>
<view class="dots">
<view class="active"></view>
</view>
<view class="indexNews">
<image class="sk-image"></image>
<view class="marquee_container" style="--marqueeWidth--:-30em">
<view class="marquee_text sk-transparent sk-text-14-2857-898 sk-text">您的预约已成功,请点击继续办理</view>
</view>
</view>
<view class="cardArr">
<view class="cardArr-top">
<view class="legalTips">
<image class="sk-image"></image>
<text class="sk-transparent sk-text-14-2857-980 sk-text" style="background-position-x: 50%;">抱歉, 此地区暂无权益</text>
</view>
</view>
<view class="Welfare">
<view class="WelfareTitle">
<text class="sk-transparent sk-image">周五会员福利日</text>
</view>
<view class="WelfareList sk-pseudo sk-pseudo-circle">
<view class="WelfareList-back" data-can="true" data-id="1" data-text="可购买">
<image class="WelfareList-img sk-image"></image>
<view class="WelfareList-left">
<view class="cell">
<view class="WelfareList-left-price sk-transparent">15
<text class="sk-transparent sk-text-14-2857-662 sk-text" style="background-position-x: 50%;"> 元</text>
</view>
<view class="WelfareList-left-title sk-transparent sk-text-14-2857-553 sk-text" style="background-position-x: 50%;">全车型洗车券</view>
</view>
</view>
<view class="WelfareList-right">
<view class="WelfareList-cont">
<view class="nowrap WelfareList-title sk-transparent sk-text-13-6364-777 sk-text">每周五:</view>
<view class="nowrap WelfareList-text sk-transparent sk-text-13-6364-28 sk-text">08:00:00 开抢</view>
<view class="nowrap WelfareList-all sk-transparent sk-text-22-7273-273 sk-text">[限量100份] [剩余97份]</view>
</view>
</view>
<view class="WelfareList-btn sk-pseudo sk-pseudo-circle">
<text class="sk-transparent sk-image">抢</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>

View File

@@ -0,0 +1,94 @@
/*
此文件为开发者工具生成,生成时间: 2021/4/22 下午3:55:40
在 H:\工作项目\亿时代-本时生活-2021-04-13\本时生活\pages\index\index.wxss 中引入样式
```
@import "./index.skeleton.wxss";
```
更多详细信息可以参考文档https://developers.weixin.qq.com/miniprogram/dev/devtools/skeleton.html
*/
.sk-transparent {
color: transparent !important;
}
.sk-text-30-0000-789 {
background-image: linear-gradient(transparent 30.0000%, #EEEEEE 0%, #EEEEEE 70.0000%, transparent 0%) !important;
background-size: 100% 80.0000rpx;
position: relative !important;
}
.sk-text {
background-origin: content-box !important;
background-clip: content-box !important;
background-color: transparent !important;
color: transparent !important;
background-repeat: repeat-y !important;
}
.sk-text-32-2222-11 {
background-image: linear-gradient(transparent 32.2222%, #EEEEEE 0%, #EEEEEE 67.7778%, transparent 0%) !important;
background-size: 100% 90.0000rpx;
position: relative !important;
}
.sk-text-32-2222-270 {
background-image: linear-gradient(transparent 32.2222%, #EEEEEE 0%, #EEEEEE 67.7778%, transparent 0%) !important;
background-size: 100% 90.0000rpx;
position: relative !important;
}
.sk-text-14-2857-898 {
background-image: linear-gradient(transparent 14.2857%, #EEEEEE 0%, #EEEEEE 85.7143%, transparent 0%) !important;
background-size: 100% 39.2000rpx;
position: relative !important;
}
.sk-text-14-2857-980 {
background-image: linear-gradient(transparent 14.2857%, #EEEEEE 0%, #EEEEEE 85.7143%, transparent 0%) !important;
background-size: 100% 39.2000rpx;
position: relative !important;
}
.sk-text-14-2857-662 {
background-image: linear-gradient(transparent 14.2857%, #EEEEEE 0%, #EEEEEE 85.7143%, transparent 0%) !important;
background-size: 100% 39.2000rpx;
position: relative !important;
}
.sk-text-14-2857-553 {
background-image: linear-gradient(transparent 14.2857%, #EEEEEE 0%, #EEEEEE 85.7143%, transparent 0%) !important;
background-size: 100% 39.2000rpx;
position: relative !important;
}
.sk-text-13-6364-777 {
background-image: linear-gradient(transparent 13.6364%, #EEEEEE 0%, #EEEEEE 86.3636%, transparent 0%) !important;
background-size: 100% 44.0000rpx;
position: relative !important;
}
.sk-text-13-6364-28 {
background-image: linear-gradient(transparent 13.6364%, #EEEEEE 0%, #EEEEEE 86.3636%, transparent 0%) !important;
background-size: 100% 44.0000rpx;
position: relative !important;
}
.sk-text-22-7273-273 {
background-image: linear-gradient(transparent 22.7273%, #EEEEEE 0%, #EEEEEE 77.2727%, transparent 0%) !important;
background-size: 100% 44.0000rpx;
position: relative !important;
}
.sk-image {
background: #EFEFEF !important;
}
.sk-pseudo::before, .sk-pseudo::after {
background: #EFEFEF !important;
background-image: none !important;
color: transparent !important;
border-color: transparent !important;
}
.sk-pseudo-rect::before, .sk-pseudo-rect::after {
border-radius: 0 !important;
}
.sk-pseudo-circle::before, .sk-pseudo-circle::after {
border-radius: 50% !important;
}
.sk-container {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: transparent;
}

142
pages/index/index.wxml Normal file
View File

@@ -0,0 +1,142 @@
<import src="index.skeleton.wxml" />
<template is="skeleton" wx-if="{{loading}}" />
<block wx:if="{{!loading}}">
<!-- 定位 -->
<view class="locationPicker" style="padding-top:{{statusBarHeight}}px;">
<image class="locationPicker-icon" src="/static/icon/indexSite.png"></image>
<navigator url="/pages/switchcity/switchcity?city_code={{address.city_code}}&area_code={{address.area_code}}&city={{address.city}}&area={{address.area}}" hover-class="none" class="cityCont">
<view class="nowrap">
<text>{{address.city}}{{address.area}}</text>
</view>
<image src="/static/img/arrow.png"></image>
</navigator>
</view>
<!-- 首页 -->
<view class="indexTab" style="top:{{statusBarHeight + 40}}px;">
<view class="indexTab-lable {{stateType == 'shaky' ? 'active':''}}" data-state="shaky" bindtap="orderTab">活动中心
</view>
<view class="indexTab-lable {{stateType == 'silver' ? 'active':''}}" data-state="silver" bindtap="orderTab">白金会员
</view>
<view class="indexTab-lable {{stateType == 'drill' ? 'active':''}}" data-state="drill" bindtap="orderTab">钻石会员
</view>
</view>
<view class="indexTop" style="padding-top:{{statusBarHeight + 80}}px;">
<!-- 卡片轮播 -->
<view class="indexBanner">
<view class="banner">
<swiper class="banner-swiper" interval="3000" autoplay bindchange="monitorCurrent" current="{{current}}">
<swiper-item wx:for="{{adverts}}" wx:key="adverts">
<image class="banner-img" src="{{item.cover}}" show-menu-by-longpress="true" mode="aspectFill"
bindtap="clickImg" data-img="{{item.qrcode}}" data-index="{{index}}">
</image>
<i class="light"></i>
</swiper-item>
</swiper>
<swiper class="banner-swiper" interval="3000" autoplay circular current="{{current}}" bindchange="swiperChange">
<swiper-item wx:for="{{adverts}}" wx:key="adverts" bindtap="navigato" data-url="{{item.url}}">
<image class="banner-img" src="{{item.cover}}" show-menu-by-longpress="true" mode="aspectFill"
bindtap="clickImg" data-img="{{item.qrcode}}" data-index="{{index}}">
</image>
<i class="light"></i>
</swiper-item>
</swiper>
</view>
</view>
<!-- 自定义轮播图进度点 -->
<view class="dots">
<block wx:for="{{adverts}}" wx:key="cardBanner">
<view class='{{index == swiperCurrent ? "active":""}}'></view>
</block>
</view>
<!-- 公告 -->
<view class="indexNews">
<image src="/static/icon/news_icon.png"></image>
<view class="marquee_container" style="--marqueeWidth--:-30em">
<view class="marquee_text {{ noticeData.length > 20 ? 'active' : ''}}">{{noticeData}}</view>
</view>
</view>
<!-- 活动中心-权益列表 -->
<view class="cardArr" wx:if="{{stateType == 'shaky'}}">
<view class="cardArr-top">
<block wx:if="{{cardArr.length > 0}}">
<view bindtap="rightNav" wx:for="{{cardArr}}" wx:key="cardArr" class="indexCard"
data-id="{{item.right_config_id}}">
<image class="indexCard-img" src="{{item.cover}}"></image>
<view class="nowrap indexCard-title">{{item.title}}</view>
<view class="nowrap activity-remark" wx:if="{{item.subtitle != null}}">
<text class="nowrap">{{item.subtitle}}</text>
</view>
<view class="activity-tips" wx:if="{{item.label}}">{{item.label}}</view>
</view>
</block>
<block wx:else>
<view class="legalTips">
<image src="/static/img/legal_tips.png"></image>
<text>抱歉, 此地区暂无权益</text>
</view>
</block>
</view>
<!-- 福利日 -->
<view class="Welfare" wx:if="{{activities.length > 0}}">
<view class="WelfareTitle"><text>周五会员福利日</text></view>
<view class="WelfareList">
<view class="WelfareList-back" bindtap="Snapup" wx:for="{{activities}}" wx:key="activities"
data-text="{{item.code_text}}" data-can="{{item.canBuy}}" data-id="{{item.welfare_id}}">
<image class="WelfareList-img {{item.surplus == 0 ? 'active' : ''}}"
src="/static/img/welfare_back.png"></image>
<view class="WelfareList-left">
<view class="cell">
<view class="WelfareList-left-price">{{item.price}}<text> 元</text></view>
<view class="WelfareList-left-title">{{item.title}}</view>
</view>
</view>
<view class="WelfareList-right">
<view class="WelfareList-cont">
<view class="nowrap WelfareList-title">每周五:</view>
<view class="nowrap WelfareList-text">{{item.start_time}} 开抢</view>
<view class="nowrap WelfareList-text">{{item.end_time}} 结束</view>
<view class="nowrap WelfareList-all">[限量{{item.stock}}份] [剩余{{item.surplus}}份]</view>
</view>
</view>
<view class="WelfareList-btn {{item.surplus == 0 ? 'active' : ''}}">
<text>抢</text>
</view>
</view>
</view>
</view>
</view>
<!-- 白金会员&钻石会员-权益列表 -->
<view class="cardArr" wx:else>
<view class="cardArr-top">
<block wx:if="{{cardArr.length > 0}}">
<!-- <view bindtap="userNav" wx:for="{{cardArr}}" wx:key="cardArr" class="indexCard" data-id="{{item.id}}"
data-type="{{item.get_type}}"> -->
<view bindtap="userNav" data-id="{{item.category_id}}" wx:for="{{cardArr}}" wx:key="cardArr"
class="indexCard">
<image class="indexCard-img" src="{{item.cover}}"></image>
<view class="nowrap indexCard-title">{{item.title}}</view>
<view class="nowrap indexCard-remark" wx:if="{{item.description != null}}">{{item.description}}
</view>
<view class="activity-tips indexCard-tips" wx:if="{{item.label != ''}}">{{item.label}}</view>
</view>
</block>
<block wx:else>
<view class="legalTips">
<image src="/static/img/legal_tips.png"></image>
<text>抱歉, 此地区暂无权益</text>
</view>
</block>
</view>
</view>
</view>
</block>

544
pages/index/index.wxss Normal file
View File

@@ -0,0 +1,544 @@
/* 首页 */
page {
background: #fff;
}
.indexTab {
position: fixed;
display: flex;
width: 100%;
height: 90rpx;
line-height: 90rpx;
z-index: 999;
padding: 0 40rpx;
top: 80rpx;
box-sizing: border-box;
background-color: #07081d;
}
.indexTab-lable {
text-align: center;
flex: 3;
color: #fff;
position: relative;
}
.indexTab-lable.active {
background-image: -webkit-linear-gradient(left, #e4dab7, #d9b672);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-weight: 600;
font-size: 38rpx;
}
/* 轮播图 */
.indexBanner {
height: 360rpx;
position: relative;
padding-top: 20rpx;
}
.indexBanner::after {
position: absolute;
left: 0;
top: 0;
height: 240rpx;
width: 100%;
content: '';
background: #07081d;
border-radius: 0 0 200rpx 200rpx;
}
.banner {
position: relative;
padding-top: 48%;
width: calc(100% - 100rpx);
background: white;
margin: 0 50rpx;
border-radius: 30rpx;
overflow: hidden;
z-index: 99;
}
.banner-swiper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.banner-img {
width: 100%;
height: 100%;
vertical-align: top;
}
/* 指示点 */
.dots {
margin: 30rpx 0;
display: flex;
justify-content: center;
align-items: center;
width: 100%;
}
.dots view {
width: 14rpx;
height: 14rpx;
margin: 0 6rpx;
border-radius: 50%;
background-color: #c5c5c5;
}
.dots .active {
width: 24rpx;
border-radius: 40rpx;
background-color: #f46851;
}
/* 提示 */
.indexNews {
background: #dddddd;
padding: 25rpx 40rpx;
display: flex;
font-size: 28rpx;
}
.indexNews image {
width: 34rpx;
height: 34rpx;
margin: 4rpx 20rpx 0 0;
}
/* 权益列表 */
.cardArr {
padding: 40rpx 30rpx 30rpx;
box-sizing: border-box;
overflow: hidden;
}
.cardArr-top {
flex-wrap: wrap;
display: flex;
}
.indexCard {
width: 33.33%;
text-align: center;
position: relative;
flex: 0 0 33.3333%;
margin-bottom: 40rpx;
}
.indexCard-img {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
}
.activity-tips {
position: absolute;
top: -10rpx;
right: 10rpx;
z-index: 9;
background-image: -webkit-linear-gradient(left, #ff0000, #ff0000);
color: #fff;
font-size: 24rpx;
padding: 0 18rpx;
height: 40rpx;
line-height: 40rpx;
border-radius: 20rpx;
animation: zy 2.5s .15s linear infinite;
-moz-animation: zy 2.5s .15s linear infinite;
-webkit-animation: zy 2.5s .15s linear infinite;
-o-animation: zy 2.5s .15s linear infinite;
}
.indexCard-tips {
background-image: -webkit-linear-gradient(left, #ef354c, #ef001e);
color: #fff300;
height: 34rpx;
line-height: 32rpx;
padding: 0 10rpx;
right: 25rpx;
}
@keyframes zy {
10% {
transform: rotate(15deg);
}
20% {
transform: rotate(-10deg);
}
30% {
transform: rotate(5deg);
}
40% {
transform: rotate(-5deg);
}
50%,
100% {
transform: rotate(0deg);
}
}
.indexCard-title {
font-weight: 600;
margin: 5rpx 20rpx;
font-size: 30rpx;
}
.indexCard-remark {
font-size: 26rpx;
color: #8a8a8a;
}
/* 新增活动权利列表样式 */
.activity-remark {
background-color: #000000;
display: inline-block;
border-radius: 40rpx;
height: 38rpx;
line-height: 38rpx;
padding: 0 10rpx;
}
.activity-remark text {
display: block;
background-image: -webkit-linear-gradient(left, #e4dab7, #d9b672);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 22rpx;
}
/* 定位 */
.locationPicker {
background: #000;
color: #fff;
height: 80rpx;
line-height: 80rpx;
position: fixed;
width: 100%;
z-index: 1009;
top: 0;
left: 0;
}
.locationPicker-icon {
width: 38rpx;
height: 38rpx;
float: left;
vertical-align: middle;
margin: 22rpx 10rpx 0 20rpx;
}
.locationPicker-region-icon {
width: 44rpx;
height: 44rpx;
margin-top: 12rpx;
}
.cityCont {
width: 60%;
display: flex;
}
.cityCont view {
max-width: calc(100% - 50rpx);
}
.cityCont image {
width: 50rpx;
height: 50rpx;
margin-top: 16rpx;
}
/* 权益提示 */
.legalTips {
text-align: center;
font-size: 28rpx;
color: #999;
padding: 80rpx;
margin: 0 auto;
}
.legalTips image {
width: 240rpx;
height: 180rpx;
display: block;
margin: 0 auto 40rpx;
}
/* 滚动 */
/*首页跑马灯效果*/
@keyframes around {
from {
margin-left: 60rpx;
}
to {
/* var接受传入的变量 */
margin-left: var(--marqueeWidth--);
}
}
.marquee_container {
width: calc(100% - 40rpx);
overflow: hidden;
}
.marquee_container:hover {
/* 不起作用 */
animation-play-state: paused;
}
.marquee_text {
font-size: 28rpx;
display: inline-block;
white-space: nowrap;
}
.marquee_text.active {
animation-name: around;
animation-duration: 20s;
/*过渡时间*/
animation-iteration-count: infinite;
animation-timing-function: linear;
}
/* 福利日 */
.Welfare {
text-align: center;
}
.WelfareTitle {
display: inline-block;
background-color: #020202;
border-radius: 20rpx 20rpx 10rpx 10rpx;
height: 68rpx;
line-height: 68rpx;
padding: 0 50rpx;
}
.WelfareTitle text,
.WelfareList-btn text {
background-image: -webkit-linear-gradient(left, #e4dab7, #d9b672);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.WelfareTitle text {
font-weight: 600;
font-size: 38rpx;
}
.WelfareList {
background-color: #020202;
border-radius: 20rpx;
padding: 40rpx 30rpx;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
.WelfareList::after {
position: absolute;
content: '';
top: -60rpx;
right: 0;
background-image: -moz-linear-gradient(right, rgba(255, 255, 255, .2), rgba(0, 0, 0, 0));
background-image: -webkit-linear-gradient(right, rgba(255, 255, 255, .2), rgba(0, 0, 0, 0));
background-image: linear-gradient(right, rgba(255, 255, 255, .2), rgba(0, 0, 0, 0));
width: 200rpx;
height: 200rpx;
border-radius: 50%;
}
.WelfareList-back {
position: relative;
width: 100%;
height: 220rpx;
padding: 30rpx;
box-sizing: border-box;
margin-bottom: 40rpx;
}
.WelfareList-back:last-child {
margin: 0;
}
.WelfareList-img {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.WelfareList-img.active {
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray;
}
.WelfareList-left,
.WelfareList-right,
.WelfareList-btn {
position: absolute;
z-index: 2;
left: 0;
}
.WelfareList-left {
top: -4rpx;
width: 180rpx;
font-weight: 600;
display:table;
height: 226rpx;
}
.cell {
display:table-cell;
vertical-align:middle;
}
.WelfareList-left-title {
font-size: 28rpx;
word-break:normal;
padding: 0 30rpx;
box-sizing: border-box;
}
.WelfareList-left .WelfareList-left-price {
font-size: 40rpx;
}
.WelfareList-left text {
font-size: 28rpx;
font-weight: 600;
}
.WelfareList-right {
line-height: 44rpx;
width: 100%;
padding-left: 200rpx;
padding-right: 160rpx;
box-sizing: border-box;
text-align: left;
display: flex;
}
.WelfareList-cont {
width: 100%;
margin-top: -8rpx;
}
.WelfareList-btn {
left: auto;
top: 55rpx;
right: 30rpx;
background-color: #020202;
width: 110rpx;
height: 110rpx;
text-align: center;
line-height: 110rpx;
border-radius: 50%;
overflow: hidden;
}
.WelfareList-btn::after {
position: absolute;
content: '';
top: -50rpx;
left: 0;
background-image: -moz-linear-gradient(right, rgba(255, 255, 255, .25), rgba(0, 0, 0, 0));
background-image: -webkit-linear-gradient(right, rgba(255, 255, 255, .25), rgba(0, 0, 0, 0));
background-image: linear-gradient(right, rgba(255, 255, 255, .25), rgba(0, 0, 0, 0));
width: 100rpx;
height: 100rpx;
border-radius: 50%;
}
.WelfareList-btn.active {
background-color: #9c9c9c;
}
.WelfareList-btn.active::before {
position: absolute;
content: '';
width: 100%;
height: 4rpx;
background-color: #cecece;
left: 0;
top: 50%;
transform:rotate(45deg);
}
.WelfareList-btn.active text {
background-image: -moz-linear-gradient(#c3c3c3);
background-image: -webkit-linear-gradient(#c3c3c3);
background-image: linear-gradient(#c3c3c3);
-webkit-text-fill-color: #c3c3c3;
}
.WelfareList-btn text {
font-weight: 600;
font-size: 54rpx;
}
.WelfareList-all {
font-size: 24rpx;
}
.WelfareList-text {
font-size: 28rpx;
}
.light {
cursor: pointer;
position: absolute;
left: -100%;
top: 0;
width: 40px;
height: 100%;
background: rgba(255, 255, 255, 0);
transform: skewx(25deg);
-webkit-transition: all .5s ease-in;
-moz-transition: all .5s ease-in;
-o-transition: all .5s ease-in;
transition: all .5s ease-in;
animation-name: example;
animation-duration: 3.5s;
animation-iteration-count: infinite;
}
@keyframes example {
0% {
left: -100%;
background: rgba(255, 255, 255, .4);
}
50% {
left: -50%;
background: rgba(255, 255, 255, .7);
}
100% {
left: 100%;
background: rgba(255, 255, 255, 0);
}
}

124
pages/login/login.js Normal file
View File

@@ -0,0 +1,124 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
isLogin : false,
loginCode : "", //code
userInfo : {}, //用户
iv : '',
encryptedData : '',
way : '' //登录方式-活动
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 登录方式-活动
this.setData({
way : options.way
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow () {
wx.login({
success: res => {
this.setData({
loginCode: res.code
})
}
})
},
/**
* 登录
*/
userInfo(e){
if(e.detail.errMsg == "getUserInfo:ok"){
this.setData({
isLogin : true,
userInfo : e.detail.rawData,
iv : e.detail.iv,
encryptedData : e.detail.encryptedData
})
// 检查用户登录Code是否过期
wx.checkSession({
success: res=>{
this.userLogin()
},
fail: err=>{
// 登录过期重新获取code
wx.login({
success: res=>{
this.setData({
loginCode: res.code
})
// 登录
this.userLogin()
}
})
}
})
}else{
wx.showToast({
title: '拒绝了登录授权',
icon : 'none'
})
}
},
/**
* 用户登录
*/
userLogin(){
let code = this.data.loginCode,
iv = this.data.iv,
encryptedData = this.data.encryptedData
wx.$api.enroll.record(code, iv, encryptedData).then(res=>{
getApp().globalData.token = res.data.token
// 更新全局存储器用户状态
getApp().globalData.isUser = true
// 写入缓存
wx.setStorage({
key : 'token',
data : res.data.token
})
// 存入缓存
app.globalData.userInfo = res.data.users
app.globalData.wechatUser = res.data.wechatUser_id
this.setData({
isLogin: false
})
wx.navigateTo({
url: "/pages/chooseTel/chooseTel?way=" + this.data.way
})
// 写入缓存
wx.setStorage({
key : 'users',
data : res.data.users
})
})
}
})

6
pages/login/login.json Normal file
View File

@@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarTitleText": "微信授权",
"navigationBarBackgroundColor": "#000000",
"navigationBarTextStyle": "white"
}

5
pages/login/login.wxml Normal file
View File

@@ -0,0 +1,5 @@
<!-- 微信授权 -->
<view class="loginImg">
<image src="/static/img/login_img.png" mode="widthFix"></image>
</view>
<button class="loginBtn" size="mini" hover-class="none" open-type="getUserInfo" bindgetuserinfo="userInfo" lang="zh_CN" disabled="{{isLogin}}">用户授权</button>

36
pages/login/login.wxss Normal file
View File

@@ -0,0 +1,36 @@
/* 登录 */
page {
background: #000;
}
.loginImg {
position: relative;
height: 100vh;
width: 100%;
}
.loginImg image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.loginBtn[size="mini"]{
background: #33f800;
color: #000;
width: 240rpx;
height: 86rpx;
line-height: 76rpx;
border-radius: 30rpx;
position: absolute;
bottom: 5vh;
left: calc(50% - 120rpx);
padding: 0;
margin: 0;
border: 4rpx solid #fff;
box-sizing: border-box;
font-size: 36rpx;
}

187
pages/order/order.js Normal file
View File

@@ -0,0 +1,187 @@
// pages/activityOrder/activityOrder.js
Page({
/**
* 页面的初始数据
*/
data: {
stateType : 'all', //状态
counts : '', //数量
orderArr : [], //列表
page : {}, //下一页
lodingStats : false, //加载状态
pay : {
payTips : 1, //支付方式
payState : false, //支付状态
orderId : '', //支付订单
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
this.setData({
stateType: options.stateType
})
},
onShow() {
// 获取商品活动订单
this.orderInfo();
},
/**
* 商品活动订单
*/
orderInfo(page) {
wx.$api.exchange.index(this.data.stateType, page).then(res=>{
let listArr = this.data.orderArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
counts : res.data.count,
orderArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
})
},
/**
* tabs
*/
orderTab(e){
if(this.data.stateType != e.currentTarget.dataset.state){
this.setData({
stateType: e.currentTarget.dataset.state
})
// 获取商品活动订单
this.orderInfo()
wx.pageScrollTo({
scrollTop: 0
})
}
},
/**
* 取消订单
*/
orderDelete(e) {
let orderId = e.currentTarget.dataset.id
wx.showModal({
title : '订单取消',
content : '确认取消吗?',
success : res=> {
if (res.confirm) {
wx.$api.exchange.cancel(orderId).then(res=>{
// 获取商品活动订单
this.orderInfo()
wx.showToast({
title: res.data,
icon : 'none'
})
})
} else if (res.cancel) {
wx.showToast({
title : '取消',
icon : 'loading',
duration: 1000
})
}
}
})
},
/**
* 支付提交
*/
orderPay() {
wx.$api.exchange.payments(this.data.pay.orderId).then(res=>{
// payTips为1的时候为微信支付
if(this.data.pay.payTips == 1) {
wx.$api.index.wechat(res.data.trade_no).then(res=>{
let payInfo = JSON.parse(res.data)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/coupon/coupon?type=couponPublic'
})
},2000)
}
},
fail : res=>{
wx.redirectTo({
url: '/pages/order/order?stateType=unpay'
})
}
})
})
}
// payTips为2的时候为沃钱包支付
if(this.data.pay.payTips == 2) {
const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no
let url= encodeURIComponent(newUrl)
wx.navigateTo({
// 跳转到webview页面
url: `/pages/webView/webView?url=${url}`
});
}
this.setData({
['pay.payState']: false
})
})
},
/**
* 支付选择弹出
*/
submitPay(e) {
this.setData({
['pay.payState']: !this.data.pay.payState,
['pay.orderId'] : e.currentTarget.dataset.id
})
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
this.orderInfo(pageNumber)
}
},
/**
* 选择支付方式
*/
radioChange(e) {
this.setData({
['pay.payTips']: e.detail.value
})
}
})

4
pages/order/order.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "兑换订单"
}

94
pages/order/order.wxml Normal file
View File

@@ -0,0 +1,94 @@
<!-- 活动订单 -->
<view class="order-tab">
<view class="order-tab-item {{stateType == 'all' ? 'active':''}}" data-state="all" bindtap="orderTab">
全部
</view>
<view class="order-tab-item {{stateType == 'unpay' ? 'active':''}}" data-state="unpay" bindtap="orderTab">
待支付
<!-- <view class="state-tips" wx:if="{{counts.init != 0}}">{{counts.init}}</view> -->
</view>
<view class="order-tab-item {{stateType == 'paid' ? 'active':''}}" data-state="paid" bindtap="orderTab">
待发货
<!-- <view class="state-tips" wx:if="{{counts.paid != 0}}">{{counts.paid}}</view> -->
</view>
<!-- <view class="order-tab-item {{stateType == 'delivered' ? 'active':''}}" data-state="delivered" bindtap="orderTab">
待签收
<view class="state-tips" wx:if="{{counts.paid != 0}}">{{counts.paid}}</view>
</view> -->
<view class="order-tab-item {{stateType == 'delivered' ? 'active':''}}" data-state="delivered" bindtap="orderTab">
已发货
<!-- <view class="state-tips" wx:if="{{counts.send != 0}}">{{counts.send}}</view> -->
</view>
</view>
<!-- 列表 -->
<view class="order-content" wx:if="{{orderArr != ''}}">
<view class="order-content-li" wx:for="{{orderArr}}" wx:key="orderArr">
<!-- <view class="order-name">
<image src="/static/icon/activity_icon.png"></image>
</view> -->
<view class="uni-border-down order-store">
<view class="order-store-title nowrap">{{item.orderid}}</view>
<view class="order-store-stateText red" wx:if="{{item.state_text == '未支付'}}">{{item.state_text}}</view>
<view class="order-store-stateText green" wx:elif="{{item.state_text == '已支付'}}">{{item.state_text}}</view>
<view class="order-store-stateText" wx:else>{{item.state_text}}</view>
</view>
<view class="order-goods">
<image class="order-goods-cover" src="{{item.items.cover}}" mode="aspectFill"></image>
<view class="order-goods-content">
<view class="order-goods-content-name nowrap">{{item.items.title}}</view>
<view class="orderVirtual {{item.items.type != 'virtual' ? '' : 'active'}}">
<block wx:if="{{item.items.type == 'virtual'}}">红包电子券</block>
<block wx:else>实物券</block>
</view>
<view class="order-goods-content-price nowrap">
<text>¥{{item.items.price}}</text> × {{item.items.qty}}
</view>
</view>
</view>
<view class="uni-border-top order-btns">
<navigator class="order-btn" url="/pages/orderData/orderData?id={{item.orderid}}">订单详情</navigator>
<view class="order-btn" bindtap="orderDelete" data-id="{{item.orderid}}" wx:if="{{item.canCancel == true}}">
取消订单</view>
<view class="order-btn order-btn-back" bindtap="submitPay" data-id="{{item.orderid}}"
wx:if="{{item.canPay == true}}">立即支付</view>
<!-- <view class="order-btn order-btn-back" bindtap="" data-id="{{item.orderid}}" wx:if="{{item.canSign == true}}">待签收</view> -->
</view>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="https://storage.funnyzhibo.com/images/2020/05/06/null_icon.png"></image>
<view>暂无订单</view>
</view>
<view class="payWayBack {{pay.payState ? 'active' : ''}}" bindtap="submitPay"></view>
<view class="payWay {{pay.payState ? 'active' : ''}}">
<view class="payWay-name">请选择支付方式</view>
<radio-group bindchange="radioChange">
<view class="payContList-label">
<view class="payContList-label-name">
<image class="payContList-label-img" src="/static/img/wx.jpg"></image>
微信支付
</view>
<radio class="radio" value="1" checked></radio>
</view>
<view class="payContList-label">
<view class="payContList-label-name">
<image class="payContList-label-img" src="/static/img/wqb.jpg"></image>
沃钱包支付
</view>
<radio class="radio" value="2"></radio>
</view>
</radio-group>
<button class="payWayBtn" bindtap="orderPay">确认</button>
</view>

319
pages/order/order.wxss Normal file
View File

@@ -0,0 +1,319 @@
/*
* 亿时代
*/
.order-tab {
position: fixed;
left: 0;
top: 0;
width: 100%;
display: flex;
height: 80rpx;
line-height: 80rpx;
z-index: 9;
background: white;
}
.order-tab-item {
font-size: 28rpx;
width: 25%;
text-align: center;
border-bottom: solid 2rpx #f7f7f7;
color: #464854;
background: white;
position: relative;
}
.order-tab-item.active {
color: #f57e32;
}
.order-tab-item::after {
content: '';
position: absolute;
width: 30rpx;
height: 4rpx;
background: transparent;
left: calc(50% - 15rpx);
bottom: -2rpx;
}
.order-tab-item.active::after {
background: #f57e32;
}
.state-tips {
position: absolute;
top: 10rpx;
right: 14rpx;
background: #e92706;
color: #fff;
font-size: 24rpx;
transform: scale(.7, .7);
border-radius: 60rpx 60rpx 60rpx 0;
width: 48rpx;
height: 34rpx;
line-height: 34rpx;
}
/* 订单列表 */
.order-content {
padding: 80rpx 0 20rpx 0;
}
.order-content-li {
background: white;
margin-top: 20rpx;
position: relative;
}
.order-name {
background: #fff;
padding: 20rpx;
box-sizing: border-box;
border-bottom: solid 1rpx #f3f3f3;
display: flex;
}
.order-name image {
background: linear-gradient(#000, #000);
background-blend-mode: lighten;
background-size: cover;
width: 26rpx;
height: 26rpx;
border-radius: 50%;
margin: 8rpx 14rpx 0 0;
}
.order-store {
padding: 20rpx;
border-bottom: solid 1rpx #f3f3f3;
display: flex;
}
.order-goods-tips {
display: flex;
}
.order-goods-tips text {
display: inline-block;
background: #e92706;
color: #fff;
border-radius: 20rpx;
padding: 0 20rpx;
height: 42rpx;
line-height: 42rpx;
font-size: 24rpx;
transform: scale(.8, .8);
}
text.order-goods-tips-color {
background: #e6b329;
}
.order-store-stateText {
color: #e6b329;
font-size: 26rpx;
}
.order-store-stateText.red {
color: #e92344;
}
.order-store-stateText.green {
color: #79b300;
}
.order-store-title {
flex: 1;
color: #999;
font-size: 28rpx;
}
.order-store-orderid {
color: #747788;
font-size: 25rpx;
}
.order-store-title text {
color: white;
font-size: 24rpx;
background: #e92344;
margin-right: 10rpx;
padding: 0 10rpx;
}
.order-goods {
padding: 20rpx;
box-sizing: border-box;
position: relative;
}
.order-goods-cover {
width: 150rpx;
height: 150rpx;
vertical-align: top;
border-radius: 4rpx;
}
.order-goods-content {
position: absolute;
left: 190rpx;
top: 20rpx;
right: 20rpx;
width: calc(100% - 210rpx);
}
.order-goods-content-name {
margin-bottom: 10rpx;
font-size: 30rpx;
font-weight: 600;
}
.order-goods-content-price {
color: #747788;
display: flex;
margin-top: 10rpx;
font-size: 28rpx;
}
.order-goods-content-price text {
color: #f57e32;
display: inline-block;
margin-right: 10rpx;
font-size: 30rpx;
}
.order-total {
padding: 20rpx;
box-sizing: border-box;
font-size: 26rpx;
line-height: 50rpx;
color: #747788;
display: flex;
}
.order-total view {
margin-right: 30rpx;
}
.order-total text {
color: #e92344;
font-weight: bold;
}
.order-btns {
font-size: 25rpx;
display: flex;
padding: 20rpx;
box-sizing: border-box;
flex-wrap: wrap;
flex-direction: row-reverse;
}
.order-btn {
margin-left: 20rpx;
height: 52rpx;
line-height: 50rpx;
box-sizing: border-box;
border: solid 1rpx #747788;
padding: 0 20rpx;
border-radius: 30rpx;
}
.order-btn-back {
border-color: #f57e32;
color: #f57e32;
}
.orderVirtual {
background: #f57e32;
color: #fff;
border-radius: 4rpx;
display: inline-block;
font-size: 24rpx;
padding: 2rpx 8rpx
}
.orderVirtual.active {
background: #88be2d;
}
/* 选择支付方式 */
.payWayBack {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .4);
left: 0;
top: 0;
z-index: 98;
display: none;
}
.payWayBack.active {
display: block;
}
.payWay {
position: fixed;
z-index: 99;
left: 0;
bottom: -100%;
width: 100%;
background-color: #fff;
padding: 60rpx 50rpx 120rpx;
box-sizing: border-box;
border-top: 2rpx solid #f0f0f0;
transition: .2s;
}
.payWay.active {
bottom: 0;
}
.payWay-name {
font-weight: 600;
font-size: 30rpx;
margin-bottom: 80rpx;
}
.payContList-label {
display: flex;
margin-bottom: 40rpx;
border-bottom: 2rpx solid #f6f6f6;
padding-bottom: 40rpx;
}
.payContList-label:last-child {
border:none
}
.payContList-label-name {
flex: 1;
font-size: 32rpx;
display: flex;
line-height: 46rpx;
}
.payContList-label-img {
width: 46rpx;
height: 46rpx;
margin-right: 20rpx;
}
radio {
transform:scale(0.8);
}
.payWayBtn {
background: #eacf88;
text-align: center;
line-height: 80rpx !important;
border-radius: 10rpx;
margin-top: 80rpx;
width: 100% !important;
padding: 0;
font-size: 32rpx;
}

View File

@@ -0,0 +1,134 @@
/*
* 本时生活
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
statusHeight : app.globalData.statusBarHeight,
order : '' //订单详情
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 获取商品活动订单详情
this.orderInfo(options.id);
},
/**
* 商品活动订单详情
*/
orderInfo(id) {
wx.$api.exchange.show(id).then(res=>{
this.setData({
order : res.data
})
})
},
/**
* 取消订单
*/
orderDelete(e) {
let orderId = e.currentTarget.dataset.id
wx.showModal({
title : '订单取消',
content : '确认取消吗?',
success : res=> {
if (res.confirm) {
wx.$api.exchange.cancel(orderId).then(res=>{
wx.reLaunch({
url: '/pages/order/order'
})
wx.showToast({
title: res.data,
icon : 'none'
})
})
} else if (res.cancel) {
wx.showToast({
title : '取消',
icon : 'loading',
duration: 1000
})
}
}
})
},
/**
* 支付提交
*/
orderPay(e) {
let orderid = e.currentTarget.dataset.id
wx.$api.exchange.payments(orderid).then(res=>{
wx.$api.index.wechat(res.data.trade_no).then(res=>{
let payInfo = JSON.parse(res.data)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/coupon/coupon?type=couponPublic'
})
},2000)
}
},
fail : res=>{
wx.reLaunch({
url: '/pages/order/order?stateType=unpay'
})
}
})
})
})
},
/**
* 返回上一页
*/
orderRun() {
wx.navigateBack({
delta: 1
})
},
/**
* 复制快递单号
*/
copyText (e) {
let text = e.currentTarget.dataset.text
wx.setClipboardData({
data : text,
success : res=> {
wx.getClipboardData({
success: res => {
wx.showToast({
title: '复制成功'
})
}
})
}
})
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,63 @@
<!-- 订单状态 -->
<view class="order-statl">
{{order.state_text}}
<block wx:if="{{order.state == 'UNPAY'}}">
<image src="/static/icon/order_icon_00.png" class="order-statl-icon"></image>
</block>
<block wx:elif="{{order.state == 'PAID'}}">
<image src="/static/icon/order_icon_01.png" class="order-statl-icon"></image>
</block>
<block wx:elif="{{order.state == 'COMPLETED'}}">
<image src="/static/icon/order_icon_02.png" class="order-statl-icon"></image>
</block>
</view>
<!-- 收货人 -->
<view class="order-address" wx:if="{{order.express != '' && order.express != null}}">
<image class="address-icon" src="https://storage.funnyzhibo.com/images/2020/05/06/address_icon.png" mode="widthFix"></image>
<view class="order-address-name nowrap">
收货人:{{order.express.name}}
<text>{{order.express.mobile}}</text>
</view>
<view class="order-address-text">{{order.express.address}}</view>
<image class="order-address-back" src="/static/img/address_back.png" mode="widthFix"></image>
</view>
<view class="order-goods">
<view class="goods-goods-li">
<image class="goods-img" src="{{order.items.cover}}" mode="aspectFill"></image>
<view class="goods-body">
<view class="goods-name nowrap">{{order.items.title}}</view>
<view class="goods-price nowrap">¥{{order.items.price}}
<text class="goods-qty">×{{order.items.qty}}</text>
</view>
</view>
</view>
</view>
<view class="order-total">
<view class="order-total-li order-type">
权益类型
<text>{{order.type_text}}</text>
</view>
<view class="order-total-li">
订单号
<text bindtap="copyText" data-text="{{order.orderid}}">{{order.orderid}}</text>
</view>
<view class="order-total-li">
下单时间
<text>{{order.created_at}}</text>
</view>
</view>
<view class="order-total">
<view class="order-total-li">
实际支付
<text class="redCor">¥{{order.amount}}</text>
</view>
</view>
<view class="order-data-footer {{statusHeight > 30 ? 'iphoneX':''}}">
<view class="order-btn" bindtap="orderRun">返回订单</view>
<view class="order-btn" bindtap="orderDelete" data-id="{{order.orderid}}" wx:if="{{order.canCancel}}">取消订单</view>
<view class="order-btn order-btn-back" bindtap="orderPay" wx:if="{{order.canPay}}" data-id="{{order.orderid}}">立即支付</view>
</view>

View File

@@ -0,0 +1,241 @@
/*
* 亿时代
*/
.order-statl{
background-color: #f57e32;
padding: 0 30rpx 10rpx;
color: white;
line-height: 90rpx;
height: 90rpx;
position: relative;
}
.order-statl-icon{
width: 80rpx;
height: 80rpx;
vertical-align: middle;
position: absolute;
right: 30rpx;
top: 5rpx;
}
/* 收货人信息 */
.order-address{
padding: 30rpx 30rpx 40rpx 100rpx;
position: relative;
background: white;
}
.order-address-back{
position: absolute;
left: 0;
bottom: 0;
width: 100%;
vertical-align:bottom;
}
.order-address-name{
padding-right: 300rpx;
position: relative;
font-size: 33rpx;
padding-bottom: 10rpx;
}
.order-address-name text{
position: absolute;
right: 0;
top: 0;
width: 280rpx;
text-align: right;
}
.order-address-text{
color: #464854;
font-size: 26rpx;
}
.address-icon,
.arrows-right{
position: absolute;
}
.address-icon{
height: 42rpx;
width: 42rpx;
left: 30rpx;
top: calc(50% - 26rpx);
top: -webkit-calc(50% - 26rpx);
}
.arrows-right{
height: 28rpx;
width: 28rpx;
right: 30rpx;
top: calc(50% - 19rpx);
top: -webkit-calc(50% - 19rpx);
}
.order-add-address{
text-align: center;
padding: 30rpx 0;
}
.order-add-address navigator{
display: inline-block;
background: #e92344;
color: white;
line-height: 60rpx;
padding: 0 30rpx;
margin-right: 20rpx;
}
/* 订单商品 */
.order-content{
border-bottom: solid 100rpx transparent;
}
.order-goods{
margin-bottom: 20rpx;
}
.goods-goods-mall{
padding: 20rpx 30rpx 0 30rpx;
line-height: 50rpx;
}
.goods-goods-mall image{
width: 48rpx;
height: 48rpx;
vertical-align: middle;
margin-right: 15rpx;
margin-bottom: 2rpx;
}
.goods-goods-li{
padding: 20rpx 30rpx;
position: relative;
border-bottom: solid 1rpx #f2f2f2;
min-height: 130rpx;
background: white;
}
.goods-goods-li:last-child{
border-bottom: none;
}
.goods-img{
position: absolute;
top: 20rpx;
left: 30rpx;
height: 130rpx;
width: 130rpx;
background: #f5f6fa;
}
.goods-body{
padding-left: 150rpx;
}
.goods-name{
font-weight: bold;
padding: 10rpx 0 20rpx;
}
.goods-price{
color: #e92344;
}
.goods-qty{
color: gray;
font-weight: normal;
padding-left: 10rpx;
font-size: 28rpx;
}
.goods-params{
color: gray;
padding-bottom: 20rpx;
font-size: 28rpx;
}
/* 统计信息 */
.order-total{
background: white;
margin: 20rpx 0;
}
.order-total-li{
padding: 0 30rpx;
line-height: 90rpx;
position: relative;
font-size: 28rpx;
}
.order-total-li::before{
position: absolute;
content: " ";
left: 30rpx;
bottom: 0;
right: 0;
height: 1rpx;
background: #f2f2f2;
}
.order-total-li:last-child::before{
display: none;
}
.order-total-li text{
float: right;
color: #999;
}
.order-total-li .redCor {
color: #e92344;
font-size: 32rpx;
}
.order-type text {
color: #e92344;
}
/* 底部工具栏 */
.order-data-footer{
position: fixed;
bottom: 0;
left: 0;
right: 0;
border-top: solid 1rpx #f2f2f2;
padding-top: 17rpx;
padding-right: 30rpx;
padding-left: 30rpx;
height: 83rpx;
background: white;
display: flex;
flex-wrap: wrap;
flex-direction:row-reverse;
}
.order-data-footer.iphoneX {
padding-bottom: 30rpx;
}
.order-btn{
margin-left: 20rpx;
height: 54rpx;
line-height: 50rpx;
box-sizing: border-box;
border:solid 1rpx #747788;
padding: 0 20rpx;
font-size: 26rpx;
border-radius: 40rpx;
margin-top: 10rpx;
}
.order-btn-back {
border-color: #f57e32;
color: #f57e32;
}

140
pages/packet/packet.js Normal file
View File

@@ -0,0 +1,140 @@
// pages/packet/packet.js
Page({
/**
* 页面的初始数据
*/
data: {
mobile : '', //手机号码
code : '',
iscode : null, //用于存放验证码接口里获取到的code
codename : '获取验证码',
countDownNum: '',
popContHide : false, //领取成功弹出
popData : '', //领取金额
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
},
/**
* 获取手机号码
*/
getNameValue(e) {
this.setData({
mobile: e.detail.value
})
},
/**
* 获取验证码
*/
getCodeValue(e) {
this.setData({
code: e.detail.value
})
},
/**
* code
*/
codeBind(e){
let mobile = this.data.mobile,
myreg = /^(14[0-9]|13[0-9]|15[0-9]|17[0-9]|18[0-9])\d{8}$$/
var _this = this
if (mobile == "") {
wx.showToast({
title : '手机号不能为空',
icon : 'none',
duration : 1000
})
return false;
}else if (!myreg.test(mobile)) {
wx.showToast({
title : '请输入正确的手机号',
icon : 'none',
duration : 1000
})
return false;
}else{
wx.$api.user.send(mobile,'DEFAULT','unicom').then(res=>{
wx.showToast({
title : '发送成功',
icon : 'success',
duration: 2000
})
var num = 61;
var timer = setInterval(function () {
num--;
if (num <= 0) {
clearInterval(timer);
_this.setData({
codename : '重新发送',
disabled : false
})
} else {
_this.setData({
codename : num + "s后重新获取",
disabled : true
})
}
}, 1000)
})
}
},
/**
* 立即领取
*/
forgetlogin(e) {
let mobile = this.data.mobile,
code = this.data.code,
that = this,
countDownNum = 5 //获取倒计时初始值
that.setData({
countDownNum: countDownNum
})
wx.$api.user.unicom(mobile,'DEFAULT',code).then(res=>{
that.setData({
popContHide : !this.data.popContHide,
popData : res.data
})
var timerPop = setInterval(function () {
countDownNum--;
that.setData({
countDownNum: countDownNum
})
if (countDownNum <= 0) {
clearInterval(timerPop);
that.setData({
countDownNum: 0
})
wx.switchTab({
url: '/pages/user/user'
})
}
}, 1000)
})
},
/**
* 关闭弹窗
*/
popContHide() {
this.setData({
popContHide : !this.data.popContHide
})
wx.switchTab({
url: '/pages/user/user'
})
}
})

4
pages/packet/packet.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents" : {},
"navigationBarTitleText": "联通红包"
}

44
pages/packet/packet.wxml Normal file
View File

@@ -0,0 +1,44 @@
<image class="packetCont-img" src="/static/img/packet.png"></image>
<view class="packetCont-title">
<image src="/static/img/packet_title.png" mode="widthFix"></image>
</view>
<view class="packetText">
<image class="packetText-tips" src="/static/img/packetText_top.png" mode="widthFix"></image>
<view class="packetText-form">
<view class="packetText-title">
<view class="packetText-title-name">请输入办理业务手机号</view>
<text>例185XXXX0001</text>
</view>
<form action="" bindsubmit="forgetlogin">
<view class="packetText-label">
<image src="/static/img/packetText_icon.png"></image>
<input class="inputs-input" type="text" placeholder="请输入手机号领取红包" bindinput="getNameValue"
value="{{mobile}}"></input>
</view>
<view class="packetText-label">
<input class="inputs-code" placeholder="请输入验证码" bindinput="getCodeValue" value="{{code}}"></input>
<button class="packetText-code" bindtap="codeBind" hover-class="none">{{codename}}</button>
</view>
<view class="packetText-cozy">
<view class="packetText-cozy-name">温馨提示:</view>
<text>消费红包仅在本系统内使用有效期12个月</text>
<text>消费红包不找零,不兑现</text>
<text>消费红包兑换成电子券后,不支持退货</text>
<text>如出现电子券核销问题请致电咨询0451-888955119:00-20:00</text>
</view>
<view class="packetText-btn">
<button type="default" form-type="submit"><text>立即领取</text><image src="/static/img/packet_arr.png"></image></button>
</view>
</form>
</view>
</view>
<view class="popBack {{popContHide ? 'active' : ''}}"></view>
<view class="popCont {{popContHide ? 'active' : ''}}">
<image class="popCont-img" src="/static/img/receive.png" mode="widthFix"></image>
<view class="popCont-text">
<view class="popCont-name">领取成功,共领取<text>{{popData}}</text>,可在账户中查看</view>
<view class="popCont-btn" bindtap="popContHide">我知道了 <text wx:if="{{countDownNum > 0}}">({{countDownNum}})</text></view>
</view>
</view>

223
pages/packet/packet.wxss Normal file
View File

@@ -0,0 +1,223 @@
/* 红包领取 */
.packetCont-img {
width: 100vw;
height: 100vh;
position: fixed;
}
.packetCont-title {
width: 100vw;
position: absolute;
z-index: 1;
left: 0;
top: 0;
text-align: center;
margin-top: 60rpx;
}
.packetText {
position: absolute;
top: 16%;
left: 40rpx;
right: 40rpx;
text-align: center;
}
.packetText-form {
background: rgba(255, 255, 255, .7);
border-radius: 30rpx;
padding: 40rpx 40rpx 70rpx 40rpx;
box-sizing: border-box;
color: #000;
text-align: left;
margin-bottom: 100rpx;
position: relative;
}
.packetText-tips {
margin: 0 auto;
display: block;
}
.packetText-title {
font-weight: 600;
font-size: 26rpx;
padding: 0 10rpx 40rpx 10rpx;
}
.packetText-title-name {
font-size: 38rpx;
margin-bottom: 10rpx;
}
.packetText-label {
background-color: #fff;
border-radius: 80rpx;
margin-bottom: 60rpx;
box-shadow: 0 10rpx 10rpx rgba(0, 0, 0, .4);
display: flex;
padding: 25rpx 30rpx;
box-sizing: border-box;
}
.packetText-label image {
width: 40rpx;
height: 40rpx;
margin-top: 2rpx;
margin-right: 30rpx;
}
.packetText-label button {
border: none;
background-color: transparent;
width: auto !important;
padding: 0;
font-weight: normal;
font-size: 32rpx;
}
.inputs-input {
position: relative;
padding-left: 30rpx;
}
.inputs-code {
position: relative;
padding: 0 30rpx;
box-sizing: border-box;
flex: 1;
margin-right: 30rpx;
}
.inputs-input::after,
.inputs-code::after {
position: absolute;
content: '';
top: 0;
background: #000;
width: 4rpx;
height: 100%;
}
.inputs-input::after {
left: 0;
}
.inputs-code::after {
right: 0;
}
.packetText-cozy {
font-weight: 600;
font-size: 26rpx;
}
.packetText-cozy text {
display: block;
margin: 15rpx 0;
position: relative;
padding-left: 30rpx;
}
.packetText-cozy text::after {
position: absolute;
content: '';
left: 0;
top: 12rpx;
background-color: #000;
width: 12rpx;
height: 12rpx;
border-radius: 50%;
}
.packetText-cozy-name {
font-size: 34rpx;
}
.packetText-btn {
width: 100%;
text-align: center;
height: 90rpx;
position: absolute;
bottom: -40rpx;
left: 0;
}
.packetText-btn button {
line-height: 90rpx;
border-radius: 25rpx;
background-image: radial-gradient(#fdcf7c 50%,#fdebb8);
border: none;
font-size: 38rpx;
color: #fff;
margin: 0 auto;
padding: 0;
}
.packetText-btn text{
background: linear-gradient(to bottom, #e38b3c, #cb6418);
-webkit-background-clip: text;
color: transparent;
}
.packetText-btn image {
width: 34rpx;
height: 34rpx;
vertical-align: -4rpx;
margin-left: 14rpx;
}
/* 弹出 */
.popBack {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .8);
z-index: 8;
display: none;
}
.popCont {
position: fixed;
z-index: 9;
width: 100vw;
height: 100vh;
text-align: center;
display: none;
}
.popCont-text {
padding: 0 10rpx;
box-sizing: border-box;
position: absolute;
z-index: 10;
left: 20%;
top: 340px;
width: 60%;
}
.popBack.active,
.popCont.active {
display: block;
}
.popCont-name {
margin-bottom: 50rpx;
font-size: 30rpx;
}
.popCont-name text {
font-size: 40rpx;
color: #fd5238;
padding: 0 10rpx;
}
.popCont-btn {
background-color: #ffea37;
color: #ff3900;
display: inline-block;
border-radius: 80rpx;
padding: 20rpx 70rpx;
box-shadow: 0 10rpx 10rpx rgba(196, 160, 0, 0.4);
}

353
pages/rights/rights.js Normal file
View File

@@ -0,0 +1,353 @@
Page({
/**
* 页面的初始数据
*/
data: {
address : '', //默认收货地址
allAddress : '', //收货地址列表
groupId : '', //权益id
detail : '', //权益详情
amount : '', //总金额
moreAmount : '', //产品金额
score : '', //应付总积分
freight : '', //运费
num : 1, //购买的数量
content : '', //内容介绍
notification: '', //重要提示
remark : '', //使用须知
noticeShow : false, //须知显示状态
addressShow : false, //收货地址显示
getType : '', //是否显示自提
platIndex : 0, //选择提交方式下标
isdeliver : '',
platformCp : [], //选择提交数组
pointMoreShow: false,
from : '',
typeNo : '',
uniUrl : '', //跳转h5页面
openid : '',
webShow : false,
rightsTap : false,
disabled : false,
payWayIndex : 0,
payWay :[
{value: 0, name: "微信支付"},
{value: 1, name: "沃钱包支付"}
]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
groupId : options.rightsId || options.id,
typeWeb : options.type,
getType : options.getType,
openid : options.openid || ''
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取详情
this.rightsInfo();
},
/**
* 详情
*/
rightsInfo() {
wx.$api.index.rightShow(this.data.groupId, this.data.address.id, this.data.num, this.data.isdeliver).then(res=>{
let obj = res.data.detail.express
let defGet = res.data.detail.def_get
let arr = new Array
arr = Object.keys(obj).map(val=>{
return { ...obj[val], ...{key: val} }
})
this.setData({
address : res.data.address,
allAddress : res.data.all_address,
detail : res.data.detail,
num : res.data.num,
freight : res.data.freight,
platformCp : arr,
from : res.data.detail.from,
amount : res.data.total,
moreAmount : res.data.amount,
score : res.data.score,
typeNo : res.data.detail.type_no,
remark : res.data.detail.remark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
content : res.data.detail.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
notification: res.data.detail.notification.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
})
if(this.data.openid == '') {
this.setData({
openid: res.data.detail.union_openid
})
}
if(res.data.detail.from == 'unionpay') {
if(res.data.detail.union_openid == '') {
wx.$api.index.unionpay('/pages/rights/rights?id=' + res.data.detail.right_id, 'wxmini', this.data.groupId).then(res=>{
this.setData({
uniUrl : encodeURIComponent(res.data)
})
})
}
}
}).catch(err=>{
if(!err.login){
wx.showModal({
title : '用户登录已过期',
content : '请重新登录',
showCancel : false,
success : res => {
if (res.confirm) {
wx.redirectTo({
url: '/pages/login/login'
})
}
}
})
}
})
},
/**
* 商品数量加减
*/
goodsNumber(e){
let num = this.data.num
if (e.currentTarget.dataset.type == 'plus'){
num ++;
}else{
if (num > 1){
num --;
}else{
wx.showToast({
title : '商品数量不能小于1',
icon : 'none'
})
}
}
this.setData({
num : num
})
// 获取详情
this.rightsInfo()
},
/**
* 输入商品数量
*/
goodsNumberInput(e){
let goodsNum = e.detail.value
if (goodsNum > 0){
this.setData({
num : goodsNum
})
}else{
wx.showToast({
title : '商品数量不能小于1',
icon : 'none'
})
this.setData({
num : goodsNum
})
}
// 获取详情
this.rightsInfo()
},
/**
* 须知展开收起状态
*/
noticeTap() {
this.setData({
noticeShow : !this.data.noticeShow
})
},
/**
* 选择提交方式
*/
platBind(e) {
this.setData({
platIndex : e.detail.value,
isdeliver : this.data.platformCp[e.detail.value].value
})
// 获取详情
this.rightsInfo()
},
/**
* 收货地址弹出
*/
addressTap() {
this.setData({
addressShow : true
})
},
/**
* 收货地址收起
*/
addressHide() {
this.setData({
addressShow : false
})
},
/**
* 选择收货地址
*/
selectAddress(e){
let new_addressId = e.currentTarget.dataset.id,
addressId = this.data.address.id
if (new_addressId != addressId) {
this.setData({
address : e.currentTarget.dataset.index,
addressShow : false
})
}else{
this.setData({
addressShow : false
})
}
// 获取详情
this.rightsInfo()
},
/**
* 普通商品支付提交
*/
ordinary() {
this.submitOrder();
this.setData({
disabled : true
})
},
/**
* 只有银联商品获取
*/
unionOrder() {
// 更新openid
wx.$api.index.unionCode(this.data.openid).then(res=>{})
this.submitOrder();
},
/**
* 支付选择
*/
payBind(e) {
this.setData({
payWayIndex: e.detail.value
})
},
/**
* 支付提交
*/
submitOrder() {
if(this.data.isdeliver.length == 0) {
this.setData({
isdeliver: this.data.detail.def_get
})
}
let right_id = this.data.detail.right_id,
address_id = this.data.address.id,
is_deliver = this.data.isdeliver,
qty = this.data.num
wx.$api.index.rightStore(right_id, address_id, is_deliver, qty).then(res=>{
if(res.data.canPay == false) {
wx.showToast({
title : '支付成功',
icon : 'success',
duration: 2000
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/order/order'
})
},3000)
this.setData({
rightsTap: true
})
}else {
// payWayIndex为0的时候为微信支付
if(this.data.payWayIndex == 0) {
wx.$api.index.wechat(res.data.trade_no).then(res=>{
let payInfo = JSON.parse(res.data)
wx.requestPayment({
timeStamp: payInfo.timeStamp,
nonceStr : payInfo.nonceStr,
package : payInfo.package,
paySign : payInfo.paySign,
signType : payInfo.signType,
success : res=>{
if(res.errMsg == "requestPayment:ok"){
wx.showToast({
title: '支付成功',
icon : 'success'
})
setTimeout(()=>{
wx.reLaunch({
url: '/pages/coupon/coupon?type=couponPublic'
})
},3000)
}
},
fail : res=>{
wx.reLaunch({
url: '/pages/order/order?stateType=unpay'
})
}
})
})
}
// payWayIndex为1的时候为沃钱包支付
if(this.data.payWayIndex == 1) {
const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no
let url= encodeURIComponent(newUrl)
wx.navigateTo({
// 跳转到webview页面
url: `/pages/webView/webView?url=${url}`
});
}
}
})
},
/**
* 新增收货地址
*/
addSelect() {
wx.navigateTo({
url: '/pages/address/address?type=selectAddress'
})
this.setData({
addressShow : false
})
},
/**
* 新增收货地址
*/
pointMoreTap() {
this.setData({
pointMoreShow : !this.data.pointMoreShow
})
}
})

6
pages/rights/rights.json Normal file
View File

@@ -0,0 +1,6 @@
{
"usingComponents" : {},
"navigationBarTitleText" : "卡券权益",
"navigationBarBackgroundColor": "#151619",
"navigationBarTextStyle" : "white"
}

214
pages/rights/rights.wxml Normal file
View File

@@ -0,0 +1,214 @@
<!-- 按钮 -->
<block wx:if="{{from == 'unionpay'}}">
<navigator class="rightsBtn" hover-class="none" url="/pages/webView/webView?url={{uniUrl}}"
wx:if="{{openid == ''}}">
<text>立即领取</text>
</navigator>
<view class="rightsBtn {{rightsTap == true ? 'active' : ''}}" wx:else>
<text wx:if="{{rightsTap == true}}">立即购买</text>
<text wx:else bindtap="unionOrder">立即购买</text>
</view>
</block>
<view class="rightsBtn" bindtap="ordinary" wx:else>
<button disabled="{{disabled}}">立即购买</button>
</view>
<!-- 重要提示 -->
<view class="rightsPoint">
<view class="rightsPoint-cont">
<view class="rightsPoint-top">
<image src="/static/icon/Point_icon.png"></image>
<text>重要提示</text>
</view>
<view class="rightsPoint-text {{pointMoreShow ? 'active' : ''}}">
<rich-text nodes="{{notification}}"></rich-text>
</view>
<view class="pointMore" bindtap="pointMoreTap">
<text>{{pointMoreShow == true ? '收起' : '展开'}}</text>
<image src="{{pointMoreShow == true ? '/static/img/pointMore-up.png' : '/static/img/pointMore.png'}}">
</image>
</view>
</view>
</view>
<view style="padding-bottom: 220px">
<view class="cont">
<view class="contBack">
<image class="classBack" src="/static/img/class_back_01.png" mode="scaleToFill"></image>
<view class="classCircle"></view>
<view class="rightsCont">
<view class="rightsCont-tips">
{{detail.four_title}}
</view>
<scroll-view scroll-x class="welfareCont-top" scroll-with-animation>
<view class="welfareCont-list-img" wx:for="{{detail.logos}}" wx:key="logos">
<image src="{{item}}" mode="aspectFill"></image>
</view>
</scroll-view>
<view class="nowrap rightsCont-btn">
{{detail.three_title}}
</view>
</view>
</view>
</view>
<view class="rightsNumber">
<text>数量</text>
<view class="rightsAdd">
<view class="rightsAdd-btn" bindtap="goodsNumber" data-type="remove">-</view>
<input class="rightsAdd-input" data-num="{{num}}" value="{{num}}" type="number" maxlength='4'
bindblur="goodsNumberInput"></input>
<view class="rightsAdd-btn" bindtap="goodsNumber" data-type="plus">+</view>
</view>
</view>
<!-- 规格 -->
<view class="rightsList" style="margin-top:50rpx">
<view class="rightsLabel">
<view class="rightsLabel-left">{{detail.attribute.form_price}}</view>
<view class="rightsLabel-right">¥{{moreAmount}}</view>
</view>
<view class="rightsLabel" wx:if="{{platIndex == 1}}">
<view class="rightsLabel-left">电子券</view>
<view class="rightsLabel-right">{{detail.qty}}张</view>
</view>
<!-- <view class="rightsLabel">
<view class="rightsLabel-left">需要兑换的积分</view>
<view class="rightsLabel-right">{{detail.score}}</view>
</view> -->
<!-- <view class="rightsLabel">
<view class="rightsLabel-left">卡余额抵扣</view>
<view class="rightsLabel-right">-¥0.00</view>
</view> -->
<!-- <view class="rightsLabel">
<view class="rightsLabel-left">总金额</view>
<view class="rightsLabel-right">¥{{detail.price}}</view>
</view> -->
<block wx:if="{{detail.type == 'physical'}}">
<view class="rightsLabel">
<view class="rightsLabel-left">请选择提交方式</view>
<view class="rightsLabel-right rightsLabel-range">
<picker range="{{platformCp}}" range-key="name" bindchange="platBind">
<view class="tabs-text">
{{platformCp[platIndex].name}}
</view>
</picker>
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
</view>
</view>
<view class="rightsLabel rightsLabel-address" wx:if="{{platformCp[platIndex].name == '快递'}}">
<view class="rightsLabel-left">收货地址</view>
<block wx:if="{{address != ''}}">
<view class="rightsLabel-right" bindtap="addressTap">
<text class="nowrap">{{address.all_address}}</text>
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
</view>
</block>
<block wx:else>
<navigator class="rightsLabel-right" hover-class="none"
url="/pages/address_form/address_form?type=Add">
添加收货地址<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
</navigator>
</block>
</view>
<view class="rightsLabel" wx:if="{{platformCp[platIndex].name == '快递'}}">
<view class="rightsLabel-left">快递运费</view>
<view class="rightsLabel-right">¥{{freight}}</view>
</view>
</block>
</view>
<view class="rightsList" style="padding: 0 0 2rpx">
<view class="rightsLabel">
<view class="rightsLabel-left">{{detail.attribute.form_type}}</view>
<view class="rightsLabel-right rightsLabel-red">¥{{detail.score}}</view>
</view>
<view class="rightsLabel uni-border-top">
<view class="rightsLabel-left">{{detail.attribute.form_pay}}</view>
<view class="rightsLabel-right rightsLabel-score">¥{{amount}}</view>
</view>
</view>
<!-- 支付方式 -->
<view class="rightsList">
<view class="rightsLabel">
<view class="rightsLabel-left">请选择支付方式</view>
<view class="rightsLabel-right rightsLabel-range">
<picker range="{{payWay}}" range-key="name" bindchange="payBind">
<view class="tabs-text">
{{payWay[payWayIndex].name}}
</view>
</picker>
<image class="rightsLabel-row" src="/static/icon/rightsArrow.png"></image>
</view>
</view>
<!-- <view class="rightsLabel-pay">
<view class="rightsLabel-left">支付方式</view>
<view class="rightsLabel-right">微信支付</view>
</view> -->
</view>
<!-- 自提商家 -->
<!-- <view class="detailsStore" wx:if="{{platIndex == 0}}">
<view class="detailsStore-top">
自提门店
</view>
<view class="detailsStore-see">
<text>查看提货点信息</text>
<image src="/static/icon/storeArrow.png"></image>
</view>
</view> -->
<!-- 购买须知 -->
<view class="notice">
<view class="noticeTitle" bindtap="noticeTap">
<view class="noticeTitle-flex">
<image class="noticeTitle-img" src="/static/icon/notice_icon.png"></image>
购买前请仔细阅读使用须知、内容介绍
</view>
<image class="noticeTitle-row {{noticeShow ? 'active' : ''}}" src="/static/icon/rightsArrow.png"></image>
</view>
<view class="noticeText {{noticeShow ? 'active' : ''}}">
<view class="noticeText-top">购买须知</view>
<view class="noticeText-cont">
<rich-text nodes="{{remark}}"></rich-text>
</view>
<view class="noticeText-top">内容介绍</view>
<view class="noticeText-cont">
<rich-text nodes="{{content}}"></rich-text>
</view>
</view>
</view>
</view>
<!-- 选择收货地址 -->
<view class="addressBack {{addressShow ? 'active':''}}" bindtap="addressHide"></view>
<view class="addressCont {{addressShow ? 'active':''}}">
<view class="addressCont-title uni-border-bottom">
<view class="addressCont-left">请选择收货地址</view>
<view class="addressCont-right" bindtap="addSelect">新增收货地址</view>
</view>
<scroll-view class="header-classify" scroll-y="true">
<view class="addressCont-list uni-border-bottom" wx:for="{{allAddress}}" wx:key="allAddress"
bindtap="selectAddress" data-id="{{item.id}}" data-index="{{item}}">
<view class="addressCont-top">
<view class="addressCont-name">{{item.name}}</view>
<view class="addressCont-tel">{{item.mobile}}</view>
</view>
<view class="addressCont-text">
{{item.all_address}}
</view>
<view class="address-tool-icon">选择地址</view>
<!-- <view class="address-tool">
<view class="address-tool-btn" bindtap="addressEdit" data-id="">编辑地址</view>
<view class="address-tool-btn address-tool-btn-del">删除地址</view>
</view> -->
</view>
</scroll-view>
</view>
<!-- <view class="webBack {{webShow == true ? '' : 'active'}}">
获取失败,请重新获取
</view> -->

606
pages/rights/rights.wxss Normal file
View File

@@ -0,0 +1,606 @@
page {
background-color: #f7f7f7;
}
.cont {
width: 100%;
overflow: hidden;
}
/* 卡券权益 */
.contBack {
position: relative;
width: 200%;
height: 400rpx;
left: -50%;
text-align: center;
background: #000000;
border-radius: 0 0 100% 100%;
overflow: hidden;
}
/* .contBack::after {
width: 100%;
height: 30rpx;
position: absolute;
left: 0;
bottom: 0;
z-index: 2;
content: '';
background-image: linear-gradient(transparent, rgba(0,0,0,.25));
} */
.classBack {
position: absolute;
left: 30%;
right: 30%;
width: 40%;
top: 40rpx;
}
.classCircle {
position: relative;
}
.classCircle::after,
.contBack::before {
position: absolute;
border-radius: 50%;
content: '';
z-index: 1;
background-color: rgba(255,255,255,.1);
}
.classCircle::after {
left: 20%;
top: -20rpx;
width: 260rpx;
height: 260rpx;
}
.contBack::before {
right: 20%;
top: 55%;
width: 300rpx;
height: 300rpx;
}
.rightsCont {
position: absolute;
z-index: 3;
left: calc(30% - 2rpx);
right: calc(30% - 2rpx);
width: calc(40% + 4rpx);
top: 58rpx;
}
.rightsCont-btn {
background-color: #f4dfcc;
width: 100%;
line-height: 70rpx;
font-size: 38rpx;
color: #694425;
padding: 0 20rpx;
box-sizing: border-box;
}
.rightsCont-tips {
color: #fff;
}
.rightsNumber {
display: flex;
width: 100%;
margin: 30px 0 20px;
padding: 0 30rpx;
box-sizing: border-box;
}
.rightsNumber text {
display: inline-block;
flex: 1;
}
.rightsAdd {
display: flex;
}
.rightsAdd-btn {
background: #eaeaea;
color: #535353;
border-radius: 50%;
text-align: center;
width: 50rpx;
height: 50rpx;
line-height: 45rpx;
font-size: 40rpx;
font-weight: 600;
}
.rightsAdd-input {
width: 100rpx;
text-align: center;
font-size: 28rpx;
line-height: 50rpx;
}
.rightsTips {
padding: 0 30rpx;
color: #ff5b5d;
font-size: 28rpx;
font-weight: 600;
}
.rightsList,
.notice,
.detailsStore {
background: white;
margin: 30rpx;
border-radius: 10rpx;
padding: 10rpx 0;
box-sizing: border-box;
box-shadow: 0 0 30rpx rgba(0,0,0,.15);
}
.rightsLabel,
.rightsLabel-pay {
display: flex;
padding: 20rpx;
color: #6f7880;
font-size: 30rpx;
}
.rightsLabel .rightsLabel-left {
flex: 1;
color: #747d86;
}
.rightsLabel-black {
padding-top: 30rpx;
}
.rightsLabel-range {
display: flex;
color: #000;
font-weight: 600;
}
.rightsLabel-row {
width: 38rpx;
height: 38rpx;
margin: 2rpx 0 0 6rpx;
}
.rightsLabel-black .rightsLabel-right,
.rightsLabel-red {
color: #ff5b5d;
font-weight: 600;
font-size: 32rpx;
}
.rightsLabel-black .rightsLabel-left {
color: #000;
}
.rightsLabel-score {
font-weight: 600;
color: #000;
font-size: 38rpx;
}
.rightsLabel-pay {
color: #000;
}
.rightsLabel-pay .rightsLabel-left {
flex: 1;
}
.notice {
padding: 20rpx;
}
.noticeTitle {
display: flex;
}
.noticeTitle-flex {
flex: 1;
display: flex;
font-size: 30rpx;
line-height: 46rpx;
}
.noticeTitle-img {
width: 46rpx;
height: 46rpx;
margin-right: 20rpx;
}
.noticeText {
font-size: 26rpx;
height: 0;
overflow: hidden;
}
.noticeText.active {
height: auto;
}
.noticeText-top {
margin: 30rpx 0 10rpx;
font-weight: 600;
}
.noticeText-cont {
line-height: 60rpx;
}
.noticeTitle-row {
width: 46rpx;
height: 46rpx;
}
.noticeTitle-row.active {
transform: rotate(90deg);
}
/* 门店 */
.detailsStore {
padding: 20rpx;
}
.detailsStore-top {
display: flex;
line-height: 30rpx;
margin-bottom: 20rpx;
}
.detailsStore-see {
color: #dfae2e;
border: 2rpx solid #dfae2e;
border-radius: 10rpx;
font-size: 28rpx;
margin-top: 30rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
}
.detailsStore-see text {
display: inline-block;
}
.detailsStore-see image {
width: 50rpx;
height: 50rpx;
margin-left: 10rpx;
}
/* 购买按钮 */
.rightsBtn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 100rpx;
z-index: 9;
background: #fff;
}
.rightsBtn button,
.rightsBtn text {
display: block;
margin: 12rpx 30rpx;
width: calc(100% - 60rpx) !important;
height: 74rpx !important;
line-height: 74rpx !important;
padding: 0;
background: #eacf88;
text-align: center;
border-radius: 60rpx;
font-size: 30rpx;
}
.rightsBtn.active text {
background: #dedede;
color: #888;
}
/* 选择收货地址 */
.addressBack {
position: fixed;
left: 0;
bottom: 0;
background: rgba(0, 0, 0, .4);
z-index: 10;
width: 100%;
height: 100%;
display: none;
}
.addressBack.active {
display: block;
}
.addressCont {
position: fixed;
left: 0;
bottom: -1000%;
transition: .2s;
background: #fff;
z-index: 11;
width: 100%;
}
.addressCont.active {
bottom: 0;
}
.addressCont-title {
height: 90rpx;
line-height: 90rpx;
display: flex;
padding: 0 30rpx;
box-sizing: border-box;
font-size: 28rpx;
font-weight: 600;
}
.addressCont-left {
flex: 1;
}
.addressCont-right {
color: #309ded;
}
.header-classify {
white-space: nowrap;
box-sizing: border-box;
height: 600rpx;
}
.addressCont-list {
padding: 30rpx 20rpx;
box-sizing: border-box;
font-size: 30rpx;
overflow: hidden;
position: relative;
}
.addressCont-top {
display: flex;
margin-bottom: 10rpx;
}
.addressCont-name {
font-weight: 600;
}
.addressCont-text {
color: #666;
width: calc(100% - 160rpx);
}
.addressCont-list:last-child {
border: none;
}
.rightsLabel-address {
display: flex;
}
.rightsLabel-address text {
display: inline-block;
width: calc(100% - 46rpx);
}
.rightsLabel-address .rightsLabel-right {
display: flex;
font-size: 28rpx;
}
.address-tool {
display: flex;
float: right;
}
.address-tool-btn {
font-size: 24rpx;
margin-top: 20rpx;
border: 2rpx solid #666;
color: #666;
border-radius: 6rpx;
text-align: center;
height: 50rpx;
line-height: 50rpx;
padding: 0 20rpx;
margin-right: 20rpx;
display: flex;
}
.address-tool-btn-del {
color: #dfae2e;
border-color: #dfae2e;
}
.address-tool-icon {
width: 120rpx;
height: 54rpx;
line-height: 54rpx;
border-radius: 4rpx;
text-align: center;
color: #fff;
position: absolute;
top: 45rpx;
right: 10rpx;
background: #dfae2e;
transform: scale(.9, .9);
font-size: 24rpx;
}
.rightsPoint {
position: fixed;
left: 0;
bottom: 100rpx;
background: #fff;
z-index: 9;
width: 100%;
padding: 20rpx 20rpx 10rpx;
box-sizing: border-box;
}
.rightsPoint-cont {
width: 100%;
background: #fff8e5;
border: 2rpx solid #f2ecde;
border-radius: 10rpx;
position: relative;
max-height: 50vh;
overflow-y: scroll;
}
.rightsPoint-top {
font-size: 28rpx;
display: flex;
padding: 20rpx;
box-sizing: border-box;
font-weight: 600;
}
.rightsPoint-top image {
width: 36rpx;
height: 36rpx;
margin-right: 10rpx;
}
.rightsPoint-text {
padding: 0 20rpx;
box-sizing: border-box;
font-size: 24rpx;
line-height: 44rpx;
height: 90rpx;
transition: height 25s;
overflow: hidden;
}
.rightsPoint-text.active {
height: auto;
transition: 2s;
}
.rightsPoint-text view {
position: relative;
padding-left: 40rpx;
}
.rightsPoint-text view::after {
position: absolute;
content: '';
left: 10rpx;
top: 20rpx;
background: #000;
width: 10rpx;
height: 10rpx;
border-radius: 50%;
}
.rightsPoint-bolck {
position: absolute;
top: 0;
left: 0;
height: calc(100% - 40rpx);
}
.pointMore {
text-align: center;
width: 100%;
background: #fff8e5;
height: 80rpx;
line-height: 82rpx;
position: relative;
margin-top: 10rpx;
}
.pointMore::after {
position: absolute;
content: '';
left: 0;
top: 0;
width: 100%;
height: 2rpx;
background: #f2ecde;
}
.pointMore text {
font-size: 28rpx;
color: #c38e00;
animation: dong 1.8s infinite;
display: inline-block;
}
.pointMore image {
width: 30rpx;
height: 30rpx;
margin-left: 4rpx;
vertical-align: -4rpx;
animation: dong 1.8s infinite;
}
@keyframes dong {
0% {
transform: translate(0px, 0px);
}
50% {
transform: translate(0px, -6rpx);
}
100% {
transform: translate(0px, 0px);
}
}
.webBack {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
z-index: 9999;
background-color: #fff;
text-align: center;
display: none;
}
.webBack.active {
display: block;
}
.welfareCont-top{
white-space: nowrap;
flex-direction: row;
align-items: center;
justify-content: space-around;
width: 100%;
padding: 0 10rpx;
box-sizing: border-box;
margin: 50rpx 0 20rpx;
}
.welfareCont-list-img {
border-radius: 50%;
width: 120rpx;
height: 120rpx;
display: inline-block;
margin: 0 15rpx;
overflow: hidden;
}
.welfareCont-list-img image {
width: 100%;
height: 100%;
}

213
pages/store/store.js Normal file
View File

@@ -0,0 +1,213 @@
// pages/store/store.js
Page({
/**
* 页面的初始数据
*/
data: {
stores : [], //门店列表
id : 0, //优惠券id
searchText : '', //搜索关键字
longitude : 0, //经度
latitude : 0, //纬度
//省份选择
areas : [],
areaIndex : 0,
//市级选择
cityList : [],
cityIndex : 0,
//区域选择
regiList : [],
regiIndex : 0,
page : {}, //下一页
lodingStats : false //加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
// 优惠券id
this.setData({
id :options.id
})
// 获取位置
wx.getLocation({
type: 'gcj02',
success: res=> {
this.setData({
longitude : res.longitude,
latitude : res.latitude
})
// 解析坐标
getApp().qqmapsdk.reverseGeocoder({
location: {
latitude : res.latitude,
longitude : res.longitude
},
success: res=>{
if(res.message == "query ok"){
let addressInfo = res.result.address_component
// 获取门店列表
this.storesInfo(addressInfo);
}else{
wx.showToast({
title: res.message,
icon : 'none'
})
}
}
})
}
})
},
/**
* 选择城市信息
*/
regi(e){
let chantType = e.currentTarget.dataset.type,
chantIndex = e.detail.value,
name = ""
if(chantType == "area"){
name = "areaIndex"
}else if(chantType == "city"){
name = "cityIndex"
this.getAreas(this.data.cityList[chantIndex].code, "")
}else if(chantType == "regi"){
name = "regiIndex"
}
this.setData({
[name] : chantIndex
})
// 获取门店列表
this.storesInfo()
},
/**
* 门店列表
*/
storesInfo(addressInfo, page) {
let coupon_id = this.data.id,
user_lng = this.data.longitude,
user_lat = this.data.latitude,
province_id = "",
city_id = "",
district_id = "",
title = this.data.searchText || "",
areaIndex = this.data.areaIndex,
cityIndex = this.data.cityIndex,
regiIndex = this.data.regiIndex,
cityList = this.data.cityList,
areas = this.data.areas,
regiList = this.data.regiList
if(!addressInfo){
province_id = areas[areaIndex].code
city_id = cityList[cityIndex].code
district_id = regiList[regiIndex].code
}
wx.$api.user.stores(coupon_id, province_id, city_id, district_id, title, user_lng, user_lat, page).then(res=>{
let stores = this.data.stores,
newData = []
if(page == 1 || page == undefined) stores = []
newData = stores.concat(res.data.stores.data)
newData.map(res=>{
let distance = res.distance
if(res.distance > 1000){
distance = (distance / 1000) + "km"
}else{
distance = distance + "m"
}
res.km = distance
})
if(addressInfo){
cityList = res.data.citys
areas = res.data.provinces
areaIndex = areas.findIndex(val => val.name == addressInfo.province)
cityIndex = cityList.findIndex(val => val.name == addressInfo.city)
// this.getAreas(cityList[cityIndex].code, addressInfo.district)
this.getAreas(cityList[cityIndex].code, '')
}
this.setData({
areas : areas,
stores : newData,
cityList : cityList,
areaIndex : areaIndex,
cityIndex : cityIndex,
page : res.data.stores.page,
lodingStats : false
})
wx.stopPullDownRefresh()
})
},
/**
* 获取区级信息
*/
getAreas(sn, areas){
wx.$api.user.areas(sn).then(res=>{
let regiList = res.data,
regiIndex = 0
if(areas) regiIndex = regiList.findIndex(val => val.name == areas)
this.setData({
regiList : regiList,
regiIndex : regiIndex
})
})
},
/**
* 查看门店详情页
*/
detailsTap(e) {
let store_id = e.currentTarget.dataset.id,
user_lng = this.data.longitude,
user_lat = this.data.latitude
wx.navigateTo({
url: '/pages/storeDetails/storeDetails?store_id=' + store_id + '&user_lng=' + user_lng + '&user_lat=' + user_lat,
})
},
/**
* 搜索门店
*/
searchForm(e) {
this.setData({
searchText : e.detail.value.search
})
// 获取门店列表
this.storesInfo()
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
this.setData({
page: pageNumber
})
this.storesInfo('', pageNumber)
}
}
})

4
pages/store/store.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "门店列表"
}

64
pages/store/store.wxml Normal file
View File

@@ -0,0 +1,64 @@
<!-- 搜索 -->
<form bindsubmit="searchForm" class="search">
<view class="searchCont">
<image src="/static/icon/secrch_icon.png"></image>
<input class="search-navigator" name="search" placeholder="请输入门店名称" value="{{searchText}}"></input>
<button class="search-btn" form-type="submit">搜索</button>
</view>
</form>
<!-- 筛选 -->
<view class="screen">
<view class="screenLabel">
<picker bindchange="regi" data-type="area" value="{{areaIndex}}" range="{{areas}}" range-key="name" name="district_id">
<view class="nowrap picker">
{{areas[areaIndex].name}}
</view>
<image class="screenLabel-arrow" src="/static/icon/arrow_down.png"></image>
</picker>
</view>
<view class="screenLabel">
<picker bindchange="regi" data-type="city" value="{{cityIndex}}" range="{{cityList}}" range-key="name" name="district_id">
<view class="nowrap picker">
{{cityList[cityIndex].name}}
</view>
<image class="screenLabel-arrow" src="/static/icon/arrow_down.png"></image>
</picker>
</view>
<view class="screenLabel">
<picker bindchange="regi" data-type="regi" value="{{regiIndex}}" range="{{regiList}}" range-key="name" name="district_id">
<view class="nowrap picker">
{{regiList[regiIndex].name}}
</view>
<image class="screenLabel-arrow" src="/static/icon/arrow_down.png"></image>
</picker>
</view>
</view>
<!-- 门店列表 -->
<view class="storeList" wx:if="{{stores != ''}}">
<view class="detailsStore-list" wx:for="{{stores}}" wx:key="stores" bindtap="detailsTap" data-id="{{item.store_id}}">
<image src="{{item.cover}}" class="detailsStore-logo"></image>
<view class="detailsStore-cont">
<view class="nowrap detailsStore-name">{{item.title}}</view>
<view class="detailsStore-place">
<text class="nowrap">{{item.address}}</text>
{{item.km}}
</view>
</view>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<!-- 优惠券为空 -->
<view class="pack-center pages-hint" wx:else>
<image src="/static/img/null_icon.png"></image>
<view>暂无商家</view>
</view>

136
pages/store/store.wxss Normal file
View File

@@ -0,0 +1,136 @@
/* 搜索 */
.search {
background: #fff;
position: fixed;
width: 100%;
left: 0;
top: 0;
height: 110rpx;
z-index: 99;
}
.searchCont {
background: #f7f7f7;
border-radius: 50rpx;
height: 80rpx;
line-height: 80rpx;
font-size: 28rpx;
margin: 20rpx 20rpx 0;
padding: 0 30rpx;
box-sizing: border-box;
display: flex;
}
.searchCont image {
width: 34rpx;
height: 34rpx;
margin: 24rpx 20rpx 0 0;
}
.searchCont input {
height: 100%;
width: calc(100% - 150rpx);
}
.searchCont button {
background: transparent;
width: 100rpx !important;
text-align: right;
padding: 0 !important;
margin: 0 !important;
height: 80rpx;
line-height: 80rpx;
font-size: 30rpx;
color: #ff9b1a;
}
/* 筛选 */
.screen {
background: #fff;
position: fixed;
width: 100%;
left: 0;
top: 110rpx;
height: 90rpx;
overflow: hidden;
z-index: 99;
}
.screenLabel {
float: left;
width: calc(33.33% - 20rpx);
text-align: center;
color: #5f5f5f;
line-height: 90rpx;
font-size: 28rpx;
margin: 0 10rpx;
}
.screenLabel picker {
width: calc(100% - 17rpx);
position: relative;
}
.screenLabel-arrow {
position: absolute;
right: 0;
top: calc(50% - 17rpx);
width: 34rpx;
height: 34rpx;
}
/* 门店列表 */
.storeList {
background: #fff;
padding: 20rpx;
box-sizing: border-box;
margin-top: 220rpx;
padding-bottom: 40rpx;
}
.detailsStore-list {
position: relative;
margin-bottom: 40rpx;
}
.detailsStore-list:last-child {
margin-bottom: 0;
}
.detailsStore-logo {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
}
.detailsStore-cont {
position: absolute;
left: 150rpx;
top: 10rpx;
width: calc(100% - 150rpx);
}
.detailsStore-tel {
width: 60rpx;
height: 60rpx;
margin-top: 25rpx;
}
.detailsStore-place {
font-size: 24rpx;
line-height: 40rpx;
color: #5a5a5a;
display: flex;
}
.detailsStore-place text {
flex: 1;
display: inline-block;
font-size: 28rpx;
margin-right: 20rpx;
}
.detailsStore-name {
margin-bottom: 20rpx;
}

Some files were not shown because too many files have changed in this diff Show More