From 0dcf23bfde88f771364d6ffa251472cf61cae092 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=94=90=E6=98=8E=E6=98=8E?= <970899069@qq.com>
Date: Thu, 14 Sep 2023 09:25:37 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=86=E4=BA=AB=E6=9C=8B=E5=8F=8B=E5=9C=88?=
=?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api/interfaces/auth.js | 10 ++-
api/interfaces/idcard.js | 15 ++--
api/request.js | 11 +--
app.json | 3 +-
pages/idcard/idcard.js | 14 ++--
pages/login/index.js | 2 -
pages/login/index.wxml | 4 +-
pages/mall/confirm/confirm.js | 64 ++++++++++------
pages/mall/confirm/confirm.wxml | 18 ++++-
pages/mall/confirm/confirm.wxss | 8 +-
pages/mall/details/details.js | 102 ++++++++++++++++++++-----
pages/mall/details/details.wxml | 4 +-
pages/mall/details/details.wxss | 4 +-
pages/mall/goods/goods.wxml | 2 +-
pages/mall/index.js | 29 +++++--
pages/mall/index.wxml | 7 +-
pages/order/details/details.wxml | 57 +++++++++-----
pages/order/index.wxml | 6 --
pages/order/index.wxss | 3 +
pages/pay/success/success.js | 1 -
pages/refund/aftersale/aftersale.js | 9 ++-
pages/refund/refund.wxml | 11 ++-
pages/refund/refund.wxss | 7 +-
pages/register/index.wxss | 12 +--
pages/resetPassword/resetPassword.wxss | 12 +--
pages/richText/richText.js | 28 +++++++
pages/richText/richText.json | 3 +
pages/richText/richText.wxml | 4 +
pages/richText/richText.wxss | 2 +
pages/site/index.js | 35 +++++----
pages/site/index.wxml | 2 +-
pages/site/index.wxss | 2 +-
pages/user/code/code.js | 76 ++++++++++++------
pages/user/code/code.wxml | 4 +-
pages/user/index.wxml | 5 +-
pages/user/index.wxss | 13 ++++
pages/user/setup/setup.js | 1 -
pages/user/team/index.wxml | 25 ++----
pages/user/team/index.wxss | 31 ++++----
pages/withdraw/withdraw.js | 11 ++-
project.private.config.json | 20 ++++-
static/imgs/capsule.png | Bin 150582 -> 39475 bytes
static/imgs/vip.png | Bin 0 -> 33444 bytes
43 files changed, 458 insertions(+), 219 deletions(-)
create mode 100644 pages/richText/richText.js
create mode 100644 pages/richText/richText.json
create mode 100644 pages/richText/richText.wxml
create mode 100644 pages/richText/richText.wxss
create mode 100644 static/imgs/vip.png
diff --git a/api/interfaces/auth.js b/api/interfaces/auth.js
index cc40c2b..8f1c2a3 100644
--- a/api/interfaces/auth.js
+++ b/api/interfaces/auth.js
@@ -32,9 +32,17 @@ const resetPassword = data => req({
data
})
+/**
+ * 隐私协议
+ */
+const richText = id => req({
+ url: "cms/pages/" + id
+})
+
export default ({
Login,
register,
getSms,
- resetPassword
+ resetPassword,
+ richText
})
\ No newline at end of file
diff --git a/api/interfaces/idcard.js b/api/interfaces/idcard.js
index 31b1925..e60cb4b 100644
--- a/api/interfaces/idcard.js
+++ b/api/interfaces/idcard.js
@@ -14,11 +14,16 @@ const updIdcard = (path, data) => upload({
})
// 提交身份信息
-const ocr = data => req({
- url : "user/certification",
- data,
- method : "POST"
-})
+const ocr = data => {
+
+ console.log(data)
+
+ return req({
+ url : "user/certification",
+ data,
+ method : "POST"
+ })
+}
// 获取认证信息
const getInfo = () => req({
diff --git a/api/request.js b/api/request.js
index 5d7bbfa..baffe03 100644
--- a/api/request.js
+++ b/api/request.js
@@ -6,13 +6,10 @@
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"
}
diff --git a/app.json b/app.json
index 608732b..d5a9a92 100644
--- a/app.json
+++ b/app.json
@@ -37,7 +37,8 @@
"pages/refund/aftersale/aftersale",
"pages/refund/info/info",
"pages/refund/deliver/deliver",
- "pages/refund/logs/logs"
+ "pages/refund/logs/logs",
+ "pages/richText/richText"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/pages/idcard/idcard.js b/pages/idcard/idcard.js
index 3b42b86..89feb0a 100644
--- a/pages/idcard/idcard.js
+++ b/pages/idcard/idcard.js
@@ -76,22 +76,24 @@ Page({
*/
onSubmitIdcard(e){
wx.showLoading({
- title: '提交证件信息...',
- mask : true
+ title: '提交证件信息...'
+ // mask : true
})
let { address } = e.detail.value
wx.$api.idcard.ocr({
- front_card: this.data.front.path,
- back_card : this.data.back.path,
+ front_card : this.data.front != null ? this.data.front.path : '',
+ back_card : this.data.back != null ? this.data.back.path : '',
address
}).then(res => {
- let { name, id_card, created_at, verified, need_sign, address } = res.data
+ 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 : data.is_sign_contract,
+ isSignContract : is_sign_contract,
})
wx.hideLoading()
+ }).catch(err => {
+ console.log(err)
})
},
/**
diff --git a/pages/login/index.js b/pages/login/index.js
index aa39580..917b778 100644
--- a/pages/login/index.js
+++ b/pages/login/index.js
@@ -44,8 +44,6 @@ Page({
password : value.password,
}
wx.$api.auth.Login(data).then(res => {
- // 存储邀请码
- // let { invite, }
// 存储登录信息
wx.setStorage({
key : 'token',
diff --git a/pages/login/index.wxml b/pages/login/index.wxml
index e5f9518..2b74608 100644
--- a/pages/login/index.wxml
+++ b/pages/login/index.wxml
@@ -8,7 +8,7 @@
-
+
忘记密码?
@@ -20,6 +20,6 @@
- 我已阅读并同意《隐私协议》和《服务协议》
+ 我已阅读并同意《隐私协议》和《服务协议》
\ No newline at end of file
diff --git a/pages/mall/confirm/confirm.js b/pages/mall/confirm/confirm.js
index fae8780..f368e3b 100644
--- a/pages/mall/confirm/confirm.js
+++ b/pages/mall/confirm/confirm.js
@@ -9,16 +9,20 @@ Page({
* 页面的初始数据
*/
data: {
- disabled : true,//按钮
+ disabled : true, //按钮
skuId : '',
- goodsQty : '', // 产品数量
- address : '', // 地址
- addressId : '', // 地址id
- goodskData : '', // 数据
- amount : '', // 商品总金额
- total : '', // 支付金额
- freight : '', // 运费
- weight : '', // 重量
+ goodsQty : '', // 产品数量
+ address : '', // 地址
+ goodskData : '', // 数据
+ amount : '', // 商品总金额
+ total : '', // 支付金额
+ freight : '', // 运费
+ weight : '', // 重量
+ distribution : [
+ { type: 0, title: "快递" },
+ { type: 1, title: "自提" },
+ ],
+ distributionIndex: 0
},
/**
@@ -32,30 +36,43 @@ Page({
// 获取商品下单信息
this.placeInfo(options.skuId, options.qty);
},
-
/**
- * 生命周期函数--监听页面显示
+ * 配送方式选择
*/
- onShow() {},
-
+ distributionChange(e){
+ if(e.detail.value === this.data.distributionIndex) return
+ this.setData({
+ distributionIndex: e.detail.value
+ })
+ 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 => {
+ 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 =>{})
},
@@ -70,16 +87,13 @@ Page({
wx.$api.mall.placeTrue({
goods_sku_id : this.data.skuId,
qty : this.data.goodsQty,
- address_id : this.data.addressId
+ address_id : this.data.address.address_id,
+ delivery_type : this.data.distributionIndex
}).then(res => {
-
- console.log(res)
-
wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
})
- }).catch(() =>{}).finally(() => {
wx.hideLoading()
- })
+ }).catch(() =>{}).finally(() => {})
},
})
\ No newline at end of file
diff --git a/pages/mall/confirm/confirm.wxml b/pages/mall/confirm/confirm.wxml
index 2ab300f..25a6305 100644
--- a/pages/mall/confirm/confirm.wxml
+++ b/pages/mall/confirm/confirm.wxml
@@ -1,6 +1,6 @@
-
-
+
+
{{address.province.name}}{{address.city.name}}
@@ -13,7 +13,7 @@
- 新增收货地址 +
+ 新增收货地址 +
@@ -34,9 +34,19 @@
-
+
+ 配送方式
+
+ {{distribution[distributionIndex].title}}
+
+
+
+
+
+
+
快递
{{freight == 0 ? '免邮' : freight + '元'}}
diff --git a/pages/mall/confirm/confirm.wxss b/pages/mall/confirm/confirm.wxss
index 5f5d63a..0a4e307 100644
--- a/pages/mall/confirm/confirm.wxss
+++ b/pages/mall/confirm/confirm.wxss
@@ -10,6 +10,7 @@ page {
border-radius: 15rpx;
overflow: hidden;
position: relative;
+ margin-bottom: 30rpx;
}
.address-arrow {
@@ -77,7 +78,7 @@ page {
.list-goods {
background-color: #FFFFFF;
- margin: 30rpx 0;
+ margin: 0 0 30rpx 0;
display: flex;
padding: 30rpx;
border-radius: 15rpx;
@@ -124,6 +125,7 @@ page {
border-radius: 15rpx;
overflow: hidden;
box-sizing: border-box;
+ margin-bottom: 30rpx;
}
.label-item {
@@ -149,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 {
diff --git a/pages/mall/details/details.js b/pages/mall/details/details.js
index 63a330a..89b91fc 100644
--- a/pages/mall/details/details.js
+++ b/pages/mall/details/details.js
@@ -32,8 +32,8 @@ Page({
onLoad(options) {
this.setData({
goodsId: options.id,
- invite : options.invite || ''
})
+ getApp().globalData.invite = options.invite || ''
},
/**
@@ -44,27 +44,95 @@ 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.showLoading({
title: '加载中...',
mask : true
})
- wx.$api.mall.goodsSee(this.data.goodsId).then(res => {
- this.setData({
- goodsData : res.data,
- mallContent : res.data.content.replace(/\
{}).finally(() => {
- wx.hideLoading()
+ wx.request({
+ url : 'https://api.xhtest.douhuofalv.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(/\
{
+ wx.showToast({
+ title: err.errMsg,
+ icon : 'none'
+ })
+ }
})
+ // wx.$api.mall.goodsSee(this.data.goodsId).then(res => {
+ // this.setData({
+ // goodsData : res.data,
+ // mallContent : res.data.content.replace(/\
{
+ // console.log(err)
+ // }).finally(() => {
+ // wx.hideLoading()
+ // })
},
/**
@@ -185,11 +253,11 @@ Page({
} = this.data.selectSkusValues;
if (stock > 0) {
this.setData({
- skuid: sku_id,
- goodsSize: false
+ skuid : sku_id,
+ goodsSize : false
})
wx.navigateTo({
- url: '/pages/mall/confirm/confirm?skuId=' + sku_id + '&qty=' + this.data.qtyNumber
+ url: '/pages/mall/confirm/confirm?skuId=' + sku_id + '&qty=' + this.data.qtyNumber || 1
})
} else {
uni.showToast({
@@ -270,7 +338,7 @@ Page({
onShareTimeline(){
return{
title : this.data.goodsData.name,
- query : '/pages/mall/details/details?id=' + this.data.goodsId + '&invite=' + this.data.invite,
+ query : 'id=' + this.data.goodsId + '&invite=' + this.data.invite,
imageUrl : this.data.goodsData.cover
}
}
diff --git a/pages/mall/details/details.wxml b/pages/mall/details/details.wxml
index 228da44..87e0843 100644
--- a/pages/mall/details/details.wxml
+++ b/pages/mall/details/details.wxml
@@ -79,7 +79,7 @@
数量
-
-
+
+
@@ -93,6 +93,6 @@
抱歉,商品库存不足了 ~
- 立即购买
+
\ No newline at end of file
diff --git a/pages/mall/details/details.wxss b/pages/mall/details/details.wxss
index 628a8b4..f2ab168 100644
--- a/pages/mall/details/details.wxss
+++ b/pages/mall/details/details.wxss
@@ -404,9 +404,11 @@ button[disabled]{
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;
diff --git a/pages/mall/goods/goods.wxml b/pages/mall/goods/goods.wxml
index 31cae34..ded7815 100644
--- a/pages/mall/goods/goods.wxml
+++ b/pages/mall/goods/goods.wxml
@@ -38,7 +38,7 @@
{{item.description}}
¥{{item.original_price}}
- 月销 {{item.sales}}
+ 浏览 {{item.clicks}}
diff --git a/pages/mall/index.js b/pages/mall/index.js
index 3cea25f..09c4da2 100644
--- a/pages/mall/index.js
+++ b/pages/mall/index.js
@@ -25,11 +25,15 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
- 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
+ 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
+ }
}
},
@@ -170,6 +174,21 @@ Page({
})
},
+ /**
+ * 开通vip
+ */
+ onVip(){
+ if(wx.getStorageSync("token") != ''){
+ wx.navigateTo({
+ url: '/pages/idcard/idcard',
+ })
+ return
+ }
+ wx.navigateTo({
+ url: "/pages/login/index"
+ })
+ },
+
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
diff --git a/pages/mall/index.wxml b/pages/mall/index.wxml
index 6528712..7e00be3 100644
--- a/pages/mall/index.wxml
+++ b/pages/mall/index.wxml
@@ -45,6 +45,11 @@
+
+
+
+
+
@@ -123,7 +128,7 @@
{{item.description}}
¥{{item.original_price}}
- 游览 {{item.clicks}}
+ 浏览 {{item.clicks}}
diff --git a/pages/order/details/details.wxml b/pages/order/details/details.wxml
index 79bd7ea..c21a1ea 100644
--- a/pages/order/details/details.wxml
+++ b/pages/order/details/details.wxml
@@ -10,13 +10,18 @@
-
+
{{ goodsData.express.name }} {{ goodsData.express.mobile }}
-
- {{ goodsData.express.full_address }}
-
+ {{ goodsData.express.full_address }}
+
+
+
+
+
+ 提货地址
+ {{ goodsData.pickup.address }}
@@ -40,45 +45,61 @@
-
订单信息
- 交易时间
+ 下单人
+ {{goodsData.user.name}}
+
+
+ 下单人手机号
+ {{goodsData.user.mobile}}
+
+
+ 下单时间
{{goodsData.created_at}}
- 运费
- {{goodsData.freight == 0 ? '免邮' : goodsData.freight + '元'}}
+ 付款时间
+ {{goodsData.paid_at}}
- 交易状态
- {{goodsData.state}}
+ 配送运费
+ {{goodsData.freight == 0 ? '免邮' : goodsData.freight}}
+
+ 订单金额
+ {{goodsData.amount}}
+
+
+ 实付金额
+ ¥{{goodsData.total}}
+
+
-
物流信息
- 物流名称
- {{goodsData.express.express_name}}
+ 快递公司
+ {{goodsData.express.express_name || '-'}}
- 物流单号
+ 快递单号
- {{goodsData.express.express_no}}复制
+ {{goodsData.express.express_no || '-'}}复制
-
+