Compare commits

..

19 Commits

Author SHA1 Message Date
195547d86a [最新更新] 2024-03-04 15:39:57 +08:00
a8a1c06ae4 [最新更新] 2024-03-04 15:20:20 +08:00
ee98f5921d [最新更新] 2024-03-04 15:13:17 +08:00
唐明明
edb08b4f83 调整配送方式 2023-10-11 15:03:27 +08:00
唐明明
4faf065c96 调整购物车样式 2023-10-10 10:59:56 +08:00
51a04d53ce [绚火最新] 2023-09-28 14:28:59 +08:00
ae5992fa79 [最新] 2023-09-22 17:28:59 +08:00
唐明明
677b0d040a 购物车 2023-09-22 09:46:47 +08:00
唐明明
7ab5dfb2d8 Merge branch 'master' of https://git.yuzhankeji.cn/zhangjing/xuan_wechat 2023-09-21 12:02:14 +08:00
唐明明
c83119f166 同步代码 2023-09-21 12:02:11 +08:00
b28caaad4c [最新] 2023-09-21 12:00:51 +08:00
a626d36591 [最新] 2023-09-15 17:14:36 +08:00
唐明明
0dcf23bfde 分享朋友圈调整 2023-09-14 09:25:37 +08:00
唐明明
510cbeb181 新增退货流程 2023-08-29 13:53:48 +08:00
唐明明
308aeeafb5 新增退货流程 2023-08-28 17:51:33 +08:00
唐明明
d9f7a0e1ef 调整详情 2023-08-25 14:09:43 +08:00
唐明明
31762adaf6 详情 2023-08-25 14:08:49 +08:00
唐明明
b4d5b974e1 商品详情分享 2023-08-25 14:07:34 +08:00
唐明明
0f7c37d548 新增分享,找回密码,实名认证,签约 2023-08-25 14:04:31 +08:00
197 changed files with 7135 additions and 1784 deletions

View File

@@ -24,6 +24,24 @@ import site from "./interfaces/site"
// 个人中心
import user from "./interfaces/user"
// 支付收银台
import pay from "./interfaces/pay"
// 身份认证
import idcard from "./interfaces/idcard"
// 身份认证
import withdraw from "./interfaces/withdraw"
// 售后服务
import refund from "./interfaces/refund"
// 购物袋
import bag from "./interfaces/bag"
// 增收赋能
import empower from "./interfaces/empower"
export default {
auth,
bank,
@@ -31,5 +49,11 @@ export default {
mall,
order,
site,
user
user,
pay,
idcard,
withdraw,
refund,
bag,
empower
}

View File

@@ -4,29 +4,45 @@
*/
import { req } from "../request"
//登录
// 登录
const Login = data => req({
url: "user/auth/login",
method: "POST",
data: data
})
//注册
// 注册
const register = data => req({
url: "user/auth/register",
method: "POST",
data: data
})
//获取验证码
// 获取验证码
const getSms = data => req({
url: "user/auth/verify",
method: "POST",
data: data
})
// 找回密码
const resetPassword = data => req({
url : "user/auth/reset_password",
method : "POST",
data
})
/**
* 隐私协议
*/
const richText = id => req({
url: "cms/pages/" + id
})
export default ({
Login,
register,
getSms
getSms,
resetPassword,
richText
})

59
api/interfaces/bag.js Normal file
View File

@@ -0,0 +1,59 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
// 购物车数量
const count = () => req({
url: "mall/carts/count"
})
// 加入购物车
const add = data => req({
url : "mall/carts",
method : "POST",
data
})
// 购物车列表
const list = () => req({
url: "mall/carts"
})
// 购物车数量变更
const putNum = (cart_id, data) => req({
url : "mall/carts/" + cart_id,
method : "PUT",
data
})
// 删除产品
const del = cart_id => req({
url : "mall/carts/" + cart_id,
method : "DELETE"
})
// 购物车确认订单
const buyCarts = (data) => req({
url : "mall/buy/carts",
data
})
// 购物车下单
const postCarts = (data) => req({
url : "mall/buy/carts",
method : "POST",
data
})
export default ({
count,
add,
list,
putNum,
del,
buyCarts,
postCarts
})

72
api/interfaces/empower.js Normal file
View File

@@ -0,0 +1,72 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
//增收赋能
const lists = () => req({
url: "empower/index"
})
//增收赋能-详情
const info = (id) => req({
url: "empower/" + id + "/show"
})
//下单前置
const buyInit = (id, data) => req({
url : "empower/" + id + "/buy/init",
method : "POST",
data : data
})
//下单购买
const buy = (data) => req({
url : "empower/buy/order",
method : "POST",
data : data
})
// 订单列表初始化
const orderInit = () => req({
url : "empower/order/init"
})
// 订单列表
const orderList = (data) => req({
url : "empower/order/index",
data : data
})
// 取消订单
const orderCancel = (order) => req({
url : "empower/order/" + order + "/cancel",
})
// 核验列表
const codes = (data) => req({
url : "empower/code",
method : "POST",
data : data
})
// 确认核验
const sign = (data) => req({
url : "empower/code/sign",
method : "POST",
data : data
})
export default ({
lists,
info,
buyInit,
buy,
orderInit,
orderList,
orderCancel,
codes,
sign
})

50
api/interfaces/idcard.js Normal file
View File

@@ -0,0 +1,50 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req, upload } from "../request"
// 上传身份证
const updIdcard = (path, data) => upload({
key : "upload",
url : "user/certification/upload",
path,
data
})
// 提交身份信息
const ocr = data => {
console.log(data)
return req({
url : "user/certification",
data,
method : "POST"
})
}
// 获取认证信息
const getInfo = () => req({
url : "user/certification",
})
// 获取认证地址
const signUrl = data => req({
url : "user/certification/go_real",
data
})
// 获取签约地址
const pactUrl = () => req({
url : "user/certification/go_contract"
})
export default ({
updIdcard,
ocr,
getInfo,
signUrl,
pactUrl
})

View File

@@ -10,6 +10,12 @@ const Banner = () => req({
url: "mall/banners"
})
// 身份产品包
const idpackage = () => req({
url: "new/index"
})
//商品分类
const Categorie = data => req({
url: "mall/categories",
@@ -50,13 +56,22 @@ const articlesSee = (article_id) => req({
url: "cms/articles/" + article_id
})
//绑定业务员
const userBind = (data) => req({
url: "user/bind",
method: "POST",
data: data
})
export default ({
Banner,
idpackage,
Categorie,
Goods,
goodsSee,
place,
placeTrue,
articles,
articlesSee
articlesSee,
userBind
})

33
api/interfaces/pay.js Normal file
View File

@@ -0,0 +1,33 @@
import { req } from "../request"
// 订单信息
const info = data => req({
url : "payments/cashier_desk",
data: data
})
// 获取支付信息
const wechatPay = data => req({
url: "payments/cashier_desk/wechat",
data
})
// 查询支付结果
const payState = trade_id => req({
url: "payments/cashier_desk/show",
data: { trade_id }
})
// 宝付支付
const bfPay = data => req({
url: "payments/cashier_desk/baofu",
data
})
export default ({
info,
wechatPay,
payState,
bfPay
})

63
api/interfaces/refund.js Normal file
View File

@@ -0,0 +1,63 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
// 售后服务
const list = data => req({
url : "mall/refunds",
data
})
// 用户退货
const deliver = (refund, data) => req({
url: "mall/refunds/" + refund + "/deliver",
method: "POST",
data
})
// 退货详情
const info = refund => req({
url: "mall/refunds/" + refund
})
// 退货日志
const log = refund => req({
url: "mall/refunds/" + refund + "/logs"
})
// 申请售后前置
const refundPreposition = id => req({
url: "mall/orders/" + id + "/refund"
})
// 提交退货
const submitRefund = (id, data) => req({
url : "mall/orders/" + id + "/refund",
method : "POST",
data
})
// 取消退货
const refundsCancel = id => req({
url : "mall/refunds/" + id + "/cancel",
method : "POST",
})
// 退货前置
const deliverInit = id => req({
url : "mall/refunds/" + id + "/deliver_init"
})
export default ({
list,
deliver,
info,
log,
refundPreposition,
submitRefund,
refundsCancel,
deliverInit
})

View File

@@ -22,8 +22,9 @@ const setting = (key, data) => req({
})
//我的余额首页
const account = () => req({
url: "user/account/index"
const account = data => req({
url: "user/account/index",
data
})
// 小程序码
@@ -38,11 +39,18 @@ const teamList = data => req({
data: data
})
// 邀请码背景
const poster = (data) => req({
url: "user/posters",
data: data
})
export default ({
userIndex,
userSetup,
setting,
account,
miniShare,
teamList
teamList,
poster
})

View File

@@ -0,0 +1,23 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
// 账户提现前置
const create = () => req({
url: "withdraws/index/create",
})
// 提现
const withdraws = data => req({
url : 'withdraws/index',
method : 'POST',
data
})
export default ({
create,
withdraws
})

View File

@@ -3,16 +3,13 @@
* 愿这世界都如故事里一样 美好而动人~
*/
import {errInfo} from './err'
import {updToken} from './updateToken'
import { errInfo } from './err'
import { updToken } from './updateToken'
// 请求方式配置
// //正式地址
// https://api.xhtest.douhuofalv.com/api/ //测试地址
// wx989712ad2d06a40b 测试appid 三猿
// wx7662853c6f7f46b4 正式appid
// 正式环境
const api = "https://api.xhtest.douhuofalv.com/api/" // 测试环境
// 正式地址
// const api = "https://api.xuanhuojk.com/api/"
// 测试地址
const api = "https://api.xhtest.douhuofalv.com/api/"
const header = {
"Accept" : "application/json"
}

3
app.js
View File

@@ -48,6 +48,7 @@ App({
},
globalData: {
isUser : false,
barHeight : ''
barHeight : '',
invite : ''
}
})

View File

@@ -24,7 +24,28 @@
"pages/user/team/index",
"pages/user/code/code",
"pages/bankCard/index",
"pages/bankCard/bankAdd/bankAdd"
"pages/bankCard/bankAdd/bankAdd",
"pages/sign/sign",
"pages/idcard/idcard",
"pages/idcard/signUrl/signUrl",
"pages/idcard/success/success",
"pages/idcard/eSign/eSign",
"pages/withdraw/withdraw",
"pages/pay/success/success",
"pages/resetPassword/resetPassword",
"pages/refund/refund",
"pages/refund/aftersale/aftersale",
"pages/refund/info/info",
"pages/refund/deliver/deliver",
"pages/refund/logs/logs",
"pages/richText/richText",
"pages/bag/bag",
"pages/bag/bagConfirm/bagConfirm",
"pages/empower/index",
"pages/empower/writeOff/writeOff",
"pages/empower/empowerInfo/empowerInfo",
"pages/empower/empowerBuy/empowerBuy",
"pages/empower/empowerOrder/empowerOrder"
],
"window": {
"backgroundTextStyle": "light",
@@ -47,16 +68,31 @@
"selectedIconPath": "/static/tabBarIcon/tabBar_selected_01.png"
},
{
"pagePath": "pages/user/index",
"text": "我的",
"pagePath": "pages/bag/bag",
"text": "购物袋",
"iconPath": "/static/tabBarIcon/tabBar_03.png",
"selectedIconPath": "/static/tabBarIcon/tabBar_selected_03.png"
},
{
"pagePath": "pages/user/index",
"text": "我的",
"iconPath": "/static/tabBarIcon/tabBar_04.png",
"selectedIconPath": "/static/tabBarIcon/tabBar_selected_04.png"
}
],
"color": "#999999",
"selectedColor": "#da2b54",
"borderStyle": "white"
},
"requiredPrivateInfos": [
"chooseAddress",
"getFuzzyLocation"
],
"permission": {
"scope.getFuzzyLocation": {
"desc": "位置信息仅用于商品配送"
}
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

View File

@@ -9,23 +9,27 @@ Page({
* 页面的初始数据
*/
data: {
logsArr : [], //列表数据
score : '', //数据
page : {}, //分页信息
lodingStats : false, //加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
account : {
all_in : '0.00',
balance : '0.00',
frozen : '0.00'
},
logsArr : [],
page : { current: 1 },
pageLoding : false,
needSign : false,
examine : ''
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 页面数据
this.setData({
logsArr: [],
page : { current: 1 }
})
// 获取账户信息
this.accountInfo()
},
@@ -33,32 +37,21 @@ Page({
/**
* 获取账户信息
*/
accountInfo(page) {
accountInfo() {
wx.$api.user.account({
page: page
page: this.data.page.current
}).then(res => {
console.log(res.data)
let listArr = this.data.logsArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.logs.data)
let { all_in, balance, frozen, need_sign, examine, logs } = res.data
this.setData({
score : res.data,
logsArr : newData,
page : res.data.logs.page,
lodingStats : false
account : { all_in, balance, frozen },
needSign : need_sign,
examine : examine,
logsArr : logs.page.current == 1 ? logs.data : this.data.logsArr.concat(logs.data),
page : logs.page,
pageLoding : !logs.page.has_more
})
wx.stopPullDownRefresh()
}).catch(err => { })
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取账户信息
this.accountInfo();
})
},
/**
@@ -66,13 +59,42 @@ Page({
*/
onReachBottom(){
this.setData({
lodingStats: true
pageLoding: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取账户信息
this.accountInfo(pageNumber);
let atpage = this.data.page
atpage.current += 1
this.setData({
page: atpage
})
this.accountInfo()
}
},
/**
* 提现
*/
onWithdraw(){
console.log(this.data.needSign)
if(this.data.needSign){
wx.showModal({
title : '提示',
content : '您还未完成实名认证与签约成为VIP用户暂时无法提现',
cancelText : '稍后完成',
confirmText : '立即完善',
confirmColor : '#da2b54',
complete : res => {
if (res.confirm) {
wx.navigateTo({
url: '/pages/idcard/idcard'
})
}
}
})
return
}
wx.navigateTo({
url: '/pages/withdraw/withdraw'
})
}
})

View File

@@ -1,50 +1,61 @@
<view class="top">
<view class="topSee">
<view class="topSee-name">账户余额(元)<image src="/static/icons/see_active.png" mode="widthFix"></image>
</view>
<view class="topSee-number">{{score.balance}}</view>
<view class="topSee-name">账户余额(元)</view>
<view class="topSee-number">{{account.balance}}</view>
</view>
<view class="topBtn" wx:if="{{score.can_withdraw}}">提现</view>
<view class="topBtn" bind:tap="onWithdraw">提现</view>
</view>
<view class="content">
<view class="tab">
<view class="tab-item">
<view class="tab-name">待发放(元)</view>
<view class="tab-number">{{score.frozen}}</view>
</view>
<view class="tab-item">
<view class="tab-name">总收入(元)</view>
<view class="tab-number">{{score.all_in}}</view>
</view>
<!-- 账户统计 -->
<view class="tab">
<view class="tab-item">
<view class="tab-name">待发放(元)</view>
<view class="tab-number">{{account.frozen}}</view>
</view>
<view class="tab-item">
<view class="tab-name">总收入(元)</view>
<view class="tab-number">{{account.all_in}}</view>
</view>
</view>
<!-- 进图条 -->
<view class="bar" wx:if="{{examine.show}}">
<view class="bar-title">
<view class="bar-title-left">销售补贴考核进度</view>
<view>¥{{examine.amount}} <text>元</text></view>
</view>
<view class="bar-line">
<view class="progress" style="width: 100%"></view>
<view class="progress-box" style="width: {{examine.amount < examine.need ? examine.amount : '100'}}%">
<!-- <view class="progress-box-name {{examine.amount == 0 ? 'active' : ''}}" wx:if="{{examine.need != examine.amount}}">{{examine.amount}}</view> -->
</view>
<view class="progress-see-name">
<view class="progress-see-name-left">0</view>
<view>{{examine.need}}</view>
</view>
<!-- <view class="progress" style="width: {{examine.need}}%">
<view class="progress-box" style="width: {{examine.amount < examine.need ? examine.amount : '100'}}%">
<view class="progress-box-name {{examine.amount == 0 ? 'active' : ''}}" wx:if="{{examine.need != examine.amount}}">{{examine.amount}}</view>
</view>
<view class="progress-name">{{examine.need}}</view>
</view> -->
</view>
</view>
<!-- 收益明细 -->
<view class="detailed active">
<view class="listTitle">
收益明细
</view>
<view class="listTitle">收益明细</view>
<view class="list" wx:if="{{logsArr.length > 0}}">
<view class="list-item" wx:for="{{logsArr}}" wx:key="logsArr">
<view class="item-top">
<view class="item-name">
当月贡献发放
</view>
<view class="item-time">
2023-05-22
</view>
</view>
<view class="item-number">
+100
<view class="item-text">
<view class="item-name">{{item.remark}}</view>
<view class="item-time">{{item.created_at}}</view>
</view>
<view class="item-number">{{item.amount}}</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 class="pagesLoding" wx:if="{{pageLoding}}">
<view wx:if="{{page.has_more}}"><image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...</view>
<view wx:else>没有更多了~</view>
</view>
</view>
<view class="pages-no" wx:else>

View File

@@ -1,126 +1,40 @@
page {
background-color: #f6f6f6;
}
page { background-color: #f6f6f6; }
.top {
background-image: linear-gradient(to bottom, #dc3159, #f46284);
color: #ffffff;
padding: 40rpx 40rpx 120rpx;
box-sizing: border-box;
display: flex;
}
/* 账户余额 */
.top { background-image: linear-gradient(to bottom, #dc3159, #f46284); color: #ffffff; padding: 40rpx 40rpx 120rpx; box-sizing: border-box; display: flex; align-items: center; }
.topSee { width: calc(100% - 180rpx); padding-right: 30rpx; box-sizing: border-box; }
.topSee-name { line-height: 40rpx; font-size: 30rpx; align-items: center; }
.topSee-number { font-size: 64rpx; letter-spacing: 2rpx; font-weight: bold; }
.topBtn { background-color: #ffffff; display: inline-block; color: #da2b54; line-height: 74rpx; border-radius: 37rpx; width: 180rpx; text-align: center; font-weight: bold; font-size: 32rpx; }
.topSee {
flex: 1;
}
/* 账户统计 */
.tab { background-color: #ffffff; border-radius: 20rpx; padding: 40rpx 30rpx; box-sizing: border-box; display: flex; margin: -70rpx 30rpx 0; }
.tab-item { text-align: center; width: 50%; }
.tab-name{ font-size: 28rpx; color: gray; }
.tab-number { font-size: 34rpx; font-weight: bold; margin-top: 5rpx; }
.topSee-name {
display: flex;
line-height: 40rpx;
}
/* 进度条 */
.bar {margin: 30rpx; background-color: #ffffff; border-radius: 20rpx;box-sizing: border-box; padding: 30rpx;}
.bar-title {font-weight: 600; margin-bottom: 30rpx; display: flex;}
.bar-title-left {flex: 1;}
.bar-line {width: 100%; height: 70rpx; overflow: hidden;position: relative;}
.progress {height: 20rpx; background-color: #ffb0c2;position: absolute; left: 0; top: 0;}
.progress-box {position: absolute; background-color: #dc3159; height: 20rpx;}
.progress-box-name {right: 0rpx;top: 35rpx;position: absolute; font-size: 24rpx; color: #dc3159;}
.progress-box-name.active {right: -15rpx;}
.progress-name {position: absolute;right: 0rpx;top: 35rpx; font-size: 24rpx; color: rgb(146, 146, 146);}
.progress-see-name {display: flex; margin-top: 30rpx;}
.progress-see-name-left {flex: 1;}
.topSee-name image {
width: 34rpx;
margin: 5rpx 20rpx;
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
filter: brightness(0%) invert(100%);
-webkit-filter: brightness(0%) invert(100%);
}
.topSee-number {
font-size: 60rpx;
margin-top: 20rpx;
letter-spacing: 2rpx;
}
.topBtn {
background-color: #ffffff;
display: inline-block;
color: #da2b54;
padding: 0 50rpx;
border-radius: 80rpx;
height: 68rpx;
line-height: 68rpx;
margin-top: 40rpx;
}
.content {
padding: 0 30rpx;
box-sizing: border-box;
margin-top: -70rpx;
}
.tab {
background-color: #ffffff;
border-radius: 20rpx;
padding: 40rpx 10rpx;
box-sizing: border-box;
display: flex;
}
.tab-item {
text-align: center;
flex: 2;
}
.tab-number {
font-size: 44rpx;
margin-top: 20rpx;
}
.listTitle {
padding: 30rpx 30rpx 0;
font-weight: 600;
box-sizing: border-box;
font-size: 32rpx;
}
.list {
padding: 30rpx;
box-sizing: border-box;
}
.list-item {
background-color: #fff;
border-radius: 20rpx;
margin-bottom: 30rpx;
padding: 30rpx;
box-sizing: border-box;
display: flex;
}
.item-top {
flex: 1;
}
.item-name {
font-size: 30rpx;
}
.item-number {
color: #da2b54;
font-weight: 600;
font-size: 38rpx;
line-height: 90rpx;
}
.item-time {
color: #999999;
font-size: 28rpx;
margin-top: 15rpx;
}
/* 收益明细 */
.listTitle { padding: 30rpx 30rpx 0; font-weight: 600; box-sizing: border-box; font-size: 30rpx; }
.list { padding: 30rpx; box-sizing: border-box;}
.list-item { background-color: #fff; border-radius: 20rpx; margin-bottom: 20rpx; padding: 30rpx; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; }
.item-text{ width: calc(100% - 200rpx); }
.item-name { font-size: 30rpx; font-weight: bold; line-height: 40rpx; }
.item-time { font-size: 28rpx; line-height: 40rpx; color: gray; margin-top: 5rpx; }
.item-number { color: #da2b54; font-size: 34rpx; font-weight: bold; width: 200rpx; text-align: right; padding-left: 20rpx; box-sizing: border-box; }
/* 暂无数据 */
.pages-no {
background-color: #fff;
margin-top: 30rpx;
text-align: center;
padding: 120rpx 0;
color: #6d6d6d;
font-size: 28rpx;
}
.pages-no image {
width: 180rpx;
}
.pages-no { background-color: #fff; margin: 30rpx; border-radius: 20rpx; display: flex; align-items: center; justify-content: center; flex-direction: column; color: #6d6d6d; font-size: 28rpx; height: 55vh; }
.pages-no image { width: 180rpx; height: 180rpx; }

313
pages/bag/bag.js Normal file
View File

@@ -0,0 +1,313 @@
var goodsIndex = '',
sellerIndex = ''
Page({
/**
* 页面的初始数据
*/
data: {
bags : [], // 购物车列表
isUser : false, // 是否登录
bagId : '',
allCheckbox : false,
bagNumber : 0,
allPrice : '0.00',
bagOrderLoading : false
},
/**
* 生命周期函数 - 页面显示
*/
onShow(){
let token = wx.getStorageSync('token') || null
this.setData({
isUser : token != null,
bagOrderLoading : false,
allCheckbox : false,
bagNumber : 0,
allPrice : '0.00',
bagId : '',
})
if(token != null){
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.bag.list().then(res => {
res.data.map(val => {
val.shop.mallState = false
val.items.map(val => {
val.state = false
})
})
this.setData({
pagesLoding: false,
bags : res.data
})
wx.hideLoading()
})
}
},
/**
* 商品数量加减
*/
goodsNumber(e){
goodsIndex = e.currentTarget.dataset.goods
sellerIndex = e.currentTarget.dataset.seller
let goodsNumber = this.data.bags[sellerIndex].items[goodsIndex].qty
if (e.currentTarget.dataset.type == 'plus'){
goodsNumber = goodsNumber + 1
}else{
if (goodsNumber > 1){
goodsNumber = goodsNumber - 1
}else{
wx.showToast({
title : '商品数量不能小于1',
icon : 'none'
})
return
}
}
this.setnumNumber(goodsIndex, sellerIndex, goodsNumber)
},
/**
* 输入商品数量
*/
goodsNumberInput(e){
goodsIndex = e.currentTarget.dataset.goods
sellerIndex = e.currentTarget.dataset.seller
let setnumNumber = this.data.bags[sellerIndex].items[goodsIndex].number,
inputValue = Number()
if (e.detail.value > 0){
inputValue = Number(e.detail.value)
}else{
wx.showToast({
title : '商品数量不能小于1',
icon : 'none'
})
inputValue = Number(setnumNumber)
}
this.setnumNumber(goodsIndex, sellerIndex, inputValue)
},
/**
* 更新商品数量
*/
setnumNumber(goodsIndex, sellerIndex, setnumNumber){
wx.showLoading({
title: '加载中',
})
let atGoods = this.data.bags
wx.$api.bag.putNum(atGoods[sellerIndex].items[goodsIndex].cart_id, {
qty : setnumNumber,
sku_id: atGoods[sellerIndex].items[goodsIndex].sku_id
}).then(res => {
atGoods[sellerIndex].items[goodsIndex].qty = res.data
this.setData({
bags: atGoods
})
this.totalPrice()
wx.hideLoading()
})
},
/**
* 单选
*/
checkbox(e){
goodsIndex = e.currentTarget.dataset.goods
sellerIndex = e.currentTarget.dataset.seller
console.log(e.currentTarget.dataset)
let goodsList = this.data.bags,
checkbox = goodsList[sellerIndex].items[goodsIndex].state,
seller = goodsList[sellerIndex].items,
sellerLength = 0
goodsList[sellerIndex].items[goodsIndex].state = !checkbox
for (let i in seller){
if (seller[i].state){
sellerLength++
if (sellerLength == goodsList[sellerIndex].items.length){
goodsList[sellerIndex].shop.mallState = true
}
}else{
goodsList[sellerIndex].shop.mallState = false
this.setData({
allCheckbox: false
})
}
}
this.allCheckbox('checkbox')
this.setData({
bags: goodsList
})
this.totalPrice()
},
/**
* 店铺全选
*/
sellerCheckbox(e){
sellerIndex = e.currentTarget.dataset.seller
let goodsList = this.data.bags,
allCheckbox = this.data.allCheckbox,
seller = goodsList[sellerIndex].shop.mallState,
sellerLengh = 0
goodsList[sellerIndex].shop.mallState = !seller
for (let i in goodsList[sellerIndex].items){
goodsList[sellerIndex].items[i].state = !seller
}
for (let j in goodsList){
if (goodsList[j].shop.mallState){
sellerLengh++
if (sellerLengh == goodsList.length){
console.log('全选')
allCheckbox = true
}else{
console.log('取消全选')
allCheckbox = false
}
}
}
if(sellerLengh == 0) {allCheckbox = false}
this.allCheckbox('checkbox')
this.setData({
bags : goodsList,
allCheckbox : allCheckbox
})
this.totalPrice()
},
/**
* 全选
*/
allCheckbox(type){
console.log(type)
let goodsLenght = 0,
allCheckbox = this.data.allCheckbox,
goodsList = this.data.bags
if (type == 'checkbox'){
for (let j in goodsList) {
if (goodsList[j].shop.mallState) {
goodsLenght++
if (goodsLenght == goodsList.length) {
allCheckbox = true
}
}
}
}else{
allCheckbox = !allCheckbox
for (var i in goodsList){
goodsList[i].shop.mallState = allCheckbox
for (let k in goodsList[i].items){
goodsList[i].items[k].state = allCheckbox
}
}
}
this.setData({
allCheckbox : allCheckbox,
bags : goodsList
})
this.totalPrice()
},
/**
* 计算价格
*/
totalPrice() {
let bagNumber = 0,
allPrice = 0,
bagIdArr = [],
goodsList = this.data.bags
for (var i in goodsList){
for (let j in goodsList[i].items){
if (goodsList[i].items[j].state){
bagNumber = bagNumber + goodsList[i].items[j].qty
allPrice = allPrice + (goodsList[i].items[j].qty * goodsList[i].items[j].price)
bagIdArr.push(goodsList[i].items[j].cart_id)
}
}
}
this.setData({
bagNumber : bagNumber,
allPrice : allPrice.toFixed(2),
bagId : bagIdArr.join(",")
})
},
/**
* 购物车提交
*/
bagOrder(){
this.setData({
bagOrderLoading:true
})
if (this.data.bagId != ''){
wx.navigateTo({
url: './bagConfirm/bagConfirm?skuId=' + this.data.bagId
})
// setTimeout(() => {
// this.setData({
// bagOrderLoading: false
// })
// }, 2000)
}else{
wx.showToast({
title : '请选择结算商品',
icon : 'none'
})
this.setData({
bagOrderLoading: false
})
}
},
/**
* 菜单
*/
actionSheet(e){
goodsIndex = e.currentTarget.dataset.goods
sellerIndex = e.currentTarget.dataset.seller
let goodsList = this.data.bags,
cartId = this.data.bags[sellerIndex].items[goodsIndex].cart_id
wx.showActionSheet({
itemList: ['删除'],
success : res=>{
wx.showLoading({
title: '加载中',
})
wx.$api.bag.del(cartId).then(res => {
goodsList[sellerIndex].items.splice([goodsIndex],1)
if (goodsList[sellerIndex].items.length == 0){
goodsList.splice([sellerIndex], 1)
}
this.setData({
bags: goodsList
})
this.totalPrice()
wx.showToast({
title: '已删除'
})
})
}
})
},
})

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

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "购物车"
}

67
pages/bag/bag.wxml Normal file
View File

@@ -0,0 +1,67 @@
<view class="content">
<block wx:if="{{isUser}}">
<!-- 工具栏 -->
<view class="bag-header">
<view class="bag-header-add-select">
<view class="checkbox allCheckbox">
<checkbox checked="{{allCheckbox}}" bindtap="allCheckbox"></checkbox>
</view>
全选
</view>
</view>
<!-- 购物袋 -->
<view class="bag-content" wx:if="{{bags.length > 0}}">
<view class="bag-content-mall" wx:for="{{bags}}" wx:key="bagList" wx:for-item="bagList" wx:for-index="sellerIndex">
<view class="bag-content-mall-name nowrap">
<view class="checkbox sellerCheckbox">
<checkbox checked="{{bagList.shop.mallState}}" data-seller="{{sellerIndex}}" bindtap="sellerCheckbox"></checkbox>
</view>
{{ bagList.shop.name }}
</view>
<view class="bag-content-mall-goods" wx:for="{{bagList.items}}" wx:key="mallGood" wx:for-index="goodsIndex">
<view class="checkbox">
<checkbox checked="{{item.state}}" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="checkbox"></checkbox>
</view>
<image class="mall-good-cover" src="{{item.cover}}" mode="aspectFill"></image>
<view class="mall-good-content">
<view class="mall-good-title nowrap">{{item.name}}</view>
<view class="mall-good-value nowrap">{{item.sku_name}}</view>
<view class="mall-good-price nowrap">
¥{{item.price}}
<view class="mall-good-number">
<view class="mall-good-number-btn" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="goodsNumber" data-type="remove">-</view>
<input class="mall-good-number-input" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" value="{{item.qty}}" type="number" bindblur="goodsNumberInput"></input>
<view class="mall-good-number-btn" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}" bindtap="goodsNumber" data-type="plus">+</view>
</view>
</view>
</view>
<view class="mall-good-more" bindtap="actionSheet" data-seller="{{sellerIndex}}" data-goods="{{goodsIndex}}">
<image src="/static/icons/bag_more_icon.png" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<!-- 购物袋为空 -->
<view class="pack-center pages-hint" wx:else>
<image src="/static/icons/carnull_icon.png"></image>
<view>购物袋中暂无任何商品</view>
</view>
<!-- 结算 -->
<view class="bag-footer">
<view class="bag-footer-price">合计<text>¥{{allPrice}}</text></view>
<view class="bag-footer-rests">共计{{bagNumber}}件</view>
<button class="bag-footer-btn" size="mini" bindtap="bagOrder" disabled="{{bagOrderLoading}}" loading="{{bagOrderLoading}}">结算</button>
</view>
</block>
<block wx:else>
<!-- 用户未登录 -->
<view class="pack-center pages-loding auth-login">
<view>您还未登录,无法查看您的购物车信息</view>
<navigator class="auth-btn" url="/pages/login/index">登录</navigator>
</view>
</block>
</view>

115
pages/bag/bag.wxss Normal file
View File

@@ -0,0 +1,115 @@
.content{ background: #f7f8f9; min-height: 100vh; }
.pack-center {z-index: 9;}
/* 工具栏 */
.bag-header{ border-bottom: solid 1rpx #f1f1f1; padding: 25rpx 30rpx; overflow: hidden; position: fixed; width: 100%; top: 0; left: 0; box-sizing: border-box; line-height: 40rpx; }
/* 购物车列表 */
.bag-content{ padding: 90rpx 0 140rpx 0; background: #f7f8f9; }
.bag-content-mall{ background: white; margin-top: 30rpx; padding-bottom: 20rpx; }
.bag-content-mall-name{ line-height: 80rpx; padding: 0 30rpx; border-bottom: solid 1rpx #f1f1f1; }
.bag-content-mall-goods{ position: relative; padding: 20rpx 30rpx 0 30rpx; }
.mall-good-cover{
width: 148rpx;
height: 148rpx;
background: #f5f6fa;
vertical-align: top;
}
.mall-good-content{
position: absolute;
top: 20rpx;
left: 268rpx;
right: 96rpx;
}
.mall-good-value{
color: #747788;
font-size: 24rpx;
line-height: 40rpx;
}
.mall-good-title{
line-height: 40rpx;
}
.mall-good-price{
color: #e92344;
padding-top: 20rpx;
line-height: 48rpx;
font-weight: bold;
padding-right: 200rpx;
position: relative;
}
.mall-good-number{
display: flex;
position: absolute;
right: 0;
top: 18rpx;
width: 180rpx;
font-weight: normal;
text-align: center;
height: 50rpx;
}
.mall-good-number-btn{
width: 50rpx;
}
.mall-good-number-input{
flex: 1;
margin: 0 6rpx;
height: 50rpx;
line-height: 50rpx;
}
.mall-good-number-input,
.mall-good-number-btn{
background: #f5f6fa;
color: #464854;
}
.mall-good-more{
height: 148rpx;
line-height: 148rpx;
width: 36rpx;
padding: 0 30rpx;
position: absolute;
top: 20rpx;
right: 0;
}
.mall-good-more image{
width: 100%;
vertical-align: middle;
}
/* footer */
.bag-footer{ position: fixed; bottom: 0; left: 0; width: 100%; padding: 20rpx 300rpx 20rpx 30rpx; box-sizing: border-box; border-top: solid 1rpx #f1f1f1; }
.bag-footer, .bag-header{ background: white; z-index: 9; }
.bag-footer-price{ font-size: 32rpx; font-weight: bold; }
.bag-footer-price text{ color: #da2b54; }
.bag-footer-rests{ color: #747788; font-size: 26rpx; }
.bag-footer-rests,
.bag-footer-price{ line-height: 40rpx; }
.bag-footer-btn[size="mini"]{ position: absolute; right: 30rpx; top: 20rpx; width: 240rpx; height: 80rpx; line-height: 80rpx; border-radius: 40rpx; background: #da2b54; color: white; font-size: 32rpx; }
.bag-footer-btn::after{ border: none; }
/* checkbox */
.checkbox{ height: 40rpx; width: 40rpx; line-height: 40rpx; display: inline-block; padding-top: 54rpx; padding-right: 30rpx; }
.checkbox.sellerCheckbox,
.checkbox.allCheckbox{ padding-top: 0; }
.checkbox.allCheckbox{ padding-right: 10rpx; }
.checkbox checkbox{ vertical-align: top; margin-top: -2rpx; }
.checkbox checkbox .wx-checkbox-input{ background: white; border-radius: 50%; border:solid 3rpx #464854; height: 34rpx; width: 34rpx; }
.checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked{ background: #da2b54; border-color: #da2b54; }
.checkbox checkbox .wx-checkbox-input.wx-checkbox-input-checked:before{ top: 18rpx; right: 5rpx; color: white; line-height: 34rpx; text-align: center; width: 36rpx; height: 36rpx; font-size:36rpx; }
/* 未登录 */
.auth-login{ text-align: center; font-size: 28rpx; color: gray; background: white; }
.auth-login image{ width: 218rpx; height: 218rpx; margin-bottom: 30rpx; }
.auth-btn{ background: #da2b54; display: inline-block; width: 240rpx; height: 80rpx; line-height: 80rpx; border-radius: 40rpx; font-size: 32rpx; color: white; margin-top: 100rpx; }

View File

@@ -0,0 +1,105 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
disabled : true, //按钮
skuId : '',
address : '', // 地址
goodskData : '', // 数据
amount : '', // 商品总金额
total : '', // 支付金额
freight : '', // 运费
weight : '', // 重量
distribution : [
{ type: 0, title: "选择配送方式" },
{ type: 1, title: "快递" },
{ type: 2, title: "自提" },
],
distributionIndex: 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
skuId : options.skuId
})
// 获取商品下单信息
this.placeInfo(options.skuId);
},
/**
* 配送方式选择
*/
distributionChange(e){
if(e.detail.value === this.data.distributionIndex) return
this.setData({
distributionIndex: e.detail.value
})
this.placeInfo(this.data.skuId);
},
/**
* 商品下单信息
*/
placeInfo(skuid, type) {
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.bag.buyCarts({
cart_ids : skuid,
address_id : this.data.address.address_id || '',
delivery_type: this.data.distributionIndex
}).then(res => {
if(type != 'chooseAdd'){
this.setData({
address: res.data.address,
})
}
this.setData({
goodskData: res.data.detail,
amount : res.data.amount,
total : res.data.total,
freight : res.data.freight,
weight : res.data.weight
})
wx.hideLoading()
})
},
/**
* 商品确认下单
*/
buyTap() {
if(this.data.distributionIndex == 0){
wx.showToast({
title: '请选择配送方式',
icon : 'none'
})
return
}
wx.showLoading({
title: '下单中...',
mask : true
})
wx.$api.bag.postCarts({
cart_ids : this.data.skuId,
address_id : this.data.address.address_id,
remark : '',
delivery_type : this.data.distributionIndex
}).then(res => {
wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
})
wx.hideLoading()
}).catch(() =>{}).finally(() => {})
},
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "购物车订单确认"
}

View File

@@ -0,0 +1,83 @@
<view class="borderBottom">
<!-- 地址 -->
<view class="address" wx:if="{{distributionIndex == 1}}">
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress&skuid={{skuId}}&qty={{goodsQty}}" class="address-cont" wx:if="{{address}}">
<view class="address-top">
<view class="address-area">
<image class="address-icon" src="/static/icons/address.png" mode="widthFix"></image>{{address.province.name}}{{address.city.name}}
</view>
<view class="address-text">{{address.full_address}}</view>
</view>
<view class="address-name">
{{address.name}}<text>{{address.mobile}}</text>
</view>
<image class="address-arrow" src="/static/icons/orderArrow.png"></image>
</navigator>
<view class="address-add" wx:else>
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress&skuid={{skuId}}&qty={{goodsQty}}" class="address-go">新增收货地址 +</navigator>
</view>
<image class="address-img" src="/static/imgs/address.png" mode="widthFix"></image>
</view>
<!-- 商品 -->
<view class="more-goods-block">
<view class="more-goods" wx:for="{{goodskData}}" wx:key="stockData">
<view class="more-name">
<image src="/static/icons/shopIcon.png"></image>{{item.shop.name}}
</view>
<view class="list-goods" wx:for="{{item.items}}" wx:key="items" wx:for-item="items">
<image class="list-goods-img" mode="aspectFill" src="{{items.cover ? items.cover : '/static/ls/1.jpg'}}"></image>
<view class="list-goods-cont">
<view class="nowrap list-goods-name">{{items.title}}</view>
<view class="list-goods-text">
<text>购买数量</text> x{{items.qty}}
</view>
<view class="list-goods-parice">
¥<text>{{items.price}}</text>
</view>
</view>
</view>
</view>
</view>
<!-- 配送方式 -->
<view class="label">
<view class="label-item">
<view class="label-name">配送方式</view>
<picker range="{{distribution}}" range-key="title" class="label-picker" value="{{distributionIndex}}" bindchange="distributionChange">
<view class="label-picker-val">{{distribution[distributionIndex].title}}<image class="label-picker-icon" src="/static/icons/arrow_more.png"></image>
</view>
</picker>
</view>
<!-- <navigator class="label-item" wx:if="{{distributionIndex == 1}}" url="/pages/store/store">
<view class="label-name">自提门店</view>
<view class="label-text">华鸿国际自提点<image class="label-picker-icon" src="/static/icons/arrow_more.png"></image></view>
</navigator> -->
</view>
<!-- 规格 -->
<view class="label">
<view class="label-item" wx:if="{{distributionIndex == 0}}">
<view class="label-name">快递</view>
<view class="label-text">{{freight == 0 ? '免邮' : '¥' + freight + '元'}}</view>
</view>
<view class="label-item">
<view class="label-name">重量</view>
<view class="label-text">{{weight}}g</view>
</view>
<view class="label-item">
<view class="label-name">金额</view>
<view class="label-integral">¥{{amount}}</view>
</view>
</view>
</view>
<!-- 底部 -->
<view class="footer">
<view class="number">
<view class="number-vip">合计:</view>
<text>¥</text>
<view class="number-price">{{total}}</view>
</view>
<view class="btn {{disabled ? '': 'active'}}" bindtap="buyTap">立即支付</view>
</view>

View File

@@ -0,0 +1,322 @@
page {
background-color: #f5f6f8;
padding: 30rpx;
box-sizing: border-box;
}
.borderBottom {
border-bottom: 110rpx solid transparent;
}
/* 地址 */
.address {
background-color: #FFFFFF;
border-radius: 15rpx;
overflow: hidden;
position: relative;
margin-bottom: 30rpx;
}
.address-arrow {
position: absolute;
right: 15rpx;
top: 78rpx;
width: 50rpx;
height: 50rpx;
}
.address-cont {
padding: 30rpx;
box-sizing: border-box;
}
.address-top {
width: calc(100% - 80rpx);
}
.address-area {
color: #585866;
font-size: 28rpx;
display: flex;
line-height: 40rpx;
}
.address-icon {
width: 40rpx;
margin-right: 20rpx;
}
.address-text {
font-weight: 600;
padding: 10px 0;
}
.address-name text {
color: #585866;
padding-left: 30rpx;
}
.address-img {
width: 100%;
height: 10rpx;
display: block;
}
.address-add {
width: 100%;
text-align: center;
padding: 30rpx 30rpx 0;
box-sizing: border-box;
}
.address-go {
display: inline-block;
font-size: 28rpx;
line-height: 68rpx;
border-radius: 10rpx;
color: #df723a;
padding-bottom: 20rpx;
}
/* 商品 */
.more-goods-block{
background-color: #FFFFFF;
border-radius: 15rpx;
}
.more-goods {
border-bottom: solid 1rpx #f7f8f9;
}
.more-goods:last-child{
border-bottom: none;
}
.more-name {
padding: 30rpx 30rpx 0;
box-sizing: border-box;
font-weight: 600;
display: flex;
line-height: 38rpx;
}
.more-name image {
width: 38rpx;
height: 38rpx;
margin-right: 10rpx;
}
.list-goods {
background-color: #FFFFFF;
display: flex;
padding: 30rpx;
border-radius: 15rpx;
box-sizing: border-box;
}
.list-goods-img {
width: 184rpx;
height: 184rpx;
margin-right: 30rpx;
border-radius: 10rpx;
}
.list-goods-cont {
width: calc(100% - 214rpx);
}
.list-goods-name {
font-size: 32rpx;
}
.list-goods-text {
line-height: 90rpx;
display: flex;
font-size: 28rpx;
color: #999999;
}
.list-goods-text text {
flex: 1;
}
.list-goods-parice {
font-size: 26rpx;
}
.list-goods-parice text {
font-size: 34rpx;
}
/* 规格 */
.label {
background-color: #FFFFFF;
border-radius: 15rpx;
overflow: hidden;
box-sizing: border-box;
margin-top: 30rpx;
}
.label-item {
display: flex;
line-height: 100rpx;
color: #585866;
font-size: 30rpx;
padding: 0 30rpx;
box-sizing: border-box;
border-bottom: 2rpx solid rgb(243, 243, 243);
}
.label-item:last-child {
border: none;
}
.label-integral {
color: #da2b54;
font-weight: 600;
}
.label-name {
flex: 1;
}
.label-picker{ width: 70%; }
.label-picker-val{ text-align: right; display: flex; align-items: center; justify-content: flex-end;}
.label-picker-icon{ width: 24rpx; height: 24rpx; margin-left: 10rpx; }
/*checkbox选中后样式 */
.label-text-checkbox {
margin-right: -14rpx;
margin-left: 10rpx;
}
.label-text-checkbox .wx-checkbox-input.wx-checkbox-input-checked {
background: #da2b54;
border-color: #da2b54;
}
.label-text-checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
width: 30rpx;
height: 30rpx;
line-height: 28rpx;
text-align: center;
font-size: 30rpx;
color: #fff;
background: transparent;
transform: translate(-50%, -50%) scale(1);
-webkit-transform: translate(-50%, -50%) scale(1);
}
.label-price {
text-align: right;
line-height: 90rpx;
font-size: 30rpx;
font-weight: 600;
padding: 0 30rpx 5rpx;
box-sizing: border-box;
}
.label-price text {
font-size: 34rpx;
padding: 0 10rpx;
}
.label-number {
display: flex;
margin-top: 25rpx;
height: 48rpx;
border: 2rpx solid #d7d7d7;
border-radius: 10rpx;
}
.number-btn {
background-color: transparent;
width: 48rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
}
.number-input {
width: 80rpx;
text-align: center;
height: 48rpx;
border-left: 2rpx solid #d7d7d7;
border-right: 2rpx solid #d7d7d7;
}
/* 底部 */
.footer {
width: 100%;
height: 60px;
background-color: #ffffff;
position: fixed;
left: 0;
bottom: 0;
z-index: 9;
box-sizing: border-box;
display: flex;
}
.number {
flex: 1;
line-height: 60px;
color: #da2b54;
display: flex;
padding: 0 30rpx;
box-sizing: border-box;
}
.number text {
font-size: 28rpx;
padding-top: 5rpx;
}
.number-price {
padding: 0 5rpx;
font-size: 40rpx;
}
.number-vip {
margin-left: 20rpx;
color: #8d97a1;
font-size: 28rpx;
}
.btn {
height: 100%;
background-color: #da2b54;
text-align: center;
color: #FFFFFF;
padding: 0 70rpx;
line-height: 60px;
}
.btn-disabled {
line-height: 60px;
text-align: center;
border: none;
border-radius:0;
background-color: #da2b54;
padding: 0;
margin: 0;
}
button[disabled]{
padding: 0;
padding: 0;
height: 60px;
line-height: 60px;
background-color: transparent !important;
}
.btn.active {
background-color: #cacaca;
}
.detailsBrief-back{
width: 100%;
}
.grey {
background-color: #f9f9f9;
z-index: 99999;
}

View File

@@ -25,12 +25,10 @@ Page({
type : options.type,
bankId: options.id
})
if(options.type == 'Compile') {
// 获取银行编辑信息
this.bankEdit();
}
},
/**
@@ -79,7 +77,6 @@ Page({
*/
siteform(val) {
let value = val.detail.value
console.log(value)
let data = {
name : value.name,
mobile : value.mobile,

View File

@@ -1,34 +1,62 @@
<!-- 添加地址 -->
<form bindsubmit="siteform" class="ce-radius site-form">
<view class="ce-white">
<view class="site-input">
<label>开户银行</label>
<picker bindchange="bankChange" value="{{bankIndex}}" range="{{bankArr}}" range-key="name" class="conneColor">
<view class="picker">
{{bankArr[bankIndex].name}}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>支行名称</label>
<input placeholder="请输入支行名称" name="branch_name" value="{{bankData.branch_name}}"></input>
</view>
<view class="site-input">
<label>银行卡号</label>
<input placeholder="请输入银行卡号" name="no" value="{{bankData.no}}"></input>
</view>
<view class="site-input">
<label>收款人姓名</label>
<input placeholder="请输入收款人姓名" name="name" value="{{bankData.name}}"></input>
</view>
<view class="site-input">
<label>收款人手机号</label>
<input placeholder="请输入开户账号手机号" name="mobile" type="number" maxlength="11" value="{{bankData.mobile}}"></input>
</view>
</view>
<view class="site-btn">
<button form-type="submit" size="mini" disabled="{{disabled}}">确认添加</button>
</view>
</form>
<view class="content">
<form bindsubmit="siteform">
<view class="form">
<view class="form-item">
<label class="form-label">开户银行</label>
<picker bindchange="bankChange" value="{{bankIndex}}" range="{{bankArr}}" range-key="name" class="form-picker">
<view class="form-picker-text">{{bankArr[bankIndex].name}}</view>
<image class="form-picker-icon" src="/static/icons/orderArrow.png" mode="widthFix"></image>
</picker>
</view>
<view class="form-item">
<label class="form-label">支行名称</label>
<input class="form-intpu" placeholder="请输入支行名称" name="branch_name" value="{{bankData.branch_name}}"></input>
</view>
<view class="form-item">
<label class="form-label">银行卡号</label>
<input class="form-intpu" placeholder="请输入银行卡号" name="no" value="{{bankData.no}}"></input>
</view>
<view class="form-item">
<label class="form-label">真实姓名</label>
<input class="form-intpu" placeholder="请输入收款人姓名" name="name" value="{{bankData.name}}"></input>
</view>
<view class="form-item">
<label class="form-label">预留手机</label>
<input class="form-intpu" placeholder="请输入开户账号手机号" name="mobile" type="number" maxlength="11" value="{{bankData.mobile}}"></input>
</view>
</view>
<!-- <view class="ce-white">
<view class="site-input">
<label>开户银行</label>
<picker bindchange="bankChange" value="{{bankIndex}}" range="{{bankArr}}" range-key="name" class="conneColor">
<view class="picker">
{{bankArr[bankIndex].name}}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>支行名称</label>
<input placeholder="请输入支行名称" name="branch_name" value="{{bankData.branch_name}}"></input>
</view>
<view class="site-input">
<label>银行卡号</label>
<input placeholder="请输入银行卡号" name="no" value="{{bankData.no}}"></input>
</view>
<view class="site-input">
<label>收款人姓名</label>
<input placeholder="请输入收款人姓名" name="name" value="{{bankData.name}}"></input>
</view>
<view class="site-input">
<label>收款人手机号</label>
<input placeholder="请输入开户账号手机号" name="mobile" type="number" maxlength="11" value="{{bankData.mobile}}"></input>
</view>
</view>
-->
<view class="btn">
<button form-type="submit" size="default" disabled="{{disabled}}">确认添加</button>
</view>
</form>
</view>

View File

@@ -1,137 +1,15 @@
.site-form {
margin: 20rpx;
display: block;
overflow: hidden;
}
.site-btn {
margin: 40rpx 0;
}
.content{ background: #f7f8f9; min-height: 100vh; padding: 30rpx; box-sizing: border-box; }
.site-input {
padding: 0 30rpx 0 280rpx;
position: relative;
line-height: 100rpx;
min-height: 100rpx;
}
/* 绑定银行卡 */
.form{ background: white; border-radius: 20rpx; padding: 15rpx 0; }
.form-item{ display: flex; justify-content: space-between; padding: 0 30rpx; height: 90rpx; line-height: 90rpx; align-items: center; }
.form-label{ width: 180rpx; font-size: 30rpx; }
.form-intpu{ width: calc(100% - 180rpx); height: 90rpx; line-height: 90rpx; font-size: 30rpx; }
.form-picker{ width: calc(100% - 180rpx); position: relative; }
.form-picker-text{ line-height: 90rpx; height: 90rpx; font-size: 30rpx; }
.form-picker-icon{ width: 48rpx; height: 48rpx; position: absolute; right: 0; top: 50%; margin-top: -24rpx; }
.site-input label {
position: absolute;
left: 30rpx;
top: 0;
}
.site-input input {
height: 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: #da2b54;
height: 90rpx;
line-height: 90rpx;
font-size: 30rpx;
color: white;
padding: 0;
}
.site-btn button[disabled] {
opacity: .6;
}
/* 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: #3ec28e;
}
.pickerView-cancel {
color: #747788;
}
.site-input image {
width: 38rpx;
height: 38rpx;
position: absolute;
right: 20rpx;
top: calc(50% - 19rpx);
}
.site-switch {
position: absolute;
right: 0;
top: 0;
}
/* 确认添加 */
.btn{ margin-top: 50rpx; }
.btn button[size="default"]{ background: #da2b54; width: 100%; height: 90rpx; line-height: 90rpx; padding: 0; border-radius: 45rpx; color: white; font-size: 32rpx; }

View File

@@ -19,13 +19,13 @@
</view>
</view>
<view class="address-tool">
<view class="address-tool {{type == 'selectAddress' ? 'active' : ''}}" wx:if="{{type == 'selectAddress'}}">
<view class="address-tool-btn {{type == 'selectAddress' ? 'active' : ''}}" bindtap="selectAddress" data-index="{{index}}">选择地址</view>
</view>
<view class="address-icon" wx:else>
<navigator hover-class="none" class="address-edit address-edit-border" url="/pages/bankCard/bankAdd/bankAdd?type=Compile&id={{item.bank_account_id}}">编辑账户</navigator>
<view class="address-edit" bindtap="bankRemove" data-index="{{index}}" data-id="{{item.bank_account_id}}">删除账户</view>
</view>
<block wx:if="{{type == 'selectAddress'}}">
<view class="address-tool-btn address-tool-border" bindtap="selectAddress" data-index="{{index}}">选择地址</view>
</block>
<block wx:else>
<navigator class="address-tool-btn address-tool-border" hover-class="none" url="/pages/bankCard/bankAdd/bankAdd?type=Compile&id={{item.bank_account_id}}">编辑账户</navigator>
<view class="address-tool-btn" bindtap="bankRemove" data-index="{{index}}" data-id="{{item.bank_account_id}}">删除账户</view>
</block>
</view>
</view>
</view>

View File

@@ -1,103 +1,19 @@
page {
background: #f5f5f5;
}
.address { padding: 30rpx 30rpx 180rpx; min-height: 100vh; box-sizing: border-box; background: #f7f8f9; }
.address-li { margin-bottom: 20rpx; background-color: #ffffff; border-radius: 20rpx; }
.top { position: relative; border-bottom: 1rpx solid #ececec; padding: 30rpx; box-sizing: border-box; display: flex; align-items: center; }
.top-logo { width: 68rpx; height: 68rpx; border-radius: 50%; }
.top-name { font-weight: 600; font-size: 32rpx; margin-left: 20rpx; }
.cont { padding: 30rpx; box-sizing: border-box; }
.address-title { display: flex; justify-content: space-between; font-size: 28rpx; line-height: 70rpx; }
.address-title text { width: 200rpx; color: gray; }
.address-tool{ padding: 30rpx; box-sizing: border-box; display: flex; justify-content: flex-end; border-top: 1rpx solid #ececec; }
.address-tool-btn{ background: #e92152; color: white; height: 62rpx; line-height: 60rpx; border-radius: 30rpx; font-size: 28rpx; margin-left: 30rpx; padding: 0 30rpx; border:solid 1rpx #e92152; box-sizing: border-box; }
.address-tool-border{ color: #e92152; background: white; }
.address {
border-bottom: 120rpx solid transparent;
margin: 20rpx;
}
/* .address-tool { padding: 30rpx; box-sizing: border-box; font-size: 28rpx; }
.address-edit { margin-left: 30rpx; background-color: #e92152; border: 2rpx solid #e92152; color: #ffffff; line-height: 60rpx; padding: 0 30rpx; border-radius: 30rpx; font-size: 28rpx; }
.address-li {
margin-bottom: 20rpx;
background-color: #ffffff;
border-radius: 20rpx;
}
.top {
position: relative;
border-bottom: 2rpx solid #ececec;
padding: 20rpx 20rpx 15rpx;
box-sizing: border-box;
}
.top-logo {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
}
.top-name {
position: absolute;
left: 0;
top: 0;
width: 100%;
padding: 20rpx 20rpx 20rpx 120rpx;
box-sizing: border-box;
line-height: 80rpx;
font-weight: 600;
font-size: 32rpx;
}
.cont {
padding: 30rpx;
box-sizing: border-box;
}
.address-title {
display: flex;
font-size: 28rpx;
line-height: 80rpx;
background-color: #f9fbfc;
margin-bottom: 30rpx;
padding: 0 30rpx;
box-sizing: border-box;
border-radius: 10rpx;
}
.address-title text {
display: inline-block;
width: 200rpx;
color: #aaaaaa;
}
.address-title:last-child {
margin-bottom: 0;
}
.address-nmae,
.address-tips {
flex: 1;
}
.address-text {
font-size: 28rpx;
margin: 20rpx 0;
}
.address-tool {
padding: 30rpx;
box-sizing: border-box;
font-size: 28rpx;
overflow: hidden;
border-top: 2rpx solid #ececec;
}
.address-edit {
margin-left: 30rpx;
display: inline-block;
background-color: #ff9b26;
border: 2rpx solid #ff9b26;
color: #ffffff;
line-height: 58rpx;
padding: 0 30rpx;
border-radius: 10rpx;
font-size: 28rpx;
}
.address-edit-border {
color: #ff9b26;
background-color: #ffffff;
}
.address-edit-border { color: #e92152; background-color: #ffffff; }
.address-edit image {
width: 32rpx;
@@ -137,30 +53,30 @@ page {
.address-icon {
float: right;
}
} */
/* 空页面 */
.pages-hint{ padding-bottom: 180rpx; }
/* footer */
.address-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding-left: 30rpx;
padding-right: 30rpx;
background: white;
z-index: 9;
height: 120rpx;
z-index: 99;
padding: 30rpx 30rpx 60rpx;
}
.address-footer navigator {
width: 100%;
line-height: 90rpx;
height: 90rpx;
margin: 15rpx 0;
text-align: center;
background: #e92152;
font-size: 30rpx;
font-size: 32rpx;
font-weight: bold;
color: white;
border-radius: 10rpx
border-radius: 45rpx
}

View File

@@ -56,7 +56,7 @@
.stair-nav-li.active {
background: white;
color: #e92344;
color: #da2b54;
font-weight: bold;
position: relative;
}
@@ -67,7 +67,7 @@
left: 0;
top: 30rpx;
height: 40rpx;
background: #e92344;
background: #da2b54;
width: 6rpx;
}

View File

@@ -0,0 +1,137 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
semesters : [],
formData : [{
name : '',
mobile : '',
index : 0
}],
empower : {},
allPrice : '0.00',
semestersIndex : 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
empowerId: options.id
})
this.indexInfo(options.id)
},
/**
* 增收赋能-报名
*/
indexInfo(id) {
wx.$api.empower.buyInit(id).then(res => {
let { empower, semesters } = res.data;
this.setData({
empower : empower,
semesters : semesters
})
this.getTotalPrice()
}).catch(err => {})
},
// 计算价格
getTotalPrice(){
let totalPrice = 0
this.data.formData.map(val => {
totalPrice += Number(this.data.semesters[val.index].price)
})
this.setData({
allPrice : totalPrice.toFixed(2)
})
},
/**
* 选择学期
*/
onChange(e) {
let that = this
var val = e.detail.value;
let index = e.currentTarget.dataset.index // 获取数据的索引
let reward = 'formData[' + index +'].index' // 获取lists[index].reward
that.setData({
[reward]: val
})
},
// 添加新用户
onAddUser(){
var lists = this.data.formData;
var newData = {
name : '',
mobile : '',
index : 0
};
lists.push(newData);
this.setData({
formData: lists,
})
this.getTotalPrice()
},
// 删除用户
onRemoveUser (e) {
var lists = this.data.formData;
let index = e.currentTarget.dataset.index
lists.splice(index,1)
this.setData({
formData: lists,
})
},
// 真实姓名
bindName(e) {
let that = this
var val = e.detail.value;
let index = e.currentTarget.dataset.index // 获取数据的索引
let reward = 'formData[' + index +'].name' // 获取lists[index].reward
that.setData({
[reward]: val
})
},
// 手机号码
bindTel(e) {
let that = this
var val = e.detail.value;
let index = e.currentTarget.dataset.index // 获取数据的索引
let reward = 'formData[' + index +'].mobile' // 获取lists[index].reward
that.setData({
[reward]: val
})
},
// 提交报名
onSubmit(){
let submitData = this.data.formData.map(val => {
return {
name : val.name,
mobile : val.mobile,
semester_id : this.data.semesters[val.index].id
}
})
wx.$api.empower.buy({
empower_id : this.data.empowerId,
data : submitData
}).then(res => {
wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
})
}).catch(err => {})
}
})

View File

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

View File

@@ -0,0 +1,42 @@
<view class="content">
<!-- 课程信息 -->
<view class="info">
<image class="info-cover" src="{{empower.cover}}" mode="aspectFill"></image>
<view class="info-text">
<view class="info-title">{{empower.title}}</view>
<view class="info-subtitle">{{empower.sub_title}}</view>
<view class="info-price"><text>¥</text>{{empower.price}}</view>
</view>
</view>
<!-- 报名信息 -->
<view class="user-title">报名人</view>
<view class="user-block" wx:for="{{formData}}" wx:key="formData">
<view class="user-block-flex">报名信息{{index + 1}}<view class="user-block-remove" wx:if="{{formData.length > 1}}" bindtap="onRemoveUser" data-index="{{index}}">删除</view>
</view>
<view class="user-block-input">
<label>真实姓名</label>
<input placeholder="输入姓名" value="{{item.name}}" data-index="{{index}}" maxlength="10" bindinput="bindName" />
</view>
<view class="user-block-input">
<label>手机号码</label>
<input placeholder="输入手机号码" value="{{item.mobile}}" data-index="{{index}}" bindinput="bindTel" maxlength="11" type="number" />
</view>
<view class="user-block-input" wx:if="{{semesters.length > 0}}">
<label>选择学期</label>
<picker mode="selector" value="{{semestersIndex}}" data-index="{{index}}" range="{{semesters}}" range-key="title" bindchange="onChange">
<view class="nowrap user-block-picker">{{semesters[item.index].title}}</view>
<image class="picker-icon" src="/static/icons/empowerArrow.png"></image>
</picker>
</view>
</view>
<view class="user-add" bindtap="onAddUser">
<image src="/static/icons/siteIcon.png"></image>添加报名人
</view>
<view class="footer">
<view class="footer-text">
<view class="footer-text-price"><text>¥</text>{{allPrice}}</view>
<view class="footer-text-subtitle">共计{{formData.length}}人报名</view>
</view>
<button class="footer-btn" bindtap="onSubmit">提交</button>
</view>
</view>

View File

@@ -0,0 +1,190 @@
.content {
background: #f7f8f9;
padding: 30rpx 30rpx 210rpx;
min-height: calc(100vh - 44px);
box-sizing: border-box;
}
/* 报名人信息 */
.user-title {
padding-top: 30rpx;
font-size: 30rpx;
line-height: 40rpx;
color: gray;
}
.user-block {
background: white;
margin-top: 30rpx;
border-radius: 20rpx;
padding: 20rpx 30rpx;
}
.user-block-flex {
display: flex;
justify-content: space-between;
height: 90rpx;
align-items: center;
font-size: 30rpx;
color: gray;
}
.user-block-remove {
color: #da2b56;
line-height: 90rpx;
}
.user-block-input {
display: flex;
justify-content: space-between;
height: 90rpx;
align-items: center;
flex-wrap: wrap;
}
label {
font-size: 32rpx;
width: 200rpx;
}
picker,
input {
width: calc(100% - 200rpx);
font-size: 32rpx;
}
picker {
position: relative;
}
.user-block-picker {
padding-right: 30rpx;
box-sizing: border-box;
position: relative;
width: calc(100% - 42rpx);
display: inline-block;
}
.picker-icon {
width: 42rpx;
height: 42rpx;
}
.user-add {
text-align: center;
background: white;
border-radius: 20rpx;
margin-top: 30rpx;
display: flex;
align-items: center;
height: 120rpx;
justify-content: center;
color: #da2b56;
font-size: 32rpx;
}
.user-add image {
width: 38rpx;
height: 38rpx;
margin-right: 15rpx;
}
/* 报名课程信息 */
.info {
display: flex;
background: white;
padding: 30rpx;
border-radius: 20rpx;
flex-wrap: wrap;
justify-content: space-between;
}
.info-cover {
width: 180rpx;
height: 180rpx;
border-radius: 10rpx;
}
.info-text {
width: calc(100% - 210rpx);
}
.info-title {
font-size: 38rpx;
font-weight: bold;
line-height: 50rpx;
height: 50rpx;
}
.info-subtitle {
line-height: 40rpx;
height: 80rpx;
font-size: 30rpx;
}
.info-price {
font-weight: bold;
color: #da2b56;
font-size: 42rpx;
font-family: Arial, Helvetica, sans-serif;
line-height: 50rpx;
height: 50rpx;
}
.info-price text {
font-size: 80%;
margin-right: 5rpx;
}
/* 底部 */
.footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx 30rpx 50rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
z-index: 99;
box-shadow: 0 0 10rpx 10rpx rgba(0, 0, 0, .04);
background: white;
}
.footer-text {
width: 200rpx;
margin-right: 30rpx;
flex: 1;
}
.footer-text-price {
font-weight: bold;
color: #da2b56;
font-size: 40rpx;
}
.footer-text-price text {
font-size: 80%;
margin-right: 5rpx;
}
.footer-text-subtitle {
font-size: 28rpx;
color: gray;
}
.footer-btn {
background: #da2b56;
color: white;
line-height: 100rpx;
border-radius: 50rpx;
flex: 1;
text-align: center;
font-weight: bold;
font-size: 36rpx;
padding: 0 80rpx;
}
.footer-btn::after {
display: none;
}

View File

@@ -0,0 +1,75 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
empowerId : '', //增收赋能id
id : '',
cover : '',
title : '',
subtitle : '',
price : '0.00',
semester : null,
count : {},
content : []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
empowerId: options.id
})
this.indexInfo(options.id)
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 增收赋能-详情
*/
indexInfo(id) {
wx.$api.empower.info(id).then(res => {
console.log(res.data)
let { cover, title, subtitle, price, semester_current, count, content, id } = res.data;
this.setData({
id : id,
cover : cover,
title : title,
subtitle : subtitle,
price : price,
semester : semester_current,
count : count,
content : content.replace(/\<img/gi, '<img style="width:100%;height:auto"')
})
wx.setNavigationBarTitle({ title })
}).catch(err => {})
},
/**
* 增收赋能-立即购买
*/
onBuy(){
if(this.data.count.ing <= 0){
wx.showToast({
title: '暂无可报名学期',
icon : 'none'
})
return
}
wx.navigateTo({
url: "/pages/empower/empowerBuy/empowerBuy?id=" + this.data.id
})
}
})

View File

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

View File

@@ -0,0 +1,36 @@
<view class="content">
<!-- 封面 -->
<view class="cover">
<image class="cover-src" src="{{cover}}" mode="aspectFill"></image>
</view>
<!-- 课程信息 -->
<view class="info">
<view class="info-title">{{ title }}</view>
<view class="info-subtitle">{{ subtitle }}</view>
<view class="info-info">
<view class="info-info-item">
<label>总学期</label>
<view class="info-value">{{count.all || '-'}}期</view>
</view>
<view class="info-info-item">
<label>已结束</label>
<view class="info-value">{{count.over || 0}}期</view>
</view>
<view class="info-info-item" wx:if="{{semester != null}}">
<label>当期时间</label>
<view class="info-value">{{semester.time.start || '-'}}</view>
</view>
<view class="info-info-item" wx:if="{{semester != null}}">
<label>报名价格</label>
<view class="info-value price">¥{{semester.price || '0.00'}}</view>
</view>
</view>
</view>
<!-- 课程介绍 -->
<rich-text nodes="{{content}}"></rich-text>
<!-- 报名信息 -->
<view class="footer">
<view class="footer-btn {{count.ing <= 0 ? 'in' : ''}}" bindtap="onBuy">立即购买</view>
</view>
</view>

View File

@@ -0,0 +1,104 @@
.content {
padding-bottom: 180rpx;
}
/* 封面图 */
.cover {
position: relative;
padding-top: 70%;
background: #f7f8f9;
}
.cover-src {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* 信息 */
.info {
padding: 40rpx;
}
.info-title {
font-weight: bold;
font-size: 50rpx;
margin-bottom: 20rpx;
line-height: 65rpx;
color: #333;
text-align: justify;
}
.info-subtitle {
font-size: 30rpx;
line-height: 50rpx;
margin-bottom: 40rpx;
color: #333;
text-align: justify;
}
.info-info {
background: #f7f8f9;
padding: 0 30rpx;
font-size: 30rpx;
border-radius: 20rpx;
}
.info-info-item {
padding: 30rpx 0;
line-height: 40rpx;
display: flex;
justify-content: space-between;
}
label {
font-weight: bold;
width: 170rpx;
}
.info-info-item:last-child::after {
display: none;
}
.info-value {
width: calc(100% - 170rpx);
text-align: right;
font-family: Arial, Helvetica, sans-serif;
}
.info-value.price {
font-weight: bold;
color: #da2b56;
}
/* 底部 */
.footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: 30rpx 30rpx 50rpx;
display: flex;
flex-wrap: wrap;
align-items: center;
z-index: 99;
background-color: white;
box-shadow: 0 0 10rpx 10rpx rgba(0, 0, 0, .04);
}
.footer-btn {
background: #da2b56;
color: white;
line-height: 100rpx;
border-radius: 50rpx;
flex: 1;
text-align: center;
font-weight: bold;
font-size: 36rpx;
}
.footer-btn.in {
opacity: .6;
}

View File

@@ -0,0 +1,178 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
statusArr : [{ title: '全部订单', id: '' }],
empowerArr : [{ title: '全部课程', id: '' }],
statusIndex : 0,
empowerIndex: 0,
// 报名信息
users : [],
usersTotal : 0,
usersShow : false,
// 订单列表
orders : [],
// 分页
page : {}, // 分页信息
lodingStats : false,// 加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
wx.$api.empower.orderInit().then(res => {
let { status, empower } = res.data;
this.setData({
statusArr : status,
empowerArr : [...this.data.empowerArr, ...empower]
})
// 获取列表
this.getList()
}).catch(err => {})
},
// 筛选类型
onPickerChange(e){
this.setData({
statusIndex: e.detail.value
})
this.getList()
},
// 筛选类型-课程
onPickerClass(e){
this.setData({
empowerIndex: e.detail.value
})
this.getList()
},
/**
* 获取列表
*/
getList(page) {
wx.$api.empower.orderList({
page : page || 1,
status : this.data.statusArr[this.data.statusIndex].id,
empower : this.data.empowerArr[this.data.empowerIndex].id
}).then(res => {
let listArr = this.data.orders,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
newData.map(val => {
val.is_show_type = false
})
this.setData({
orders : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
}).catch(err => {})
},
/**
* 课程数量
*/
typeTap(e) {
let index = e.currentTarget.dataset.index
this.setData({
[`orders[${index}].is_show_type`]: !this.data.orders[index].is_show_type
});
},
/**
* 报名信息
*/
onShowUsers(val) {
let { count, lists } = val.currentTarget.dataset.items
this.setData({
users : lists,
usersTotal : count,
usersShow : true
})
},
/**
* 报名信息弹出关闭
*/
usersHide() {
this.setData({
usersShow: false
})
},
/**
* 取消订单
*/
onCancel(e){
let id = e.currentTarget.dataset.id
wx.showModal({
title : '提示',
content : '取消订单后无法找回,确认取消吗?',
success : modalRes => {
if(modalRes.confirm){
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.empower.orderCancel(id).then(res => {
wx.showToast({
title: '订单已取消',
icon : 'none'
})
this.getList()
}).catch(err => {})
}
}
})
},
/**
* 支付
*/
onPay(e){
let data = e.currentTarget.dataset.item
wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(data))
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取订单列表
this.getList()
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取订单列表
this.getList(pageNumber)
}
},
})

View File

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

View File

@@ -0,0 +1,98 @@
<view class="content">
<!-- tabs -->
<view class="screen-flex">
<view class="screen-picker">
<picker range="{{statusArr}}" range-key="title" value="{{statusIndex}}" bindchange="onPickerChange">
<view class="screen-text">
{{ statusArr[statusIndex].title }}<image class="screen-icon" src="/static/icons/empowerArrow.png"></image>
</view>
</picker>
</view>
<view class="screen-picker">
<picker range="{{empowerArr}}" range-key="title" value="{{empowerIndex}}" bindchange="onPickerClass">
<view class="screen-text">
{{ empowerArr[empowerIndex].title }}<image class="screen-icon" src="/static/icons/empowerArrow.png"></image>
</view>
</picker>
</view>
</view>
<!-- 订单管理列表 -->
<view class="orders" wx:if="{{orders.length > 0}}">
<view class="orders-item" wx:for="{{orders}}" wx:key="orders">
<view class="orders-flex">
<view class="no nowrap" bindtap="copyNo" data-no="item.order_no">
<text class="orders-tag" wx:if="{{!item.is_my}}">客户</text>
<text class="orders-tag order-tag-my" wx:else>个人</text>
{{item.order_no}}
</view>
<view class="state">{{item.status_text}}</view>
</view>
<view class="orders-content">
<view class="orders-content-item">
<label>课程名称</label>
<view class="nowrap orders-content-type">{{item.empower.title}}</view>
</view>
<view class="orders-content-item orders-content-bottom" bindtap="typeTap" data-index="{{index}}" data-type="{{item.is_show_type}}">
<label>课程数量</label>
<view class="nowrap orders-content-type">
×{{item.items.count}}<image class="orders-content-icon {{item.is_show_type ? 'active' : ''}}" src="/static/icons/arrow_more.png"></image>
</view>
</view>
<view class="orders-content-block" wx:if="{{item.is_show_type}}">
<view class="item-flex" wx:for="{{item.items.lists}}" wx:key="lists" wx:for-item="citem">
<view class="item-flex-title">{{citem.semester.subtitle}}({{citem.name}})</view>
<view class="item-flex-value">¥{{citem.price}}</view>
</view>
</view>
<view class="orders-content-item">
<label>支付金额</label>
<view class="nowrap">¥{{item.price}}</view>
</view>
<view class="orders-content-item">
<label>下单时间</label>
<view class="nowrap">{{item.created_at}}</view>
</view>
<view class="orders-content-item" wx:if="{{item.paid_at != ''}}">
<label>支付时间</label>
<view class="nowrap">{{item.paid_at}}</view>
</view>
</view>
<view class="orders-flex">
<view class="btns">
<view class="btns-item btns-border" wx:if="{{item.status == 0}}" bindtap="onCancel" data-id="{{item.order_id}}">取消</view>
<view class="btns-item btns-border" wx:if="{{item.status == 0}}" bindtap="onPay" data-item="{{item}}">支付</view>
<view class="btns-item" bindtap="onShowUsers" data-items="{{item.items}}">报名信息</view>
</view>
</view>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="/static/imgs/text_null.png"></image>
<view>暂无数据</view>
</view>
<!-- 弹出报名人信息 -->
<view class="users-back {{usersShow ? 'active' : ''}}"></view>
<view class="users-content {{usersShow ? 'active' : ''}}">
<view class="users-title">报名信息<image class="users-content-icon" bindtap="usersHide" src="/static/icons/close.png"></image></view>
<view class="users-lists">
<view class="users-lists-item" wx:for="{{users}}" wx:key="index">
<view class="users-item nowrap"><label>报名姓名</label>{{item.name}}</view>
<view class="users-item nowrap"><label>报名手机</label>{{item.mobile}}</view>
<view class="users-item nowrap"><label>课程名称</label>{{item.semester.subtitle}}</view>
<view class="users-item nowrap"><label>签到状态</label><text class="bold">{{item.status_text}}</text></view>
<view class="users-item"><label>课程地址</label>{{item.semester.address}}</view>
</view>
</view>
</view>
</view>

View File

@@ -0,0 +1,271 @@
.content {
background: #f7f8f9;
min-height: calc(100vh - 44px);
}
/* 订单弹出层 */
.users-back {
position: fixed;
height: 100vh;
width: 100%;
left: 0;
bottom: 0;
z-index: 100;
background-color: rgba(0, 0, 0, .4);
display: none;
}
.users-back.active {
display: block;
}
.users-content {
position: fixed;
height: 80vh;
width: 100%;
left: 0;
bottom: 0;
z-index: 101;
background-color: white;
display: none;
}
.users-content.active {
display: block;
}
.users-title {
text-align: center;
font-weight: bold;
font-size: 40rpx;
color: #333;
height: 70rpx;
line-height: 70rpx;
padding: 30rpx;
position: relative;
}
.users-content-icon {
position: absolute;
right: 30rpx;
top: 44rpx;
width: 40rpx;
height: 40rpx;
}
.users-lists {
padding: 0 30rpx 50rpx;
max-height: 70vh;
overflow-y: scroll;
}
.users-lists-item {
background: #f7f8f9;
padding: 30rpx;
border-radius: 20rpx;
font-size: 30rpx;
margin-bottom: 30rpx;
}
.users-item {
position: relative;
line-height: 45rpx;
min-height: 45rpx;
padding-left: 160rpx;
margin: 5rpx 0;
text-align: right;
}
.users-item label {
position: absolute;
left: 0;
top: 0;
color: gray;
}
.users-item .bold {
font-weight: bold;
color: #da2b56;
}
/* 订单筛选 */
.screen-flex {
display: flex;
flex-wrap: wrap;
position: fixed;
width: 100%;
left: 0;
top: 0;
height: 90rpx;
background-color: white;
z-index: 99;
}
.screen-picker {
width: 50%;
text-align: center;
}
.screen-text {
line-height: 90rpx;
height: 90rpx;
display: inline-block;
font-size: 30rpx;
}
.screen-icon {
margin-left: 5rpx;
width: 34rpx;
height: 34rpx;
vertical-align: -6rpx;
}
/* 订单为空 */
.order-null {
height: 80vh;
display: flex;
justify-content: center;
align-items: center;
}
/* 订单列表 */
.orders {
padding: 30rpx 0 10rpx;
margin-top: 90rpx;
}
.orders-item {
margin: 0 30rpx 20rpx;
background-color: white;
border-radius: 20rpx;
}
.orders-content {
padding: 20rpx 30rpx;
}
.orders-content-item {
line-height: 70rpx;
display: flex;
justify-content: space-between;
font-size: 30rpx;
color: #111111;
}
.orders-content-item label {
color: #999999;
}
.orders-content .orders-content-bottom {
padding-right: 30rpx;
position: relative;
}
.orders-content-type {
display: flex;
}
.orders-content-icon {
width: 20rpx;
height: 20rpx;
margin-top: 26rpx;
transition: .3s;
}
.orders-content-icon.active {
transform: rotate(90deg);
}
.orders-content-icon {
position: absolute;
right: 0;
top: 0;
}
.orders-content-block {
background: rgba(68, 110, 254, .03);
padding: 20rpx;
font-size: 28rpx;
border-radius: 10rpx;
margin: 10rpx 0;
}
.item-flex {
display: flex;
justify-content: space-between;
line-height: 50rpx;
}
.orders-flex {
border-bottom: solid 1rpx #F6F6F6;
display: flex;
justify-content: space-between;
align-items: center;
padding: 20rpx 30rpx;
}
.orders-flex:last-child {
border-top: solid 1rpx #F6F6F6;
border-bottom: none;
}
.orders-tag {
display: inline-block;
background: #da2b56;
font-size: 26rpx;
color: white;
border-radius: 10rpx;
padding: 0 10rpx;
height: 40rpx;
line-height: 40rpx;
margin-right: 10rpx;
}
.orders-tag.order-tag-my {
background: #da2b56;
}
.no {
font-size: 30rpx;
color: #111;
line-height: 60rpx;
width: calc(100% - 150rpx);
}
.state {
color: #da2b56;
font-weight: bold;
font-size: 30rpx;
line-height: 60rpx;
width: 150rpx;
text-align: right;
}
.btns {
text-align: right;
width: 100%;
}
.btns-item {
display: inline-block;
height: 70rpx;
line-height: 70rpx;
background: #da2b56;
color: white;
border-radius: 35rpx;
padding: 0 30rpx;
font-size: 30rpx;
}
.btns-item.btns-border {
line-height: 68rpx;
box-sizing: border-box;
border: solid 1rpx #da2b56;
background: white;
color: #da2b56;
margin-right: 20rpx;
}
.pack-center {
z-index: 0;
}

66
pages/empower/index.js Normal file
View File

@@ -0,0 +1,66 @@
// pages/empower/index.js
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})

3
pages/empower/index.json Normal file
View File

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

2
pages/empower/index.wxml Normal file
View File

@@ -0,0 +1,2 @@
<!--pages/empower/index.wxml-->
<text>pages/empower/index.wxml</text>

1
pages/empower/index.wxss Normal file
View File

@@ -0,0 +1 @@
/* pages/empower/index.wxss */

View File

@@ -0,0 +1,76 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
popupShow : false,
code : '',
vouchers : [],
layIndex : 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
code: options.scene
})
this.codesInfo();
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 核销列表
*/
codesInfo() {
wx.$api.empower.codes({
code: this.data.code
}).then(res => {
this.setData({
vouchers: res.data
})
}).catch(err => {})
},
/**
* 报名信息弹出关闭
*/
usersHide() {
this.setData({
popupShow: false
})
},
// 显示确认弹出层
onShowLay(e){
let index = e.currentTarget.dataset.index
this.setData({
layIndex : index,
popupShow: true
})
},
// 签到
onSign(e){
let id = e.currentTarget.dataset.id
wx.$api.empower.sign({
item_id: id
}).then(res => {
this.setData({
popupShow: false
})
this.codesInfo();
}).catch(err => { })
}
})

View File

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

View File

@@ -0,0 +1,72 @@
<view class="content">
<!-- 核销凭证列表 -->
<block wx:if="{{vouchers.length > 0}}">
<view class="vouchers" wx:for="{{vouchers}}" wx:key="vouchers">
<image class="vouchers-icon" src="/static/icons/sign.png" mode="widthFix" wx:if="{{!item.can_sign}}"></image>
<view class="vouchers-info">
<view class="vouchers-info-item title">{{item.empower.title}}(第{{item.semester.no}}期)</view>
<view class="vouchers-info-item">报名人:{{item.name}}</view>
<view class="vouchers-info-item">有效期:{{item.semester.end}}</view>
</view>
<view class="vouchers-btns">
<view class="vouchers-btn" bindtap="onShowLay" data-index="{{index}}">{{item.can_sign ? '立即使用': '查看凭证'}}</view>
</view>
</view>
</block>
<view class="pack-center pages-hint" wx:else>
<image src="/static/imgs/text_null.png"></image>
<view>暂无数据</view>
</view>
<!-- 核销弹出层 -->
<view class="lay-back {{popupShow ? 'active' : ''}}"></view>
<view class="lay-info {{popupShow ? 'active' : ''}}">
<block wx:if="{{vouchers.length > 0}}">
<view class="lay-title">报名信息<image class="lay-title-icon" bindtap="usersHide" src="/static/icons/close.png"></image></view>
<view class="lay-content">
<view class="lay-item">
<label>报名课程</label>
<view class="lay-item-val">{{vouchers[layIndex].empower.title}}</view>
</view>
<view class="lay-item">
<label>学期名称</label>
<view class="lay-item-val">{{vouchers[layIndex].empower.subtitle}}</view>
</view>
<view class="lay-item">
<label>报名姓名</label>
<view class="lay-item-val">{{vouchers[layIndex].name}}</view>
</view>
<view class="lay-item">
<label>报名电话</label>
<view class="lay-item-val">{{vouchers[layIndex].mobile}}</view>
</view>
<view class="lay-item">
<label>开始时间</label>
<view class="lay-item-val">{{vouchers[layIndex].semester.start}}</view>
</view>
<view class="lay-item">
<label>结束时间</label>
<view class="lay-item-val">{{vouchers[layIndex].semester.end}}</view>
</view>
<view class="lay-item">
<label>课程地点</label>
<view class="lay-item-val">{{vouchers[layIndex].semester.address}}</view>
</view>
</view>
<view class="lay-border"></view>
<view class="lay-content">
<view class="lay-item">
<label>签到状态</label>
<view class="lay-item-val bold">{{vouchers[layIndex].can_sign ? '未签到': '已签到'}}</view>
</view>
<view class="lay-item" wx:if="{{!vouchers[layIndex].can_sign}}">
<label>签到时间</label>
<view class="lay-item-val">{{vouchers[layIndex].sign_at}}</view>
</view>
</view>
<view class="lay-btns">
<button class="lay-btn" disabled="{{!vouchers[layIndex].can_sign}}" bindtap="onSign" data-id="{{vouchers[layIndex].item_id}}">{{vouchers[layIndex].can_sign ? '签到': '已签到'}}</button>
</view>
</block>
</view>
</view>

View File

@@ -0,0 +1,194 @@
page {
background-color: #f7f7f7;
padding: 30rpx;
box-sizing: border-box;
}
/* 票券 */
.vouchers {
background: white;
border-radius: 20rpx;
margin-bottom: 30rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
position: relative;
}
.vouchers-icon {
position: absolute;
width: 100rpx;
height: 100rpx;
z-index: 1;
top: 15%;
left: 53%;
opacity: .5;
}
.vouchers-info {
position: relative;
padding: 20rpx 30rpx;
font-size: 28rpx;
border-right: dashed 2rpx #ddd;
width: calc(100% - 200rpx);
box-sizing: border-box;
}
.vouchers-info::after,
.vouchers-info::before {
content: " ";
height: 22rpx;
width: 22rpx;
background: #f7f7f7;
position: absolute;
right: -11rpx;
border-radius: 50%;
}
.vouchers-info::after {
top: -11rpx;
}
.vouchers-info::before {
bottom: -11rpx;
}
.vouchers-info-item {
line-height: 40rpx;
font-size: 26rpx;
color: gray;
}
.vouchers-info-item.bold {
font-weight: bold;
}
.vouchers-info-item.title {
font-size: 30rpx;
margin-bottom: 10rpx;
font-weight: bold;
color: #333;
}
.vouchers-btns {
width: 200rpx;
text-align: center;
}
.vouchers-btn {
background: #da2b56;
color: white;
line-height: 60rpx;
border-radius: 30rpx;
width: 150rpx;
font-size: 26rpx;
display: inline-block;
}
/* 核销凭证弹出层 */
.lay-back {
top: 0;
left: 0;
position: fixed;
width: 100vw;
height: 100vh;
z-index: 998;
background-color: rgba(0, 0, 0, .5);
display: none;
}
.lay-back.active {
display: block;
}
.lay-info {
width: 100vw;
box-sizing: border-box;
padding-bottom: 50rpx;
position: fixed;
left: 0;
bottom: 0;
z-index: 999;
background-color: #ffffff;
display: none;
transition: .2s;
height: 65vh;
overflow-y: scroll;
}
.lay-info.active {
display: block;
}
.lay-title {
font-size: 40rpx;
font-weight: bold;
text-align: center;
color: #333;
line-height: 60rpx;
padding: 50rpx;
position: relative;
}
.lay-title-icon {
position: absolute;
right: 30rpx;
top: 44rpx;
width: 40rpx;
height: 40rpx;
}
.lay-content {
padding: 0 40rpx;
}
.lay-item {
display: flex;
justify-content: space-between;
font-size: 30rpx;
padding: 10rpx 0;
line-height: 40rpx;
}
.lay-item label {
color: gray;
width: 160rpx;
}
.lay-item-val {
width: calc(100% - 160rpx);
}
.lay-item-val.bold {
color: #da2b56;
font-weight: bold;
}
.lay-border {
border-bottom: dashed 2rpx #ddd;
margin: 40rpx 0;
}
.lay-btns {
padding: 40rpx;
}
button.lay-btn {
width: 100%;
margin: 0;
background: #da2b56;
color: white;
height: 90rpx;
line-height: 90rpx;
padding: 0;
border-radius: 45rpx;
}
button.lay-btn ::after {
display: none;
}
button.lay-btn [disabled] {
opacity: .7;
}

View File

@@ -1,66 +1,53 @@
// pages/face/index.js
Page({
/**
* 页面的初始数据
*/
data: {
goFaceDone : false,
bizToken : '',
redirectUrl : ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
bizToken : options.bizToken,
redirectUrl : decodeURIComponent(options.redirectUrl),
}, this.goFaceAuth)
},
/**
* 生命周期函数--监听页面初次渲染完成
* 生命周期函数--页面再次显示
*/
onReady() {
onShow(){
const { goFaceDone, redirectUrl } = this.data
if (!goFaceDone) return
const options = wx.getEnterOptionsSync()
if(options.scene === 1038 && options.referrerInfo.extraData && options.referrerInfo.extraData.faceResult){
const pages = getCurrentPages()
const pre = pages[pages.length - 2]
if (pre.reloadPage && typeof pre.reloadPage === 'function') {
pre.reloadPage(redirectUrl + `&timeStamp=${new Date().getTime()}`)
wx.navigateBack({
delta: 1,
})
}
}
},
/**
* 生命周期函数--监听页面显示
* 打开E签报小程序
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
goFaceAuth(){
wx.navigateToMiniProgram({
appId: "wx1cf2708c2de46337",
path : "/pages/face/index?bizToken=" + this.data.bizToken,
success: () => {
this.setData({
goFaceDone: true
})
}
})
}
})

View File

@@ -1,3 +1,4 @@
{
"usingComponents": {}
"usingComponents": {},
"navigationBarTitleText": "人脸识别"
}

View File

@@ -1,2 +1,9 @@
<!--pages/face/index.wxml-->
<text>pages/face/index.wxml</text>
<view class="face">
<image class="face-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>
<view class="face-loding">加载中...</view>
<view class="btn-content">
<text>如未成功跳转,请手动点击按钮转跳</text>
<button size="default" bind:tap="goFaceAuth">转跳</button>
</view>
</view>

View File

@@ -1 +1,16 @@
/* pages/face/index.wxss */
.face{
width: 100vw;
height: 90vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.face-icon{ width: 48rpx; height: 48rpx; margin-bottom: 40rpx; }
.face-loding{ color: gray; }
.btn-content{ margin-top: 150rpx; font-size: 30rpx; color: #333; }
.btn-content button[size="default"]{ background: #da2b54; height: 90rpx; line-height: 90rpx; color: white; padding: 0; border-radius: 45rpx; width: 400rpx; margin-top: 100rpx; }

View File

@@ -0,0 +1,36 @@
Page({
/**
* 页面的初始数据
*/
data: {
sign_url: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.idcard.pactUrl().then(res => {
let { sign_url } = res.data
this.setData({
sign_url
})
wx.hideLoading()
})
},
/**
* 监听签署结果
*/
handleGetMessage(e){
if(e.detail.data[0].result=='success'){
wx.navigateTo({
url: '/pages/idcard/success/success?type=idcard',
})
}
},
})

View File

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

View File

@@ -0,0 +1,2 @@
<web-view src="{{sign_url}}" bindmessage="handleGetMessage"></web-view>

View File

@@ -0,0 +1 @@
/* pages/idcard/eSign/eSign.wxss */

131
pages/idcard/idcard.js Normal file
View File

@@ -0,0 +1,131 @@
Page({
/**
* 页面的初始数据
*/
data: {
front : null,
back : null,
procedure : 1,
info : {
name : '',
id_card : '',
created_at : '',
need_sign : '',
},
isSignContract : false
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
wx.showLoading({
title: "加载中...",
mask : true
})
wx.$api.idcard.getInfo().then(res => {
let { data } = res;
wx.hideLoading()
if(data.length == 0){
this.setData({
procedure: 1
})
return
}
if(data != ''){
this.setData({
procedure : data.need_sign ? 2 : 3,
isSignContract : data.is_sign_contract,
info : {
name : data.name,
id_card : data.id_card,
created_at : data.created_at,
verified : data.verified,
need_sign : data.need_sign,
address : data.address
}
})
}
})
},
/**
* 上传身份证
*/
onUpd(e){
let { type } = e.currentTarget.dataset
wx.chooseMedia({
count : 1,
mediaType : ['image'],
success : resPaths => {
let { tempFiles } = resPaths;
this.setData({
[type]: tempFiles[0].tempFilePath
})
wx.$api.idcard.updIdcard(tempFiles[0].tempFilePath, { type }).then(res => {
this.setData({
[type]: res
})
})
}
})
},
/**
* 提交身份证信息
*/
onSubmitIdcard(e){
wx.showLoading({
title: '提交证件信息...'
// mask : true
})
let { address } = e.detail.value
wx.$api.idcard.ocr({
front_card : this.data.front != null ? this.data.front.path : '',
back_card : this.data.back != null ? this.data.back.path : '',
address
}).then(res => {
let { address, name, id_card, created_at, verified, need_sign, is_sign_contract } = res.data
this.setData({
info : { name, id_card, created_at, verified, need_sign, address },
procedure : need_sign ? 2 : 3,
isSignContract : is_sign_contract,
})
wx.hideLoading()
}).catch(err => {
console.log(err)
})
},
/**
* 获取人脸认证地址
*/
onGetSignUrl(){
wx.showLoading({
title: '获取地址信息...',
mask : true
})
wx.$api.idcard.signUrl({
path : '/pages/idcard/idcard',
query : "getSign=1",
version : ''
}).then(res => {
let { url } = res.data;
wx.navigateTo({
url: "./signUrl/signUrl?url=" + encodeURIComponent(url.authUrl),
})
wx.hideLoading()
})
},
/**
* 开通会员获取签约地址
*/
onGetOpenVip(){
if(this.data.isSignContract){
wx.navigateBack()
return
}
wx.navigateTo({
url: "./eSign/eSign",
})
}
})

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

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "实名认证"
}

76
pages/idcard/idcard.wxml Normal file
View File

@@ -0,0 +1,76 @@
<view class="schedule">
<view class="schedule-item {{procedure >= 1 ? 'show': ''}}">上传证件</view>
<view class="schedule-item {{procedure >= 2 ? 'show': ''}}">确认信息</view>
<view class="schedule-item {{procedure >= 3 ? 'show': ''}}">认证完成</view>
</view>
<!-- 上传证件 -->
<block wx:if="{{procedure == 1}}">
<form bindsubmit="onSubmitIdcard">
<view class="upds">
<view class="upds-item" bind:tap="onUpd" data-type="front">
<view class="upds-text">
<image class="upds-icon" src="/static/icons/add_icon.png" mode="widthFix"></image>
<view>上传身份证正面</view>
</view>
<image class="upds-back" src="https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/08/22/1919a336eb5bf37f580747073402d838.png" mode="widthFix"></image>
<image wx:if="{{front != null}}" class="upds-src" src="{{front.url}}" mode="aspectFit"></image>
</view>
<view class="upds-item" bind:tap="onUpd" data-type="back">
<view class="upds-text">
<image class="upds-icon" src="/static/icons/add_icon.png" mode="widthFix"></image>
<view>上传身份证反面</view>
</view>
<image class="upds-back" src="https://douhuo-storage.oss-cn-beijing.aliyuncs.com/images/2023/08/22/2fba50d950d7569986177b26c229713b.png" mode="widthFix"></image>
<image wx:if="{{back != null}}" class="upds-src" src="{{back.url}}" mode="aspectFit"></image>
</view>
<view class="idcard-input">
<label>联系地址</label>
<input placeholder="输入联系地址" name="address" />
</view>
</view>
<view class="idcard-btn">
<button size="default" form-type="submit">下一步</button>
</view>
</form>
</block>
<!-- 确认信息 -->
<block wx:if="{{procedure == 2}}">
<view class="info-block">
<view class="info-flex">
<label>真实姓名</label>
<view class="info-val">{{info.name || '-'}}</view>
</view>
<view class="info-flex">
<label>证件号码</label>
<view class="info-val">{{info.id_card || '-'}}</view>
</view>
<view class="info-flex">
<label>联系地址</label>
<view class="info-val">{{info.address || '-'}}</view>
</view>
<view class="info-flex">
<label>上传时间</label>
<view class="info-val">{{info.created_at || '-'}}</view>
</view>
</view>
<view class="idcard-btn">
<button size="default" bind:tap="onGetSignUrl">人脸认证</button>
</view>
</block>
<!-- 认证完成 -->
<block wx:if="{{procedure == 3}}">
<view class="idcard-success">
<image class="idcard-icon" src="/static/icons/idcard_success.png" mode="widthFix"></image>
<view class="idcard-title">认证完成</view>
<view class="idcard-info">{{info.name}}({{info.id_card}})</view>
<view class="idcard-subtitle">您已完成实名认证<text wx:if="{{!isSignContract}}">
点击按钮进行签约开通会员</text></view>
<view class="idcard-btn">
<button size="default" bind:tap="onGetOpenVip">{{isSignContract ? '返回' : '开通会员'}}</button>
</view>
</view>
</block>

38
pages/idcard/idcard.wxss Normal file
View File

@@ -0,0 +1,38 @@
/* 身份信息 */
.schedule{ display: flex; align-items: center; justify-content: space-around; padding: 50rpx 30rpx; }
.schedule-item{ font-size: 28rpx; color: gray; padding-top: 60rpx; position: relative; }
.schedule-item::after{ content: " "; position: absolute; left: 50%; top: 0; width: 40rpx; height: 40rpx; margin-left: -25rpx; background: #ddd; text-align: center; border-radius: 50%; line-height: 40rpx; font-size: 28rpx; border: solid 5rpx #f7f8f9; }
.schedule-item:nth-child(1)::after{ content: "1"; }
.schedule-item:nth-child(2)::after{ content: "2"; }
.schedule-item:nth-child(3)::after{ content: "3"; }
.schedule-item.show{color: #da2b54;}
.schedule-item.show::after{ background: #da2b54; color: white; border-color: #fbccd7; }
/* 上传身份证 */
.upds{ padding: 0 60rpx; }
.upds-item{ background: #f7f8f9; border-radius: 20rpx; margin-top: 20rpx; width: 100%; padding-top:58%; border: dashed 1rpx #ddd; position: relative; overflow: hidden; }
.upds-text{ font-size: 28rpx; color: gray; width: 100%; display: flex; align-items: center; flex-direction: column; justify-content: center; height: 100%; top: 0; left: 0; position: absolute; z-index: 1; }
.upds-icon{ width: 58rpx; height: 58rpx; margin: 20rpx 0; }
.upds-back{ position: absolute; top: 50%; left: 50%; width: 400rpx; height: 185rpx; opacity: .2; margin-left: -200rpx; margin-top: -92rpx; }
.upds-src{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; }
.idcard-input{ background: #f7f8f9; border-radius: 20rpx; height: 90rpx; margin-top: 20rpx; display: flex; align-items: center; padding: 0 30rpx; box-sizing: border-box; }
.idcard-input input{ width: calc(100% - 140rpx); height: 90rpx; line-height: 90rpx; font-size: 30rpx; box-sizing: border-box; padding-left: 20rpx; }
.idcard-input label{ width: 140rpx; font-size: 30rpx; }
/* 认证信息 */
.info-block{ background: #f7f8f9; margin: 0 50rpx; border-radius: 20rpx; padding: 30rpx; }
.info-flex{ display: flex; align-items: flex-start; justify-content: space-between; line-height: 40rpx; padding: 15rpx 0; font-size: 30rpx; }
.info-flex label{ color: gray; }
/* 认证结果信息 */
.idcard-success{ margin: 0 50rpx; display: flex; align-items: center; justify-content: center; height: 75vh; flex-direction: column; }
.idcard-icon{ width: 128rpx; margin-bottom: 50rpx; }
.idcard-title{ font-size: 50rpx; font-weight: bold; line-height: 50rpx; }
.idcard-subtitle{ font-size: 30rpx; color: gray; line-height: 40rpx; margin-top: 20rpx; margin-bottom: 100rpx; text-align: center; }
.idcard-info{ margin-top: 20rpx; font-size: 30rpx; }
/* 下一步 */
.idcard-btn{ padding: 50rpx 60rpx; width: 100vw; box-sizing: border-box; }
.idcard-btn button[size='default']{ background: #da2b54; width: 100%; height: 90rpx; border-radius: 45rpx; color: white; line-height: 90rpx; padding: 0; font-size: 32rpx; }

View File

@@ -0,0 +1,44 @@
Page({
/**
* 页面的初始数据
*/
data: {
url: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log(options)
if(!options.url){
wx.showToast({
title: '系统错误:未获取到签约地址',
icon : 'none'
})
return
}
this.setData({
url: decodeURIComponent(options.url)
})
},
/**
* 监听签署结果
*/
handleGetMessage(e){
if(e.detail.data[0].result=='success'){
wx.redirectTo({
url: '/pages/idcard/success/success?type=sign',
})
}
},
/**
* 重新定向url
*/
reloadPage(redirectUrl) {
this.setData({
url: redirectUrl,
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "人脸识别认证"
}

View File

@@ -0,0 +1,2 @@
<web-view src="{{url}}" bindmessage="handleGetMessage"></web-view>

View File

@@ -0,0 +1 @@
/* pages/idcard/signUrl/signUrl.wxss */

View File

@@ -0,0 +1,35 @@
Page({
/**
* 页面的初始数据
*/
data: {
title: "",
text : ""
},
/**
* 生命周期函数--页面加载
*/
onLoad(e){
if(e.type == 'sign'){
this.setData({
title: "签署完成",
text : "签署完成,恭喜您升级为平台会员"
})
}
if(e.type == 'idcard'){
this.setData({
title: "认证完成",
text : "实名认证已完成"
})
}
},
/**
* 返回
*/
onBack(){
wx.navigateBack()
}
})

View File

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

View File

@@ -0,0 +1,9 @@
<view class="success">
<image class="icon" src="/static/icons/success_icon.png" mode="widthFix"></image>
<view class="title">{{title}}</view>
<view class="text">{{text}}</view>
<view class="idcard-btn">
<button size="default" bind:tap="onBack">返回</button>
</view>
</view>

View File

@@ -0,0 +1,9 @@
.success{ height: 90vh; width: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.icon{ width: 128rpx; height: 128rpx; margin-bottom: 40rpx; }
.title{ font-size: 50rpx; font-weight: bold; line-height: 50rpx; margin-bottom: 30rpx; color: #333; }
.text{ font-size: 30rpx; color: gray; margin-bottom: 100px; }
.idcard-btn{ padding: 50rpx 60rpx; width: 100vw; box-sizing: border-box; }
.idcard-btn button[size='default']{ background: #da2b54; width: 100%; height: 90rpx; border-radius: 45rpx; color: white; line-height: 90rpx; padding: 0; font-size: 32rpx; }

View File

@@ -41,7 +41,7 @@ Page({
let value = e.detail.value
let data = {
username : value.username,
password : value.password,
password : value.password
}
wx.$api.auth.Login(data).then(res => {
// 存储登录信息
@@ -61,7 +61,7 @@ Page({
return
}
wx.showToast({
title: '请勾选用户隐私和服务协议',
title: '请勾选隐私协议和服务协议',
icon: "none"
})
}

View File

@@ -8,11 +8,11 @@
<input type="number" placeholder="请输入账号" maxlength="11" name="username" />
</view>
<view class="inputs">
<input type="text" placeholder="请输入密码" name="password" />
<input password placeholder="请输入密码" name="password" />
</view>
<view class="forget"><navigator hover-class="none">忘记密码?</navigator></view>
<view class="forget"><navigator hover-class="none" url="/pages/resetPassword/resetPassword">忘记密码?</navigator></view>
<button class="btn" type="default" form-type="submit">立即登录</button>
<view class="registerGo"><navigator hover-class="none" url="/pages/register/index" open-type="redirect">暂无账号,立即注册</navigator></view>
<view class="registerGo"><navigator hover-class="none" url="/pages/register/index" open-type="navigate">暂无账号,立即注册</navigator></view>
</form>
<!-- 用户登录注册协议 -->
<view class="agreement">
@@ -20,6 +20,6 @@
<checkbox color="#da2b54" checked="{{checked}}" size='10' class="radioGroup" />
</checkbox-group>
<view class="agreement-text">
我已阅读并同意<navigator hover-class="none" url="./agreement/index?type=secret">《隐私协议》</navigator>和<navigator hover-class="none" url="./agreement/index?type=protocol">《服务协议》</navigator>
我已阅读并同意<navigator hover-class="none" url="/pages/richText/richText?id=4">《隐私协议》</navigator>和<navigator hover-class="none" url="/pages/richText/richText?id=3">《服务协议》</navigator>
</view>
</view>

View File

@@ -9,15 +9,22 @@ Page({
* 页面的初始数据
*/
data: {
disabled : true,//按钮
disabled : true, //按钮
skuId : '',
goodsQty : '', // 产品数量
address : '', // 地址
addressId : '', // 地址id
goodskData : '', // 数据
amount : '', // 金额
freight : '', // 运费
weight : '', // 重量
goodsQty : '', // 产品数量
address : '', // 地址
goodskData : '', // 数据
amount : '', // 商品总金额
total : '', // 支付金额
freight : '', // 运费
weight : '', // 重量
distribution : [
{ type: 2, title: "请选择配送方式" },
{ type: 0, title: "快递" },
{ type: 1, title: "自提" },
],
distributionIndex: 0,
distributionType : 2,
},
/**
@@ -31,30 +38,44 @@ Page({
// 获取商品下单信息
this.placeInfo(options.skuId, options.qty);
},
/**
* 生命周期函数--监听页面显示
* 配送方式选择
*/
onShow() {},
distributionChange(e){
if(e.detail.value === this.data.distributionIndex) return
this.setData({
distributionIndex : e.detail.value,
distributionType : this.data.distribution[e.detail.value].type
})
this.placeInfo(this.data.skuId, this.data.goodsQty);
},
/**
* 商品下单信息
*/
placeInfo(skuid, qty) {
placeInfo(skuid, qty, type) {
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.mall.place({
goods_sku_id:skuid,
qty: qty,
address_id: this.data.addressId
goods_sku_id : skuid,
qty : qty,
address_id : this.data.address.address_id || '',
delivery_type: this.data.distributionIndex
}).then(res => {
console.log(res)
if(type != 'chooseAdd'){
this.setData({
address: res.data.address,
})
}
this.setData({
address : res.data.address,
addressId : res.data.address.address_id,
goodskData: res.data.detail,
amount : res.data.amount,
total : res.data.total,
freight : res.data.freight,
weight : res.data.weight
})
wx.hideLoading()
}).catch(err =>{})
},
@@ -62,21 +83,27 @@ Page({
* 商品确认下单
*/
buyTap() {
wx.$api.mall.placeTrue({
goods_sku_id:this.data.skuId,
qty: this.data.goodsQty,
address_id: this.data.addressId
}).then(res => {
this.setData({
disabled: true
if(this.data.distributionIndex == 0){
wx.showToast({
title: '请选择配送方式',
icon : 'none'
})
return
}
wx.showLoading({
title: '下单中...',
mask : true
})
wx.$api.mall.placeTrue({
goods_sku_id : this.data.skuId,
qty : this.data.goodsQty,
address_id : this.data.address.address_id,
delivery_type : this.data.distributionType
}).then(res => {
wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
})
}).catch(err =>{
this.setData({
disabled: false
})
})
wx.hideLoading()
}).catch(() =>{}).finally(() => {})
},
})

View File

@@ -1,6 +1,6 @@
<!-- 地址 -->
<view class="address">
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress" class="address-cont" wx:if="{{address}}">
<view class="address" wx:if="{{distributionIndex == 1}}">
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress&skuid={{skuId}}&qty={{goodsQty}}" class="address-cont" wx:if="{{address}}">
<view class="address-top">
<view class="address-area">
<image class="address-icon" src="/static/icons/address.png" mode="widthFix"></image>{{address.province.name}}{{address.city.name}}
@@ -13,7 +13,7 @@
<image class="address-arrow" src="/static/icons/orderArrow.png"></image>
</navigator>
<view class="address-add" wx:else>
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress" class="address-go">新增收货地址 +</navigator>
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress&skuid={{skuId}}&qty={{goodsQty}}" class="address-go">新增收货地址 +</navigator>
</view>
<image class="address-img" src="/static/imgs/address.png" mode="widthFix"></image>
</view>
@@ -33,9 +33,20 @@
</view>
</block>
</view>
<!-- 规格 -->
<!-- 配送方式 -->
<view class="label">
<view class="label-item">
<view class="label-name">配送方式</view>
<picker range="{{distribution}}" range-key="title" class="label-picker" value="{{distributionIndex}}" bindchange="distributionChange">
<view class="label-picker-val">{{distribution[distributionIndex].title}}<image class="label-picker-icon" src="/static/icons/arrow_more.png"></image></view>
</picker>
</view>
</view>
<!-- 规格 -->
<view class="label">
<view class="label-item" wx:if="{{distributionIndex == 0}}">
<view class="label-name">快递</view>
<view class="label-text">{{freight == 0 ? '免邮' : freight + '元'}}</view>
</view>
@@ -54,13 +65,7 @@
<view class="number">
<view class="number-vip">合计:</view>
<text>¥</text>
<view class="number-price">{{amount}}</view>
<view class="number-price">{{total}}</view>
</view>
<view class="btn" bindtap="buyTap" wx:if="{{disabled}}">立即支付</view>
<view class="btn active" wx:else>立即支付</view>
<view class="btn {{disabled ? '': 'active'}}" bindtap="buyTap">立即支付</view>
</view>
<!-- <view class="pack-center pages-hint grey" wx:if="{{paySuccess}}">
<image src="/static/icons/loadingGif.gif"></image>
<view>疯狂加载中...</view>
</view> -->

View File

@@ -10,6 +10,7 @@ page {
border-radius: 15rpx;
overflow: hidden;
position: relative;
margin-bottom: 30rpx;
}
.address-arrow {
@@ -53,6 +54,7 @@ page {
.address-img {
width: 100%;
height: 10rpx;
display: block;
}
@@ -76,7 +78,7 @@ page {
.list-goods {
background-color: #FFFFFF;
margin: 30rpx 0;
margin: 0 0 30rpx 0;
display: flex;
padding: 30rpx;
border-radius: 15rpx;
@@ -123,6 +125,7 @@ page {
border-radius: 15rpx;
overflow: hidden;
box-sizing: border-box;
margin-bottom: 30rpx;
}
.label-item {
@@ -148,6 +151,10 @@ page {
flex: 1;
}
.label-picker{ width: 70%; }
.label-picker-val{ text-align: right; display: flex; align-items: center; justify-content: flex-end;}
.label-picker-icon{ width: 24rpx; height: 24rpx; margin-left: 10rpx; }
/*checkbox选中后样式 */
.label-text-checkbox {

View File

@@ -11,18 +11,21 @@ Page({
data: {
isFixedTop : 0,
barHeight : getApp().globalData.barHeight, // 状态栏高度
goodsId : '', // 商品id
goodsData : '', // 商品数据
mallContent : '', // 商品详情
skus : [], // 显示的规格-提交
goodsId : '', // 商品id
goodsData : '', // 商品数据
mallContent : '', // 商品详情
skus : [], // 显示的规格-提交
skuid : '',
specselect : '', // 确认购买的规格
selectSkusValues: '', // 默认选项
valueId : '', // 选中规格id
valueIndex : '', // 选中规格下标index
specselect : '', // 确认购买的规格
selectSkusValues: '', // 默认选项
valueId : '', // 选中规格id
valueIndex : '', // 选中规格下标index
specselectIndex : '',
qtyNumber : 1, // 产品数量
goodsSize : false
qtyNumber : 1, // 产品数量
goodsSize : false,
invite : '',
isParent : false, // 绑定邀请码
buyType : null // 购物方式
},
/**
@@ -30,8 +33,11 @@ Page({
*/
onLoad(options) {
this.setData({
goodsId: options.id
goodsId: options.id,
})
if(getApp().globalData.invite == '' && options.invite){
getApp().globalData.invite = options.invite
}
},
/**
@@ -42,21 +48,81 @@ Page({
this.goodsInfo();
},
/**
* 输入产品数量
*/
goodsNumberInput(e){
let inventory = this.data.selectSkusValues.stock
if(inventory < e.detail.value ){
wx.showToast({
title: '超出库存数量',
icon : 'none',
})
this.setData({
qtyNumber: Math.min(inventory, e.detail.value)
})
return
}
this.setData({
qtyNumber: e.detail.value
})
},
/**
* 离开产品数量
*/
goodsNumberBlur(e){
let { value } = e.detail
if(value == '' || value <= 0){
this.setData({
qtyNumber: 1
})
}
},
/**
* 商品详情
*/
goodsInfo() {
wx.$api.mall.goodsSee(this.data.goodsId).then(res => {
console.log(res.data)
this.setData({
goodsData : res.data,
mallContent : res.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
skus : res.data.skus,
skuid : res.data.skus[0].sku_id,
selectSkusValues: res.data.skus[0],
specselect : res.data.skus[0].unit.split('|')
})
}).catch(err =>{})
// 因分享朋友圈启动时未挂载全局接口方法,故这里只能使用微信原生方法
wx.showLoading({
title: '加载中...',
mask : true
})
wx.request({
url : 'https://api.xhtest.douhuofalv.com/api/mall/goods/' + this.data.goodsId,
// url : 'https://api.xuanhuojk.com/api/mall/goods/' + this.data.goodsId,
header : {
"Accept" : "application/json",
"channel" : "client",
"Authorization" : wx.getStorageSync("token") || ""
},
success: res => {
wx.hideLoading()
let { statusCode, data } = res
if(statusCode == 200){
let dataOBJ = data.data
this.setData({
goodsData : dataOBJ,
mallContent : dataOBJ.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"'),
skus : dataOBJ.skus,
skuid : dataOBJ.skus[0].sku_id,
selectSkusValues: dataOBJ.skus[0],
specselect : dataOBJ.skus[0].unit.split('|'),
invite : dataOBJ.invite
})
return
}
wx.showToast({
title: data.message,
icon : 'none'
})
},
fail: err => {
wx.showToast({
title: err.errMsg,
icon : 'none'
})
}
})
},
/**
@@ -72,9 +138,12 @@ Page({
this.setData({
[temp1]: valueid
})
let newlist = []
let str = ''
for (var i in this.data.specselect) {
console.log(this.data.specselect)
if (i == index) {
newlist.push(valueid);
if (i == 0) {
@@ -98,6 +167,8 @@ Page({
})
break;
}
console.log(this.data.selectSkusValues)
}
this.setData({
specselect: newlist
@@ -150,9 +221,10 @@ Page({
/**
* 规格弹出
*/
buyPop() {
buyPop(e) {
this.setData({
goodsSize: !this.data.goodsSize
goodsSize : !this.data.goodsSize,
buyType : e.currentTarget.dataset.type
})
},
@@ -161,44 +233,96 @@ Page({
*/
closeTap() {
this.setData({
goodsSize: false
goodsSize: false,
buyType : null
})
},
/**
* 确认购买
* 检查登录状态
*/
buyTap() {
// 获取登录状态
if(wx.getStorageSync("token") != ''){
let {
sku_id,
stock
} = this.data.selectSkusValues;
if (stock > 0) {
this.setData({
skuid: sku_id,
goodsSize: false
})
wx.navigateTo({
url: '/pages/mall/confirm/confirm?skuId=' + sku_id + '&qty=' + this.data.qtyNumber
})
} else {
uni.showToast({
title: '当前商品库存不足',
icon: 'none',
mask: true,
duration: 2000
})
let token = wx.getStorageSync("token") || null
if(token != null){
switch (this.data.buyType) {
case 'card':
this.orderCard()
break;
default:
this.orderBuy()
break;
}
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/index"
})
}
},
/**
* 立即购买
*/
orderBuy(){
let { sku_id, stock } = this.data.selectSkusValues;
if (stock > 0) {
this.setData({
skuid : sku_id,
goodsSize : false
})
// 是否有推荐人
if(this.data.goodsData.has_parent) {
wx.navigateTo({
url: '/pages/mall/confirm/confirm?skuId=' + sku_id + '&qty=' + this.data.qtyNumber || 1
})
return
}
// 显示绑定手机号弹窗
this.setData({
isParent: true
})
} else {
uni.showToast({
title: '当前商品库存不足',
icon: 'none',
mask: true,
duration: 2000
})
}
},
/**
* 加入购物车
*/
orderCard(){
let { sku_id, stock } = this.data.selectSkusValues;
let qty = this.data.qtyNumber || 1
if (stock <= 0) {
uni.showToast({
title: '当前商品库存不足',
icon : 'none',
})
return
}
// 是否有推荐人
if(!this.data.goodsData.has_parent) {
this.setData({
isParent : true,
goodsSize : false
})
return
}
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.bag.add({ sku_id, qty }).then(res => {
wx.showToast({
title: "已加入",
icon: "success"
})
this.closeTap()
})
},
/**
* 监听页面滑动事件
@@ -232,6 +356,43 @@ Page({
})
},
/*
获取邀请码
*/
bindinput(e) {
this.setData({
nameValue: e.detail.value
})
},
/**
* 关闭绑定邀请码弹窗
*/
nameCancel() {
this.setData({
isParent: !this.data.isParent
})
},
/**
* 绑定邀请码
*/
nameTrue() {
let {
sku_id
} = this.data.selectSkusValues;
wx.$api.mall.userBind({
username: this.data.nameValue
}).then(res => {
wx.navigateTo({
url: '/pages/mall/confirm/confirm?skuId=' + sku_id + '&qty=' + this.data.qtyNumber || 1
})
this.setData({
isParent: false
})
})
},
/**
* 放大轮播相册图片
*/
@@ -245,5 +406,25 @@ Page({
urls : imgs,
current : imgs[index]
})
},
/**
* 分享给朋友
*/
onShareAppMessage(){
return{
title : this.data.goodsData.name,
path : '/pages/mall/details/details?id=' + this.data.goodsId + '&invite=' + this.data.invite,
imageUrl: this.data.goodsData.cover
}
},
/**
* 分享朋友圈
*/
onShareTimeline(){
return{
title : this.data.goodsData.name,
query : 'id=' + this.data.goodsId + '&invite=' + this.data.invite,
imageUrl : this.data.goodsData.cover
}
}
})

View File

@@ -23,15 +23,14 @@
<view class="goodsInfo-top">
<view class="goodsInfo-price">
<view class="goodsInfo-cost"><text>¥</text>{{goodsData.original_price}}</view>
<!-- <view class="goodsInfo-vip"><text>会员价¥</text>99.00</view> -->
</view>
</view>
<view class="goodsInfo-name">
{{goodsData.name}}
</view>
<view class="goodsInfo-share" bindtap="shareTap">
<button class="goodsInfo-share" size="mini" open-type="share">
<image class="goodsInfo-share-image" src="/static/icons/goodsShare.png"></image>分享
</view>
</button>
</view>
<view class="goodsWhite goodsItem">
@@ -54,23 +53,23 @@
<!-- 底部 -->
<view class="footer">
<view class="number">
<text></text><view class="number-price">¥{{goodsData.original_price}}</view>
</view>
<button class="btn-disabled" disabled="{{disabled}}" bindtap="buyPop">确认购买</button>
<button class="btn-disabled card" size="mini" disabled="{{disabled}}" bindtap="buyPop" data-type="card">加入购物车</button>
<button class="btn-disabled" size="mini" disabled="{{disabled}}" bindtap="buyPop" data-type="buy">立即购买</button>
</view>
<!-- 规格弹出 -->
<view class="goods-size-back {{goodsSize ? 'active':''}}" bindtap="closeTap"></view>
<view class="goods-size-content {{goodsSize ? 'active':''}}">
<image class="goods-size-close" bindtap="closeTap" src="/static/icons/close.png" mode="widthFix"></image>
<view class="goods-size-img">
<image src="{{selectSkusValues.cover}}" mode="aspectFill"></image>
</view>
<view class="goods-size-info">
<view class="goods-size-info-price nowrap">¥{{selectSkusValues.price}}</view>
<view class="goods-size-info-text nowrap" wx:if="{{selectSkusValues.stock > 0}}">剩余库存: {{selectSkusValues.stock}}</view>
<view class="goods-size-info-text nowrap" wx:else>当前商品库存不足</view>
<view class="goods-size-flex">
<image class="goods-size-cover" src="{{selectSkusValues.cover}}" mode="aspectFill"></image>
<view class="goods-size-remove" bind:tap="closeTap">
<image class="goods-size-close" src="/static/icons/close.png" mode="widthFix"></image>
</view>
<view class="goods-size-info">
<view class="goods-size-price nowrap"><text>¥</text>{{selectSkusValues.price}}</view>
<view class="goods-size-text nowrap">剩余库存: {{selectSkusValues.stock}}</view>
</view>
</view>
<view class="goods-size-tag" wx:for="{{goodsData.specs}}" wx:key="specs" data-specid="{{item.spec_id}}" wx:for-index="idx">
<view class="goods-size-title">{{item.name}}</view>
@@ -80,7 +79,7 @@
<text class="goods-size-title">数量</text>
<view class="goods-number" wx:if="{{selectSkusValues.stock != 0}}">
<view class="goods-number-btn" bindtap="goodsNumber" data-type="remove">-</view>
<input class="goods-number-input" value="{{qtyNumber}}" type="number" bindinput="goodsNumberInput" disabled></input>
<input class="goods-number-input" value="{{qtyNumber}}" type="number" bindinput="goodsNumberInput" bindblur="goodsNumberBlur"></input>
<view class="goods-number-btn" bindtap="goodsNumber" data-type="plus">+</view>
</view>
<view class="goods-number" wx:else>
@@ -89,11 +88,29 @@
<view class="goods-number-btn">+</view>
</view>
</view>
<view class="goods-size-btn" wx:if="{{selectSkusValues.stock == 0}}">
<view class="active">抱歉,商品库存不足了 ~</view>
<view class="goods-size-btn">
<button
bindtap="buyTap"
size="default"
disabled="{{selectSkusValues.stock == 0 || qtyNumber == 0}}">
{{ selectSkusValues.stock == 0 || qtyNumber == 0 ? '库存不足' : '确定'}}
</button>
</view>
<view class="goods-size-btn" wx:else>
<view bindtap="buyTap">立即购买</view>
</view>
<!-- 绑定业务联系人 -->
<view class="namePop {{isParent ? 'active' : ''}}"></view>
<view class="nameCont {{isParent ? 'active' : ''}}">
<view class="nameCont-white">
<view class="nameCont-top">
<view class="nameCont-title">绑定业务联系人</view>
<view class="nameCont-input">
<input type="text" name="name" value="{{nameValue}}" placeholder="请输入业务联系人手机号" bindinput="bindinput" />
</view>
</view>
<view class="nameCont-btn">
<view class="nameCont-btn-go" bindtap="nameCancel">暂不绑定</view>
<view class="nameCont-btn-go" bindtap="nameTrue">立即绑定</view>
</view>
</view>
</view>

View File

@@ -48,7 +48,6 @@ page {
height: 100%;
}
/* 产品 */
/* 产品详情 */
.goodsCont {
padding: 30rpx;
@@ -103,7 +102,7 @@ page {
font-size: 32rpx;
}
.goodsInfo-share {
button.goodsInfo-share[size="mini"] {
position: absolute;
top: 40rpx;
right: 30rpx;
@@ -111,6 +110,9 @@ page {
font-size: 27rpx;
line-height: 34rpx;
color: #9b9b9b;
padding: 0;
background: transparent;
font-weight: normal;
}
.goodsInfo-share-image {
@@ -190,9 +192,6 @@ page {
color: #999999;
}
.goodsItem-label-text {
}
.goodsItem-label-tips {
font-size: 26rpx;
margin-top: 10rpx;
@@ -206,82 +205,51 @@ page {
/* 底部 */
.footer {
width: 100%;
height: 60px;
background-color: #ffffff;
border-top-right-radius: 40rpx;
border-top-left-radius: 40rpx;
position: fixed;
left: 0;
bottom: 0;
padding: 30rpx 20rpx 50rpx;
z-index: 9;
box-sizing: border-box;
display: flex;
}
.number {
flex: 1;
line-height: 60px;
color: #da2b54;
display: flex;
padding: 0 30rpx;
box-sizing: border-box;
}
.number text {
font-size: 28rpx;
padding-top: 10rpx;
}
.number-price {
padding: 0 5rpx;
font-size: 46rpx;
}
.number-vip {
margin-left: 20rpx;
font-size: 26rpx;
color: #8d97a1;
padding-top: 6rpx;
box-sizing: border-box;
}
.btn-disabled {
color: #FFFFFF;
line-height: 60px;
text-align: center;
border: none;
border-radius:0;
background-color: #da2b54;
padding: 0;
margin: 0;
}
button[disabled]{
padding: 0;
padding: 0;
height: 100rpx;
line-height: 60px;
color: white !important;
opacity: .8;
background-color: transparent !important;
}
button.btn-disabled[size="mini"]{ line-height: 90rpx; border-radius: 45rpx; background: #da2b54; color: white; font-size: 30rpx; width: calc(50% - 20rpx); }
button.btn-disabled.card[size="mini"]{ background: orange; }
/* 规格弹出 */
.goods-size-back { position: fixed; top: 0; left: 0; height: 100%; width: 100%; background: rgba(0, 0, 0, 0.3); z-index: 9; display: none; }
.goods-size-back.active { display: block; }
.goods-size-content { position: fixed; bottom: -100%; left: 0; width: 100%; background: white; z-index: 100; transition: all 0.2s; border-radius: 40rpx 40rpx 0 0;}
.goods-size-content.active { bottom: 0; }
/* 规格 */
.goods-size-back {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba(0, 0, 0, 0.3);
z-index: 9;
display: none;
}
.goods-size-flex{ display: flex; justify-content: space-between; align-items: flex-end; padding: 30rpx; position: relative; }
.goods-size-cover{ background: #f7f8f9; width: 188rpx; height: 188rpx; border-radius: 20rpx; }
.goods-size-info{ width: calc(100% - 188rpx); padding-left: 30rpx; }
.goods-size-price{ font-size: 44rpx; font-weight: bold; color: #da2b54; line-height: 60rpx; }
.goods-size-price text{ font-size: 80%; }
.goods-size-text{ font-size: 28rpx; color: gray; line-height: 50rpx; }
.goods-size-back.active {
display: block;
}
.goods-size-remove{ position: absolute; right: 30rpx; top: 30rpx; padding: 10rpx; }
.goods-size-close{ width: 38rpx; height: 38rpx; vertical-align: top; }
.goods-size-tag { padding: 0 30rpx 30rpx; }
.goods-size-tag-text { background: #f5f6fa; color: #999; line-height: 50rpx; margin: 20rpx 20rpx 0 0; padding: 0 15rpx; display: inline-block; font-size: 24rpx; border-radius: 10rpx; }
.goods-size-tag-text.active { color: #fff; background: #da2b54; }
.goods-size-title{ font-weight: bold; line-height: 50rpx; font-size: 30rpx; }
.goods-size-number { color: #747788; display: flex; align-items: center; justify-content: space-between; padding: 30rpx; }
.goods-number { display: flex; height: 48rpx; border-radius: 10rpx; }
.goods-number-btn { background-color: #f7f8f9; width: 48rpx; height: 48rpx; line-height: 44rpx; text-align: center; border-radius: 24rpx; font-size: 30rpx; font-weight: bold; }
.goods-number-input { width: 80rpx; text-align: center; height: 48rpx; }
.goods-size-btn{ padding: 30rpx 30rpx 50rpx; }
.goods-size-btn button[size="default"]{ background: #da2b54; color: white; line-height: 90rpx; padding: 0; border-radius: 45rpx; width: 100%; margin: 0; }
/*
.goods-size-content {
position: fixed;
@@ -300,9 +268,7 @@ button[disabled]{
top: 30rpx;
}
.goods-size-content.active {
bottom: 0;
}
.goods-size-img {
position: absolute;
@@ -353,60 +319,13 @@ button[disabled]{
font-size: 26rpx;
}
.goods-size-tag {
padding: 0 20rpx 20rpx 20rpx;
}
.goods-size-tag-text {
background: #f5f6fa;
color: #999;
margin: 20rpx 10rpx 0 10rpx;
line-height: 50rpx;
padding: 0 15rpx;
display: inline-block;
font-size: 24rpx;
border-radius: 10rpx;
}
.goods-size-tag-text.active {
color: #fff;
background: #da2b54;
}
.goods-size-number {
padding: 10rpx 30rpx 80rpx 30rpx;
line-height: 60rpx;
color: #747788;
}
.goods-number {
display: flex;
float: right;
margin-top: 25rpx;
height: 48rpx;
border: 2rpx solid #d7d7d7;
border-radius: 10rpx;
}
.goods-number-btn {
background-color: transparent;
width: 48rpx;
height: 48rpx;
line-height: 48rpx;
text-align: center;
}
.goods-number-input {
width: 80rpx;
text-align: center;
height: 48rpx;
border-left: 2rpx solid #d7d7d7;
border-right: 2rpx solid #d7d7d7;
}
.goods-size-btn view {
.goods-size-btn button[size="default"] {
text-align: center;
line-height: 90rpx;
padding: 0;
border-radius: 0;
font-size: 28rpx;
background: #da2b54;
color: white;
@@ -416,4 +335,109 @@ button[disabled]{
.goods-size-btn view.active {
background: #b8b8b8;
} */
/* 邀请码弹出 */
.namePop {
position: fixed;
background-color: rgba(0, 0, 0, .5);
left: 0;
top: 0;
height: 100vh;
width: 100vw;
z-index: 100000;
display: none;
}
.namePop.active {
display: block;
}
.nameCont {
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 100000;
padding: 0 15%;
box-sizing: border-box;
display: none;
}
.nameCont.active {
display: -webkit-box;
}
.nameCont-white {
background-color: #ffffff;
border-radius: 15rpx;
overflow: hidden;
}
.nameCont-top {
padding: 30rpx;
box-sizing: border-box;
}
.nameCont-title {
font-size: 34rpx;
margin-bottom: 30rpx;
}
.nameCont-input {
height: 90rpx;
line-height: 90rpx;
position: relative;
background-color: #f3f3f3;
border-radius: 10rpx;
overflow: hidden;
padding: 0 25rpx;
box-sizing: border-box;
}
.nameCont-input input {
width: calc(100% - 40rpx);
height: 100%;
background-color: transparent;
}
.nameCont-colse {
width: 40rpx;
height: 40rpx;
top: 25rpx;
right: 20rpx;
position: absolute;
z-index: 9;
}
.nameCont-btn {
line-height: 100rpx;
background-color: #f3f3f3;
display: flex;
margin-top: 30rpx;
border-top: 2rpx solid #dfdfdf;
}
.nameCont-btn-go {
text-align: center;
flex: 2;
}
.nameCont-btn-go:last-child {
position: relative;
color: #ff9951;
}
.nameCont-btn-go:last-child::after {
position: absolute;
content: '';
left: 0;
top: 0;
width: 2rpx;
height: 100%;
background-color: #dfdfdf;
}

View File

@@ -38,7 +38,7 @@
<view class="nowrap goodsItem-text">{{item.description}}</view>
<view class="goodsItem-tips">
<view class="goodsItem-price">¥{{item.original_price}}</view>
<view class="goodsItem-sales">月销 {{item.sales}}</view>
<view class="goodsItem-sales">浏览 {{item.clicks}}</view>
</view>
</view>
</view>

View File

@@ -9,19 +9,35 @@ Page({
* 页面的初始数据
*/
data: {
scrollLeft : '', // 商品分类
bannerArr : [], // 轮播信息
categorieArr: [], // 分类信息
goodsArr : [], // 商品信息
articlesArr : [], // 公告列表
page : {}, // 分页信息
lodingStats : false,// 加载状态
scrollLeft : '', // 商品分类
bannerArr : [], // 轮播信息
categorieArr : [], // 分类信息
goodsArr : [], // 商品信息
articlesArr : [], // 公告列表
page : {}, // 分页信息
lodingStats : false,// 加载状态
buy_sku_id : false,// 身份包产品
can_buy : false,// 是否可购买
certification : false,// 是否已认证
empowerArr : [] // 增收赋能
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
onLoad(options) {
if(options.invite){
getApp().globalData.invite = options.invite || null
}else{
let sceneCode = options.scene || null
if(sceneCode != null ){
let inviteCode = decodeURIComponent(sceneCode)
let invite = inviteCode.match(new RegExp("(^|&)" + 'invite' + "=([^&]*)(&|$)", "i"));
getApp().globalData.invite = invite[2] || null
}
}
},
/**
* 生命周期函数--监听页面显示
@@ -38,6 +54,37 @@ Page({
// 获取公告列表
this.articlesInfo();
// 获取身份包产品
this.getidpackage()
// 增收赋能接口
this.getEmpower()
},
/**
* 增收赋能接口
*/
getEmpower(){
wx.$api.empower.lists().then(res => {
this.setData({
empowerArr: res.data
})
})
},
/**
* 身份包
*/
getidpackage(){
wx.$api.mall.idpackage().then(res => {
let { buy_sku_id, can_buy, certification } = res.data
this.setData({
buy_sku_id,
can_buy,
certification
})
})
},
/**
@@ -48,8 +95,6 @@ Page({
this.setData({
bannerArr: res.data
})
}).catch(err =>{
})
},
@@ -61,8 +106,6 @@ Page({
this.setData({
categorieArr: res.data
})
}).catch(err =>{
})
},
@@ -83,8 +126,6 @@ Page({
lodingStats : false
})
wx.stopPullDownRefresh()
}).catch(err =>{
})
},
@@ -96,8 +137,7 @@ Page({
this.setData({
articlesArr: res.data.data
})
console.log(res)
}).catch(err =>{})
})
},
/**
@@ -117,6 +157,69 @@ Page({
})
},
/**
* 购买产品包
*/
onCapsule(){
if(wx.getStorageSync("token") != ''){
if(!this.data.certification){
wx.showModal({
title : '提示',
content : '您还未完成账号实名认证,暂不可购买',
cancelText : '稍后',
cancelColor : '#333',
confirmText : '去认证',
confirmColor : '#da2b54',
success : res => {
if(res.confirm){
wx.navigateTo({
url: '/pages/idcard/idcard',
})
}
}
})
return
}
wx.navigateTo({
url: '/pages/mall/confirm/confirm?qty=1&skuId=' + this.data.buy_sku_id
})
return
}
wx.navigateTo({
url: "/pages/login/index"
})
},
/**
* 开通vip
*/
onVip(){
if(wx.getStorageSync("token") != ''){
wx.navigateTo({
url: '/pages/idcard/idcard',
})
return
}
wx.navigateTo({
url: "/pages/login/index"
})
},
/**
* 查看增收赋能详情
*/
onEmpower(e){
if(wx.getStorageSync("token") != ''){
wx.navigateTo({
url: '/pages/empower/empowerInfo/empowerInfo?id=' + e.currentTarget.dataset.id
})
return
}
wx.navigateTo({
url: "/pages/login/index"
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/

View File

@@ -40,6 +40,16 @@
</view>
</view>
<!-- 身份包产品 -->
<view class="capsule" wx:if="{{can_buy}}">
<image class="capsule-src" src="/static/imgs/capsule.png" mode="widthFix" bind:tap="onCapsule"></image>
</view>
<!-- 开通vip -->
<view class="capsule" wx:if="{{certification}}">
<image class="capsule-src" src="/static/imgs/vip.png" mode="widthFix" bind:tap="onVip"></image>
</view>
<!-- 推荐 -->
<view class="suggest">
<view class="suggestLeft">
@@ -107,6 +117,7 @@
</scroll-view>
</view>
<!-- 商品 -->
<view class="goods">
<view class="goodsList" wx:if="{{goodsArr.length > 0}}">
<navigator hover-class="none" url="./details/details?id={{item.goods_id}}" class="goodsItem" wx:for="{{goodsArr}}" wx:key="goodsArr">
@@ -118,7 +129,7 @@
<view class="nowrap goodsItem-text">{{item.description}}</view>
<view class="goodsItem-tips">
<view class="goodsItem-price">¥{{item.original_price}}</view>
<view class="goodsItem-sales">览 {{item.clicks}}</view>
<view class="goodsItem-sales">览 {{item.clicks}}</view>
</view>
</view>
</navigator>
@@ -127,7 +138,7 @@
<image class="pagesLoding-icon" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
<!-- 没有更多了~ -->
</block>
</view>
</view>
@@ -135,4 +146,21 @@
<image src="/static/imgs/text_null.png"></image>
<view>暂无商品</view>
</view>
</view>
<!-- 增收赋能 -->
<view class="module" wx:if="{{empowerArr.length > 0}}">
<view class="module-title">
增收赋能类
</view>
<view class="enable-scroll">
<view class="enable-label" wx:for="{{empowerArr}}" wx:key="empowerArr" bindtap="onEmpower" data-id="{{item.id}}">
<image class="enable-img" src="{{item.cover}}" alt="" mode="widthFix"></image>
<view class="enable-cont">
<view class="nowrap enable-title">{{item.title}}</view>
<view class="nowrap enable-text">{{item.sub_title}}</view>
<view class="enable-price">¥{{item.price}}/年</view>
</view>
</view>
</view>
</view>

View File

@@ -3,7 +3,7 @@ page {
}
.linearBack {
background-image: linear-gradient(to top, #ffffff 60%, #fde8e9);
background-image: linear-gradient(to top, #ffffff 60%, #fbe2e1);
padding: 30rpx;
box-sizing: border-box;
}
@@ -99,13 +99,13 @@ page {
}
.noticeCont-icon {
width: 38rpx;
width: 32rpx;
margin-top: 28rpx;
}
.noticeCont-name {
width: calc(100% - 38rpx);
padding-left: 30rpx;
width: calc(100% - 32rpx);
padding-left: 20rpx;
box-sizing: border-box;
color: #da2b54;
}
@@ -266,6 +266,7 @@ page {
.goodsList {
flex-wrap: wrap;
justify-content: flex-start;
margin: 0 -10rpx;
}
.goodsItem {
@@ -310,7 +311,7 @@ page {
.goodsItem-price {
flex: 1;
color: #ff1122;
color: #da2b54;
font-size: 32rpx;
font-weight: 600;
}
@@ -320,10 +321,65 @@ page {
color: #999999;
}
/* 自选产品包 */
.capsule{ padding: 0 40rpx 20rpx; }
.capsule-src{ width: 100%; }
/* 暂无列表 */
.goodsList-no {
background-color: #ffffff;
border-radius: 20rpx;
padding: 30rpx 30rpx 60rpx;
box-sizing: border-box;
}
/* 增收赋能 */
.module {
padding: 30rpx;
box-sizing: border-box;
}
.module-title {
margin-bottom: 20rpx;
color: #000000;
font-size: 32rpx;
font-weight: 600;
}
.enable-label {
background-color: #ffffff;
padding: 20rpx;
box-sizing: border-box;
border-radius: 20rpx;
position: relative;
margin-bottom: 30rpx;
}
.enable-img {
width: 200rpx;
border-radius: 20rpx;
}
.enable-cont {
position: absolute;
left: 0;
top: 0;
padding: 20rpx 20rpx 20rpx 240rpx;
box-sizing: border-box;
}
.enable-title {
font-size: 34rpx;
margin: 10rpx 0 15rpx;
}
.enable-price {
font-size: 36rpx;
color: #f0115c;
font-weight: 600;
}
.enable-text {
color: #999999;
margin: 10rpx 0 40rpx;
}

View File

@@ -54,8 +54,13 @@ Page({
* 支付订单
*/
payClick() {
let payData = {
order_id : this.data.goodsData.order_id,
order_no : this.data.goodsData.order_no,
order_type : this.data.goodsData.order_type
}
wx.navigateTo({
url: '/pages/pay/index?order_no=' + this.data.goodsData.order_no + '&total=' + this.data.goodsData.total
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(payData))
})
},

View File

@@ -1,7 +1,7 @@
<view class="orderData">
<view class="While">
<view class="orderData-cont-label">
<image class="orderData-cont-img" src="https://cdn.shuiganying.com/images/2023/04/04/3b3938e3a883e6b173b4d49a5242666a.png" mode="aspectFill"></image>
<image class="orderData-cont-img" src="/static/icons/copy_icon.png" mode="aspectFill"></image>
<view class="orderData-cont-text">
<view class="orderData-cont-name">订单编号</view>
<view class="orderData-cont-copy">
@@ -10,13 +10,18 @@
</view>
</view>
</view>
<view class="orderData-cont-label">
<view class="orderData-cont-label" wx:if="{{goodsData.delivery_type === 0}}">
<image class="orderData-cont-img" src="/static/icons/siteIcon.png" mode="aspectFill"></image>
<view class="orderData-cont-text orderData-cont-site">
<view class="orderData-cont-name">{{ goodsData.express.name }} <text>{{ goodsData.express.mobile }}</text></view>
<view class="orderData-cont-copy">
{{ goodsData.express.full_address }}
</view>
<view class="orderData-cont-copy">{{ goodsData.express.full_address }}</view>
</view>
</view>
<view class="orderData-cont-label" wx:if="{{goodsData.delivery_type === 1}}">
<image class="orderData-cont-img" src="/static/icons/siteIcon.png" mode="aspectFill"></image>
<view class="orderData-cont-text orderData-cont-site">
<view class="orderData-cont-name">提货地址</view>
<view class="orderData-cont-copy">{{ goodsData.pickup.address }}</view>
</view>
</view>
</view>
@@ -25,60 +30,74 @@
<view class="shopSee-name"><image src="/static/icons/shop.png" mode="widthFix"></image>{{goodsData.shop.name}}</view>
<view class="shopSee-state reserve-status">{{goodsData.state}}</view>
</view>
<view class="list-goods">
<block wx:for="{{goodsData.items}}" wx:key="items">
<image class="list-goods-img" mode="aspectFill" src="{{item.sku.cover}}"></image>
<view class="list-goods-cont">
<view class="nowrap list-goods-name">{{item.sku.goods_name}}</view>
<view class="list-goods-text">
<text>购买数量</text>x{{item.qty}}
</view>
<view class="list-goods-parice">
¥<text>{{item.price}}</text>
</view>
<view class="list-goods" wx:for="{{goodsData.items}}" wx:key="items">
<image class="list-goods-img" mode="aspectFill" src="{{item.sku.cover}}"></image>
<view class="list-goods-cont">
<view class="nowrap list-goods-name">{{item.sku.goods_name}}</view>
<view class="list-goods-text">
<text>购买数量</text>x{{item.qty}}
</view>
</block>
<view class="list-goods-parice">
¥<text>{{item.price}}</text>
</view>
</view>
</view>
</view>
<view class="While reserveCont">
<view class="reserveCont-title">订单信息</view>
<view class="reserve-label">
<view class="reserve-name">交易时间</view>
<view class="reserve-name">下单人</view>
<view class="reserve-text">{{goodsData.user.name}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">下单人手机号</view>
<view class="reserve-text">{{goodsData.user.mobile}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">下单时间</view>
<view class="reserve-text">{{goodsData.created_at}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">运费</view>
<view class="reserve-text">{{goodsData.freight == 0 ? '免邮' : goodsData.freight + '元'}}</view>
<view class="reserve-name">付款时间</view>
<view class="reserve-text">{{goodsData.paid_at}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">交易状态</view>
<view class="reserve-text reserve-status">{{goodsData.state}}</view>
<view class="reserve-name">配送运费</view>
<view class="reserve-text">{{goodsData.freight == 0 ? '免邮' : goodsData.freight}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">订单金额</view>
<view class="reserve-text">¥{{goodsData.amount}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">实付金额</view>
<view class="reserve-text reserve-price">¥{{goodsData.total}}</view>
</view>
<!--
<view class="reserve-label">
<view class="reserve-name">实付款</view>
<view class="reserve-text reserve-price">¥{{goodsData.total}}</view>
</view>
</view> -->
</view>
<view class="While reserveCont" wx:if="{{goodsData.express.express_no}}">
<view class="reserveCont-title">物流信息</view>
<view class="reserve-label">
<view class="reserve-name">物流名称</view>
<view class="reserve-text">{{goodsData.express.express_name}}</view>
<view class="reserve-name">快递公司</view>
<view class="reserve-text">{{goodsData.express.express_name || '-'}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">物流单号</view>
<view class="reserve-name">快递单号</view>
<view class="reserve-text reserve-text-copy">
{{goodsData.express.express_no}}<view bindtap="copyExpress" class="reserve-text-tap" data-no="{{goodsData.express.express_no}}">复制</view>
{{goodsData.express.express_no || '-'}}<view bindtap="copyExpress" class="reserve-text-tap" data-no="{{goodsData.express.express_no}}">复制</view>
</view>
</view>
<view class="reserve-label">
<!-- <view class="reserve-label">
<view class="reserve-name">查看物流信息</view>
<view class="reserve-text reserve-text-btn" bindtap="h5url">
去查看
</view>
</view>
</view> -->
</view>
</view>
<view class="order-data-footer">

View File

@@ -215,7 +215,7 @@ page {
}
.reserve-status {
color: #ff8100
color: #da2b54
}
/* 底部菜单 */

View File

@@ -60,8 +60,14 @@ Page({
* 支付订单
*/
payClick(e) {
let { item } = e.currentTarget.dataset
let data = {
order_id : item.order_id,
order_no : item.order_no,
order_type : item.order_type
}
wx.navigateTo({
url: '/pages/pay/index?order_no=' + e.currentTarget.dataset.order_no + '&total=' + e.currentTarget.dataset.total
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(data))
})
},
@@ -137,5 +143,14 @@ Page({
// 获取订单列表
this.listInfo(pageNumber);
}
},
/**
* 申请售后
*/
signRefund(e){
let { order_no } = e.currentTarget.dataset
wx.navigateTo({
url: "/pages/refund/aftersale/aftersale?id=" + order_no,
})
}
})

View File

@@ -33,19 +33,14 @@
<view class="list-total active" wx:else>
兑换券兑换
</view>
<view class="list-tips">
<view class="list-tips-left">
<image class="list-tips-img" src="https://cdn.shuiganying.com/images/2023/04/04/d4543817b05d3aaac04dfb85ff9f8f8c.png"></image>收货城市
</view>
<view class="nowrap list-tips-right">{{item.province_city}}</view>
</view>
<view class="list-operate">
<view class="list-more">
<view class="list-more-go" bindtap="operateMore" data-order_no="{{item.order_no}}" wx:if="{{item.can.cancel}}">更多</view>
</view>
<view class="list-btn">
<view class="list-btn-labor" bindtap="payClick" data-order_no="{{item.order_no}}" data-total="{{item.total}}" wx:if="{{item.can.pay}}">立即付款</view>
<view class="list-btn-labor" bindtap="payClick" data-item="{{item}}" wx:if="{{item.can.pay}}">立即付款</view>
<view bindtap="signClick" data-order_no="{{item.order_no}}" class="list-btn-labor" wx:if="{{item.can.sign}}">签收订单</view>
<view bindtap="signRefund" data-order_no="{{item.order_no}}" class="list-btn-labor" wx:if="{{item.can.refund}}">申请退货</view>
<navigator hover-class="none" url="./details/details?order_no={{item.order_no}}" class="list-btn-labor grey">查看详情</navigator>
</view>
</view>

View File

@@ -52,11 +52,12 @@ page {
}
.list-top-status {
color: #ff8100;
color: #da2b54;
}
.list-goods {
display: flex;
margin-bottom: 30rpx;
}
.list-goods-img {
@@ -143,6 +144,9 @@ page {
.list-operate {
display: flex;
margin-top: 20rpx;
padding-top: 30rpx;
border-top: solid 1rpx #f7f8f9;
}
.list-more {
@@ -157,8 +161,8 @@ page {
}
.list-btn-labor {
border: 2rpx solid #ff8100;
color: #ff8100;
border: 2rpx solid #da2b54;
color: #da2b54;
border-radius: 80rpx;
height: 56rpx;
line-height: 56rpx;

View File

@@ -9,20 +9,148 @@ Page({
* 页面的初始数据
*/
data: {
total : "0.00",
orderNo : "",
modelId : "",
modelType : "",
payType : "",
orderNos : [],
can : {
coin : 0,
wechat : 0,
},
loding : false,
noShow : false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const params = JSON.parse(decodeURIComponent(options.params));
console.log(params)
const { order_id, order_type, order_no } = JSON.parse(decodeURIComponent(options.params))
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.pay.info({ order_id, order_type }).then(res => {
let { can, total, model_type, model_id, order_nos } = res.data
this.setData({
orderNo : order_no,
payType : res.data.default,
modelId : model_id,
modelType : model_type,
orderNos : order_nos,
total,
can
})
wx.hideLoading()
})
},
/**
* 生命周期函数--监听页面显示
* 选择支付方式
*/
onShow() {
onPayType(e){
let { value } = e.detail
this.setData({
payType: value
})
},
/**
* 立即支付
*/
onPay(){
this.setData({
loding: true
})
switch (this.data.payType) {
case 'wechat':
this.wechatPay()
break;
case 'coin':
wx.showToast({
title: '支付方式暂未开放',
icon : 'none'
})
this.setData({
loding: false
})
break;
case 'baofoo':
this.baofuPay()
break;
}
},
/**
* 宝付微信
*/
baofuPay(){
wx.login({
success: wxCode => {
// wx.getFuzzyLocation({
// success: locationRes => {
// let { latitude, longitude } = locationRes
let { code } = wxCode;
let data = {
order_type : this.data.modelType,
order_id : this.data.modelId,
code : code,
longitude : '171.21',
latitude : '22.33',
}
wx.$api.pay.bfPay(data).then(res => {
console.log(res)
}).finally(() => {
this.setData({
loding: false
})
})
// }
// })
}
})
},
/**
* 微信支付
*/
wechatPay(){
wx.login({
success: wxCode => {
let { code } = wxCode;
wx.$api.pay.wechatPay({
order_type : this.data.modelType,
order_id : this.data.modelId,
type : "mini",
code : code
}).then(res => {
let { wechat, trade_id } = res.data
let wechatObj = JSON.parse(wechat)
wx.requestPayment({
nonceStr : wechatObj.nonceStr,
package : wechatObj.package,
paySign : wechatObj.paySign,
timeStamp: wechatObj.timeStamp,
signType : wechatObj.signType,
success : () => {
wx.redirectTo({
url: './success/success?trade_id=' + trade_id,
})
}
})
}).finally(() => {
this.setData({
loding: false
})
})
}
})
},
/**
* 展开订单号
*/
noTap() {
this.setData({
noShow: !this.data.noShow
})
}
})

View File

@@ -1,23 +1,53 @@
<view class="payTop">
<view class="payTop-time">支付有效期为10分钟请尽快支付</view>
<view class="payTop-price"><text>¥</text>199.00</view>
<view class="payTop-text">微信支付</view>
</view>
<view class="payWay">
<view class="payWay-item">
<image class="payWay-img" src="https://cdn.shuiganying.com/images/2023/04/04/70400072de51a3157d9ead602eb3a294.png"></image>
<view class="payWay-name">微信支付</view>
<image class="payWay-icon" src="https://cdn.shuiganying.com/images/2023/04/04/2d9eed259c7a73b4d2aa4d496dbfa8a4.png"></image>
<view class="content">
<view class="info">
<view class="title">实付金额</view>
<view class="price"><text>¥</text>{{total}}</view>
<view class="no">
<view class="no-title">支付金额包含订单</view>
<view class="no-list {{noShow ? 'active' : ''}}">
<view class="no-list-item" wx:for="{{orderNos}}" wx:key="order_nos">
<view class="no-list-item">订单号:{{item}}</view>
</view>
</view>
<view class="no-show {{noShow ? 'active' : ''}}" bindtap="noTap" wx:if="{{orderNos.length > 1}}">{{noShow ? '收起' : '展开'}} <image src="/static/icons/arrowWrite.png"></image></view>
</view>
</view>
<!-- 选择支付方式 -->
<view class="radio-title">选择支付方式</view>
<view class="radio-group">
<radio-group bindchange="onPayType">
<label class="radio-flex" wx:if="{{can.wechat == 1}}">
<view class="radio-text">
<image class="radio-icon" src="/static/pay/wechat.png"></image>
<text>微信支付</text>
</view>
<radio class="radio-radio" value="wechat" color="#da2b54" checked="{{payType == 'wechat'}}"/>
</label>
<label class="radio-flex" wx:if="{{can.coin == 1}}">
<view class="radio-text">
<image class="radio-icon" src="/static/pay/coin.png"></image>
<text>自选额度</text>
</view>
<radio class="radio-radio" value="coin" color="#da2b54" checked="{{payType == 'coin'}}"/>
</label>
<label class="radio-flex" wx:if="{{can.baofoo == 1}}">
<view class="radio-text">
<image class="radio-icon" src="/static/pay/wechat.png"></image>
<text>微信支付(宝付)</text>
</view>
<radio class="radio-radio" value="baofoo" color="#da2b54" checked="{{payType == 'baofoo'}}"/>
</label>
</radio-group>
<view class="radio-lay" wx:if="{{loding}}"></view>
</view>
<!-- 支付 -->
<view class="pay">
<button class="pay-btn" size="default" disabled="{{loding}}" loading="{{loding}}" bind:tap="onPay">立即支付</button>
</view>
</view>
<view class="footer">
<view bindtap="payBtn" class="btn" wx:if="{{disabled}}">确认支付</view>
<view class="btn active" wx:else>确认支付</view>
</view>
<view class="pack-center pages-hint grey" wx:if="{{paySuccess}}">
<view class="pack-center pages-hint grey">
<image src="/static/icons/loadingGif.gif"></image>
<view>疯狂加载中...</view>
</view>

View File

@@ -1,86 +1,30 @@
page {
background-color: #f4f4f6;
}
.payTop {
text-align: center;
padding: 140rpx 0;
}
.content{ background: white; min-height: 100vh; padding: 0 30rpx; }
.info{ padding:100rpx 20rpx; text-align: center; border-bottom: solid 1rpx #f7f8f9; }
.title{font-weight: bold; line-height: 40rpx;}
.price{ font-weight: bold; font-size: 80rpx; padding: 30rpx 0; line-height: 80rpx; }
.price text{ font-size: 80%; }
.no{ font-size: 26rpx; color: gray; line-height: 40rpx; }
.no-list {margin-top: 30rpx; background-color: #f7faff; border-radius: 10rpx; padding: 30rpx 10rpx; box-sizing: border-box; height: 100rpx; position: relative; overflow: hidden;}
.no-list::after {position: absolute; left: calc(50% - 9rpx); top: -18rpx; content: ''; width: 0;height: 0;border-bottom: 18rpx solid #f7faff; border-left: 18rpx solid transparent; border-right: 18rpx solid transparent;}
.no-list-item {line-height: 40rpx; margin-bottom: 30rpx;}
.no-list-item:last-child {margin-bottom: 0;}
.no-list.active {height: auto;}
.no-show {background-color: #f7faff; color: #000000; display: inline-block; padding: 0 40rpx; line-height: 52rpx; border-radius: 0 0 10rpx 10rpx; font-size: 26rpx;}
.no-show image {width: 24rpx; height: 24rpx; vertical-align: -4rpx;transform: rotate(270deg); transition: .2s;}
.no-show.active image {transform: rotate(90deg);}
.payTop-price {
font-weight: 600;
font-size: 78rpx;
line-height: 70rpx;
padding: 20rpx 0 0;
}
/* 支付方式 */
.radio-title{ font-weight: bold; font-size: 30rpx; padding: 30rpx; }
.radio-group{ padding: 0 30rpx; position: relative; }
.radio-flex{ display: flex; align-items: center; justify-content: space-between; padding: 30rpx 0; border-bottom: solid 1rpx #f7f8f9; }
.radio-text{ display: flex; align-items: center; font-size: 30rpx; }
.radio-icon{ width: 58rpx; height: 58rpx; border-radius: 10rpx; margin-right: 30rpx; }
.radio-radio{ transform: scale(.8) }
.radio-lay{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.payTop-price text {
font-size: 36rpx;
}
/* 支付 */
.pay{ margin-top: 100rpx; }
.pay-btn[size="default"]{ width: 100%; height: 100rpx; line-height: 100rpx; background: #da2b54; color: white; padding: 0; border-radius: 50rpx; font-size: 32rpx; }
.pay-btn[size="default"][disabled]{ opacity: .5; background: #da2b54; color: white;}
.payTop-time,
.payTop-text {
font-size: 28rpx;
color: #666666;
}
.payWay {
padding: 0 30rpx;
box-sizing: border-box;
}
.payWay-item {
background-color: #ffffff;
border-radius: 15rpx;
padding: 25rpx 30rpx;
box-sizing: border-box;
display: flex;
line-height: 74rpx;
font-size: 34rpx;
position: relative;
}
.payWay-img {
width: 74rpx;
height: 74rpx;
margin-right: 20rpx;
}
.payWay-icon {
width: 42rpx;
height: 42rpx;
position: absolute;
right: 30rpx;
top: 40rpx;
}
/* 按钮 */
.footer {
width: 100%;
height: 100px;
background-color: #f4f4f6;
position: fixed;
left: 0;
bottom: 0;
z-index: 9;
padding: 20px 20px 50rpx;
box-sizing: border-box;
}
.btn {
line-height: 54px;
background-color: #da2b54;
height: 100%;
text-align: center;
color: #FFFFFF;
border-radius: 10rpx;
}
.btn.active {
background-color: #cacaca;
}
.grey {
background-color: #f9f9f9;
z-index: 99999;
}

View File

@@ -0,0 +1,57 @@
var getNum = 0
Page({
/**
* 页面的初始数据
*/
data: {
loding : true,
success: true
},
/**
* 生命周期函数--查询支付信息
*/
onLoad(e){
if(!e.trade_id){
wx.showToast({
title: '参数错误,请联系系统管理员',
icon : 'none'
})
}
this.getPayState(e.trade_id)
getNum = 0
},
/**
* 查询支付结果
*/
getPayState(trade_id){
wx.$api.pay.payState(trade_id).then(res => {
let { is_paid } = res.data
if(is_paid){
this.setData({
success: true,
loding : false
})
return
}
if(!is_paid && getNum >= 3){
this.setData({
success: false,
loding : false
})
return
}
getNum++
this.getPayState(trade_id)
}).catch(err => {
console.log(err)
})
},
/**
* 返回
*/
onBack(){
wx.navigateBack()
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "支付结果"
}

View File

@@ -0,0 +1,21 @@
<view class="success">
<block wx:if="{{loding}}">
<image class="loding" src="/static/icons/refresh_loding.gif" mode="widthFix"></image>
<view class="text">查询支付结果中...</view>
</block>
<block wx:else>
<image class="icon" wx:if="{{success}}" src="/static/icons/success_icon.png" mode="widthFix"></image>
<image class="icon" wx:else src="/static/icons/fali_icon.png" mode="widthFix"></image>
<view class="title">{{success ? '支付成功' : '支付失败'}}</view>
<view class="text">
<text wx:if="{{success}}">订单支付,可在【我的】中查询订单</text>
<text wx:else>暂未查询到您的订单支付信息
如已扣款请稍后前往【我的】查询订单</text>
</view>
<view class="idcard-btn">
<button size="default" bind:tap="onBack">返回</button>
</view>
</block>
</view>

View File

@@ -0,0 +1,11 @@
.success{ height: 90vh; width: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; }
.loding{ width: 42rpx; height: 42rpx; margin-bottom: 50rpx; }
.icon{ width: 128rpx; height: 128rpx; margin-bottom: 40rpx; }
.title{ font-size: 50rpx; font-weight: bold; line-height: 50rpx; margin-bottom: 30rpx; color: #333; }
.text{ font-size: 30rpx; color: gray; margin-bottom: 100px; text-align: center; line-height: 50rpx; }
.idcard-btn{ padding: 50rpx 60rpx; width: 100vw; box-sizing: border-box; }
.idcard-btn button[size='default']{ background: #da2b54; width: 100%; height: 90rpx; border-radius: 45rpx; color: white; line-height: 90rpx; padding: 0; font-size: 32rpx; }

View File

@@ -0,0 +1,83 @@
Page({
/**
* 页面的初始数据
*/
data: {
order : null,
title : [],
imgs : null,
titleVal: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.refund.refundPreposition(options.id).then(res => {
let { title, order } = res.data;
this.setData({
title,
order,
titleVal: title[0]
})
wx.hideLoading()
})
},
/**
* 选择退货理由
*/
onRadio(e){
this.setData({
titleVal: e.detail.value
})
},
/**
* 选择图片上传
*/
onUpd(){
wx.chooseMedia({
count : 1,
mediaType : ['image'],
success : path => {
wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res => {
this.setData({
imgs: res
})
})
}
})
},
/**
* 提交申请
*/
onSubmit(){
let data = {
title : this.data.titleVal,
pictures : this.data.imgs != null ? this.data.imgs.path : ''
}
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.refund.submitRefund(this.data.order.order_no, data).then(res => {
wx.hideLoading()
wx.showModal({
title : '提示',
content : res.data,
showCancel : false,
confirmColor: '#da2b54',
success : modalRes => {
if(modalRes.confirm){
wx.navigateBack()
}
wx.hideLoading()
}
})
}).catch(err => {})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "申请退货"
}

View File

@@ -0,0 +1,39 @@
<view class="content">
<!-- 服务提醒 -->
<view class="service-content">
<view class="service"> 本次售后服务将由<text> 绚火健康 </text>为您提供服务 </view>
</view>
<!-- 服务产品 -->
<view class="goods">
<view class="goods-item" wx:if="{{order != null}}" wx:for="{{order.items}}" wx:key="index" >
<image src="{{item.sku.cover}}" mode="aspectFill" class="good-img" />
<view class="good-content">
<view class="title">{{item.sku.goods_name}}</view>
<view class="text">金额:{{item.price}}</view>
<view class="text">数量:{{item.qty}}</view>
</view>
</view>
</view>
<!-- 退货理由 -->
<view class="block-title">选择退货理由</view>
<view class="reason">
<radio-group bindchange="onRadio">
<label class="reason-flex" wx:for="{{title}}" wx:key="index">
{{item}} <radio class="reason-radio" value="{{item}}" checked="{{index == 0}}" color="#da2b54"></radio>
</label>
</radio-group>
</view>
<!-- 上传图片 -->
<view class="block-title">退货照片(仅限一张图片)</view>
<view class="imgs">
<view class="imgs-upd" bind:tap="onUpd">
<image class="imgs-cover" src="{{imgs.url}}" mode="aspectFit" wx:if="{{imgs != null}}"></image>
<image class="imgs-add" src="/static/icons/add_gray.png" mode="aspectFill" wx:else></image>
</view>
</view>
<!-- 提交 -->
<view class="button">
<button size="default" bind:tap="onSubmit">提交申请</button>
</view>
</view>

View File

@@ -0,0 +1,34 @@
.content{ background: #f7f8f9; min-height: 100vh; padding: 30rpx; box-sizing: border-box; }
/* 售后服务提醒 */
.service-content { display: flex; flex-direction: row; align-items: center; justify-content: center; }
.service { font-size: 24rpx; padding: 4rpx 20rpx; border-radius: 30rpx; background-color: #f9f9f9; display: inline-block; text-align: center; color: #666; }
.service text{ color: #da2b54; }
/* 商品信息 */
.goods{ background-color: #fff; padding: 10rpx 30rpx; box-sizing: border-box; border-radius: 20rpx; margin-top: 30rpx; }
.goods-item { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; margin: 20rpx 0; }
.good-img{ width: 128rpx; height: 128rpx; border-radius: 10rpx; }
.good-content{ padding-left: 30rpx; box-sizing: border-box; width: calc(100% - 128rpx); }
.good-content > .title{ font-size: 30rpx; line-height: 48rpx; }
.good-content > .text{ font-size: 26rpx; color: gray; line-height: 40rpx; }
/* 退货标题 */
.block-title{ font-size: 30rpx; padding-top: 30rpx; color: gray; }
/* 退货原因 */
.reason{ background: white; border-radius: 20rpx; margin-top: 30rpx; }
.reason-flex{ display: flex; justify-content: space-between; align-items: center; padding: 0 30rpx; height: 120rpx; font-weight: bold; font-size: 30rpx; border-bottom: solid 1rpx #f7f8f9; }
.reason-radio{ transform: scale(.75); }
.reason-flex:last-child{ border-bottom: none; }
/* 上传退货照片 */
.imgs{ background: white; border-radius: 20rpx; margin-top: 30rpx; padding: 20rpx; display: flex; flex-wrap: wrap; }
.imgs-upd{ background: #f7f8f9; width: calc(25% - 20rpx); padding-top: calc(25% - 20rpx); margin: 10rpx; position: relative; }
.imgs-add{ width: 48rpx; height: 48rpx; opacity: .3; position: absolute; left: 50%; top: 50%; margin-top: -24rpx; margin-left: -24rpx; }
.imgs-cover{ position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/* 退货 */
.button{ margin-top: 40rpx; }
.button button[size="default"]{ background: #da2b54; color: white; width: 100%; height: 90rpx; font-size: 32rpx; line-height: 90rpx; padding: 0; border-radius: 45rpx; }

View File

@@ -0,0 +1,76 @@
Page({
/**
* 页面的初始数据
*/
data: {
refund : '',
address : '',
mobile : '',
username: '',
text : ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
refund: options.no
})
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.refund.deliverInit(options.no).then(res => {
let { address, mobile, username } = res.data;
this.setData({
address,
mobile,
username,
text: '收件人:' + username + '\n手机号码'+ mobile + '\n收货地址' + address
})
wx.hideLoading()
})
},
/**
* 复制地址
*/
onCopyAddress(){
wx.setClipboardData({
data: this.data.text
})
},
/**
* 提交退货地址
*/
onSubmit(e){
let { number } = e.detail.value
if(number == ''){
wx.showToast({
title: '请输入快递单号',
icon : 'none',
mask : true
})
return
}
wx.showLoading({
title: '提交中...',
mask : true
})
wx.$api.refund.deliver(this.data.refund, { number }).then(res => {
wx.showModal({
title : '提示',
content : res.data,
showCancel : false,
confirmColor: '#da2b54',
success : modalRes => {
if(modalRes.confirm){
wx.navigateBack()
}
}
})
wx.hideLoading()
}).catch(err => {})
}
})

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