绚火健康

This commit is contained in:
2023-08-15 17:18:15 +08:00
commit 32cc588ae7
200 changed files with 8924 additions and 0 deletions

31
.eslintrc.js Normal file
View File

@@ -0,0 +1,31 @@
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/unpackage
/node_modules

1
README.MD Normal file
View File

@@ -0,0 +1 @@
# 水感应用户端小程序

49
api/err.js Normal file
View File

@@ -0,0 +1,49 @@
/**
* 处理错误信息
* @property {Object} errInfo
*/
const errInfo = (obj) =>{
if(obj.status_code == 401){
// 清理客户端登录缓存
// wx.removeStorageSync("")
wx.removeStorage({
key : "token",
success: () => {
wx.navigateTo({
url: "/pages/login/index",
})
}
})
}else if(obj.status_code == 422){
wx.showToast({
title: obj.message,
icon : "none"
})
}else if(obj.status_code == 400 || obj.status_code == 0){
wx.showToast({
title: obj.message,
icon : "none"
})
}else if(obj.status_code == 404){
wx.showToast({
title: "接口地址不存在,请联系系统管理员",
icon : "none"
})
}else if(obj.status_code == 500){
wx.showToast({
title: "服务端:" + obj.message,
icon : "none"
})
}else {
wx.showToast({
title: "code:" + obj.status_code + ", msg:" + obj.message,
icon : "none"
})
}
}
module.exports = {
errInfo
}

35
api/index.js Normal file
View File

@@ -0,0 +1,35 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
// 授权登录
import auth from "./interfaces/auth"
// 图片上传
import bank from "./interfaces/bank"
// 图片上传
import file from "./interfaces/file"
// 产品
import mall from "./interfaces/mall"
// 订单
import order from "./interfaces/order"
// 地址管理
import site from "./interfaces/site"
// 个人中心
import user from "./interfaces/user"
export default {
auth,
bank,
file,
mall,
order,
site,
user
}

32
api/interfaces/auth.js Normal file
View File

@@ -0,0 +1,32 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
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
})
export default ({
Login,
register,
getSms
})

74
api/interfaces/bank.js Normal file
View File

@@ -0,0 +1,74 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
//我的提现
const Index = data => req({
url: "withdraws/index",
data: data
})
//我的提现
const Indexcreate = data => req({
url: "withdraws/index/create",
data: data
})
//提现-提交
const Indexpost = data => req({
url: "withdraws/index",
method: "POST",
data: data
})
//我的银行账户
const Cards = data => req({
url: "withdraws/accounts",
data: data
})
//添加账户前置
const Creates = () => req({
url: "withdraws/accounts/create"
})
//添加账户
const cardBind = data => req({
url: "withdraws/accounts",
method: "POST",
data: data
})
//编辑前置
const cardEdit = (bank_account_id, data) => req({
url: "withdraws/accounts/" + bank_account_id + "/edit",
data: data
})
//编辑-提交
const Confirm = (bank_account_id, data) => req({
url: "withdraws/accounts/" + bank_account_id,
method: "PUT",
data: data
})
//删除
const cardsDel = (bank_account_id) => req({
url: "withdraws/accounts/" + bank_account_id,
method: "DELETE"
})
export default ({
Index,
Indexcreate,
Indexpost,
Cards,
Creates,
cardBind,
cardEdit,
Confirm,
cardsDel,
})

17
api/interfaces/file.js Normal file
View File

@@ -0,0 +1,17 @@
/*
* 图图片上传公用接口
*/
import { upload } from "../request"
//图上传
const uploadImg = (imgPaht, data) => upload({
url: "storage/upload",
method: "POST",
key: "upload",
path: imgPaht,
data: data
})
export default ({
uploadImg
})

62
api/interfaces/mall.js Normal file
View File

@@ -0,0 +1,62 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
//Banner图
const Banner = () => req({
url: "mall/banners"
})
//商品分类
const Categorie = data => req({
url: "mall/categories",
data: data
})
//商品列表
const Goods = data => req({
url: "mall/goods",
data: data
})
//商品详情
const goodsSee = (goods) => req({
url: "mall/goods/" + goods
})
//商品下单
const place = data => req({
url: "mall/buy/goods",
data: data
})
//商品确认下单
const placeTrue = data => req({
url: "mall/buy/goods",
method: "POST",
data: data
})
//公告列表
const articles = () => req({
url: "cms/articles"
})
//公告详情
const articlesSee = (article_id) => req({
url: "cms/articles/" + article_id
})
export default ({
Banner,
Categorie,
Goods,
goodsSee,
place,
placeTrue,
articles,
articlesSee
})

51
api/interfaces/order.js Normal file
View File

@@ -0,0 +1,51 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
// 订单首页
const list = data => req({
url : "mall/orders",
data: data
})
// 订单详情
const goodsDet = (order) => req({
url : "mall/orders/" + order
})
// 订单取消
const goodsCancel = (order) => req({
url : "mall/orders/" + order + "/cancel",
method: "PUT"
})
// 订单删除
const goodsDel = (order) => req({
url : "mall/orders/" + order,
method: "DELETE"
})
// 订单签收
const goodsSign = (order) => req({
url : "mall/orders/" + order + "/sign",
method: "PUT"
})
// 快递100-免费
const kuaiDi = (order, data) => req({
url : "mall/orders/" + order + "/logistic",
data: data
})
export default ({
list,
goodsDet,
goodsCancel,
goodsDel,
goodsSign,
kuaiDi
})

58
api/interfaces/site.js Normal file
View File

@@ -0,0 +1,58 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
// 收获地址(列表)
const siteList = () => req({
url: "mall/addresses"
})
// 省市区-获取
const create = data => req({
url: "mall/addresses/create",
data: data
})
// 新增地址
const siteAdd = data => req({
url: "mall/addresses",
data: data,
method: 'POST'
})
// 地址详细
const siteSee = (address) => req({
url: "mall/addresses/" + address
})
// 编辑地址
const siteEdit = (address, data) => req({
url: "mall/addresses/" + address,
data: data,
method: 'PUT'
})
// 删除地址
const siteDel = (address) => req({
url: "mall/addresses/" + address,
method: 'DELETE'
})
// 设置默认地址
const siteDefault = (address) => req({
url: "mall/addresses/" + address + "/default",
method: 'POST'
})
export default ({
siteList,
create,
siteAdd,
siteSee,
siteEdit,
siteDel,
siteDefault
})

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

@@ -0,0 +1,48 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import { req } from "../request"
//用户信息
const userIndex = () => req({
url: "user"
})
// 用户设置
const userSetup = () => req({
url: "user/setting"
})
//修改用户信息
const setting = (key, data) => req({
url: "user/setting/" + key,
method: "PUT",
data: data
})
//我的余额首页
const account = () => req({
url: "user/account/index"
})
// 小程序码
const miniShare = data => req({
url: "user/mini_share",
data: data
})
// 我的团队
const teamList = data => req({
url: "user/teams/lists",
data: data
})
export default ({
userIndex,
userSetup,
setting,
account,
miniShare,
teamList
})

140
api/request.js Normal file
View File

@@ -0,0 +1,140 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
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 header = {
"Accept" : "application/json"
}
let isToken = true
/**
* 请求
* @property {Object} req
*/
const req = (obj, noToken) => {
// 检查是否无需要token
if(noToken != undefined){
isToken = noToken
}
// header
if(obj.token){
header.Authorization = obj.token || ''
} else {
header.Authorization = wx.getStorageSync("token") || ""
}
// 处理请求信息
return new Promise((resolve, reject) => {
// 组合header
obj.header = {
"Accept" : "application/json",
"channel" : "client",
"Authorization" : wx.getStorageSync("token") || ""
}
if(!isToken){
obj.header.Authorization = ''
}
wx.request({
timeout: '13000',
url : api + obj.url,
header : obj.header || {},
method : obj.method || 'GET',
data : obj.data || {},
success : res => {
// 更新token
if (res.header.Authorization) updToken(res.header.Authorization)
// 处理信息
if (res.data.status_code == 200) {
resolve(res.data)
} else {
if (res.data.status_code == 401 || res.data.status_code == 400) {
reject({
login : false,
codeBeen: false
})
}
reject(res)
errInfo(res.data)
}
},
fail: err => {
wx.showToast({
title : (err.errMsg).indexOf('108') > 0 ? "网络错误,请检查您的网络环境" : err.errMsg,
icon : "none"
})
reject(err)
},
complete(){
if(!isToken) isToken = true
}
})
})
}
/**
* 上传
* @property {Object} upload
*/
const upload = (obj) => {
// header
header.Authorization = wx.getStorageSync("token") || ""
// 处理上传信息
return new Promise((resolve, reject) => {
wx.showLoading({
title: "上传中..",
mask: true
})
wx.uploadFile({
url : api + obj.url,
header : header,
name : obj.key || "",
filePath: obj.path || "",
formData: obj.data || {},
success : res=>{
wx.hideLoading();
// 处理返回值
let jsonData = JSON.parse(res.data)
// 更新token
if (res.header.Authorization) updToken(res.header.Authorization)
// 处理信息
if (jsonData.status_code == 200) {
resolve(jsonData.data)
} else {
if (jsonData.status_code == 401) {
reject({
login: false
})
}
errInfo(jsonData)
}
},
fail : err=>{
wx.showToast({
title : err.errMsg,
icon : "none"
})
reject(err)
}
})
})
}
module.exports = {
req,
upload
}

21
api/updateToken.js Normal file
View File

@@ -0,0 +1,21 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
/**
* 更新token
* @property {String} updToken
*/
const updToken = (token) =>{
// 更新全局存储器
getApp().globalData.token = token
// 更新客户端登录缓存
wx.setStorageSync('token', token)
}
module.exports = {
updToken
}

53
app.js Normal file
View File

@@ -0,0 +1,53 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
import api from "api/index"
App({
onLaunch(e) {
// 检查用户登录状态
const token = wx.getStorageSync("token")
if(token){
this.globalData.isUser = true
}
// 检查系统更新
const updateManager = wx.getUpdateManager()
updateManager.onUpdateReady(function () {
wx.showModal({
title : '更新提示',
content : '新版本已经准备好,是否重启应用?',
cancelColor: '#666',
confirmColor: '#e50d01',
success : res=> {
if (res.confirm) {
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function(){
wx.showModal({
title : '更新提示',
content : '版本更新下载失败,请检查您的网络稍后重试',
showCancel: false,
confirmColor: '#e50d01'
})
})
// 获取系统信息
wx.getSystemInfo({
success: res=>{
this.globalData.barHeight = res.statusBarHeight
}
})
// 挂载api
wx.$api = api
},
globalData: {
isUser : false,
barHeight : ''
}
})

62
app.json Normal file
View File

@@ -0,0 +1,62 @@
{
"pages": [
"pages/mall/index",
"pages/classify/index",
"pages/face/index",
"pages/user/index",
"pages/login/index",
"pages/register/index",
"pages/mall/details/details",
"pages/mall/confirm/confirm",
"pages/pay/index",
"pages/site/index",
"pages/site/add/add",
"pages/site/edit/edit",
"pages/user/setup/setup",
"pages/user/about/about",
"pages/mall/goods/goods",
"pages/order/index",
"pages/order/details/details",
"pages/order/logistic/logistic",
"pages/search/search",
"pages/mall/article/article",
"pages/account/index",
"pages/user/team/index",
"pages/user/code/code",
"pages/bankCard/index",
"pages/bankCard/bankAdd/bankAdd"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "绚火健康",
"navigationBarTextStyle": "black"
},
"tabBar": {
"list": [
{
"pagePath": "pages/mall/index",
"text": "商城",
"iconPath": "/static/tabBarIcon/tabBar_00.png",
"selectedIconPath": "/static/tabBarIcon/tabBar_selected_00.png"
},
{
"pagePath": "pages/classify/index",
"text": "分类",
"iconPath": "/static/tabBarIcon/tabBar_01.png",
"selectedIconPath": "/static/tabBarIcon/tabBar_selected_01.png"
},
{
"pagePath": "pages/user/index",
"text": "我的",
"iconPath": "/static/tabBarIcon/tabBar_03.png",
"selectedIconPath": "/static/tabBarIcon/tabBar_selected_03.png"
}
],
"color": "#999999",
"selectedColor": "#da2b54",
"borderStyle": "white"
},
"style": "v2",
"sitemapLocation": "sitemap.json"
}

70
app.wxss Normal file
View File

@@ -0,0 +1,70 @@
page {
font-size: 30rpx;
}
/*
* 文字截取
*/
.nowrap {
max-width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.nowrap-multi {
display: -webkit-box;
overflow: hidden;
text-overflow: ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
/*
* 上拉加载
*/
.pagesLoding{
width: 100%;
text-align: center;
color: gray;
line-height: 90rpx;
font-size: 28rpx;
}
.pagesLoding-icon{
width: 32rpx;
height: 32rpx;
vertical-align: middle;
margin-right: 10rpx;
margin-bottom: 6rpx;
}
.pages-hint {
width: 100%;
text-align: center;
color: #747788;
font-size: 28rpx;
background: white;
}
.pages-hint image {
width: 220rpx;
height: 220rpx;
}
/*
* 水平居中
*/
.pack-center {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: -1;
}

78
pages/account/index.js Normal file
View File

@@ -0,0 +1,78 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
logsArr : [], //列表数据
score : '', //数据
page : {}, //分页信息
lodingStats : false, //加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取账户信息
this.accountInfo()
},
/**
* 获取账户信息
*/
accountInfo(page) {
wx.$api.user.account({
page: page
}).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)
this.setData({
score : res.data,
logsArr : newData,
page : res.data.logs.page,
lodingStats : false
})
wx.stopPullDownRefresh()
}).catch(err => { })
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取账户信息
this.accountInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取账户信息
this.accountInfo(pageNumber);
}
}
})

6
pages/account/index.json Normal file
View File

@@ -0,0 +1,6 @@
{
"usingComponents": {},
"navigationBarBackgroundColor": "#dc3159",
"navigationBarTextStyle": "white",
"navigationBarTitleText": "我的账户"
}

54
pages/account/index.wxml Normal file
View File

@@ -0,0 +1,54 @@
<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>
<view class="topBtn" wx:if="{{score.can_withdraw}}">提现</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>
</view>
<view class="detailed active">
<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>
</view>
<view class="pagesLoding" wx:if="{{lodingStats}}">
<block wx:if="{{page.has_more}}">
<image class="pagesLoding-icon" src="/static/icon/refresh_loding.gif" mode="widthFix"></image>加载中...
</block>
<block wx:else>
没有更多了~
</block>
</view>
</view>
<view class="pages-no" wx:else>
<image src="/static/imgs/cont_null.png" mode="widthFix"></image>
<view>暂无数据</view>
</view>
</view>

126
pages/account/index.wxss Normal file
View File

@@ -0,0 +1,126 @@
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;
}
.topSee {
flex: 1;
}
.topSee-name {
display: flex;
line-height: 40rpx;
}
.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;
}
/* 暂无数据 */
.pages-no {
background-color: #fff;
margin-top: 30rpx;
text-align: center;
padding: 120rpx 0;
color: #6d6d6d;
font-size: 28rpx;
}
.pages-no image {
width: 180rpx;
}

View File

@@ -0,0 +1,115 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
bankId : '', // 银行id
type : '', // 类型
bankData : '', // 银行卡编辑
bankArr : [], // 银行列表
bankIndex : 0, // 银行列表 index
disabled : false// 提交按钮
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
type : options.type,
bankId: options.id
})
if(options.type == 'Compile') {
// 获取银行编辑信息
this.bankEdit();
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取银行列表
this.bankInfo();
},
/**
* 银行编辑信息
*/
bankEdit() {
wx.$api.bank.cardEdit(this.data.bankId).then(res => {
let bankValue = res.data.banks.findIndex(val=> val.id == res.data.info.bank.id)
this.setData({
bankData : res.data.info,
bankIndex: bankValue
})
}).catch(err => { })
},
/**
* 银行机构列表
*/
bankInfo() {
wx.$api.bank.Creates().then(res => {
this.setData({
bankArr: res.data.banks
})
}).catch(err => { })
},
/**
* 选择银行index
*/
bankChange(e) {
this.setData({
bankIndex: e.detail.value
})
},
/**
* 表单提交
*/
siteform(val) {
let value = val.detail.value
console.log(value)
let data = {
name : value.name,
mobile : value.mobile,
no : value.no,
branch_name : value.branch_name,
bank_id : this.data.bankArr[this.data.bankIndex].id
}
this.setData({
disabled: true
})
// 入口为编辑
if(this.data.type == 'Compile') {
wx.$api.bank.Confirm(this.data.bankId, data).then(res => {
wx.navigateBack()
}).catch(() =>{
this.setData({
disabled: false
})
})
return
}
// 新增
wx.$api.bank.cardBind(data).then(res => {
wx.navigateBack()
}).catch(() =>{
this.setData({
disabled: false
})
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "绑定银行卡"
}

View File

@@ -0,0 +1,34 @@
<!-- 添加地址 -->
<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 File

@@ -0,0 +1,137 @@
.site-form {
margin: 20rpx;
display: block;
overflow: hidden;
}
.site-btn {
margin: 40rpx 0;
}
.site-input {
padding: 0 30rpx 0 280rpx;
position: relative;
line-height: 100rpx;
min-height: 100rpx;
}
.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;
}

100
pages/bankCard/index.js Normal file
View File

@@ -0,0 +1,100 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
bankArr : [], //列表数据
page : {}, //分页信息
lodingStats : false, //加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取银行卡列表
this.bankInfo();
},
/**
* 银行卡列表
*/
bankInfo (page) {
wx.$api.bank.Cards({
page: page
}).then(res=>{
let listArr = this.data.bankArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
bankArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取银行卡列表
this.bankInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取银行卡列表
this.bankInfo(pageNumber);
}
},
/**
* 删除地址
*/
bankRemove(e){
let id = e.target.dataset.id,
index = e.target.dataset.index,
list = this.data.bankArr
list.splice(index,1)
wx.showModal({
title : '提示',
content : '是否删除银行卡',
success : res=> {
if (res.confirm) {
wx.showLoading({
title: '删除中',
})
wx.$api.bank.cardsDel(id).then(res=>{
this.setData({
bankArr: list
})
wx.hideLoading()
})
}
}
})
},
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "银行账户"
}

41
pages/bankCard/index.wxml Normal file
View File

@@ -0,0 +1,41 @@
<view class="address" wx:if="{{bankArr.length > 0}}">
<view class="address-li" wx:for="{{bankArr}}" wx:key="bankArr" wx:for-index="index">
<view class="top">
<image class="top-logo" src="{{item.bank.cover}}" mode="aspectFill"></image>
<view class="top-name">{{item.bank.name}}</view>
</view>
<view class="cont">
<view class="address-title">
<text>支行名称</text>{{item.branch_name}}
</view>
<view class="address-title">
<text>银行卡号</text>{{item.no}}
</view>
<view class="address-title">
<text>收款人姓名</text>{{item.name}}
</view>
<view class="address-title">
<text>收款人手机号</text>{{item.mobile}}
</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>
</view>
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="/static/imgs/cont_null.png" mode="widthFix"></image>
<view>还未添加银行卡</view>
</view>
<!-- 添加按钮 -->
<view class="address-footer">
<navigator url="/pages/bankCard/bankAdd/bankAdd?type=Add">添加银行卡</navigator>
</view>

166
pages/bankCard/index.wxss Normal file
View File

@@ -0,0 +1,166 @@
page {
background: #f5f5f5;
}
.address {
border-bottom: 120rpx solid transparent;
margin: 20rpx;
}
.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 image {
width: 32rpx;
height: 32rpx;
margin: 2rpx 10rpx 0 0;
}
.address-tool-btn {
height: 46rpx;
line-height: 44rpx;
border-radius: 6rpx;
}
.address-tool-btn.active{
color: #f57e32;
}
.address-tool.active::after {
display: none;
}
.address-tool-btn.yellow {
color: #f57e32;
}
.address-tool-btn image {
width: 34rpx;
height: 34rpx;
margin-right: 10rpx;
vertical-align: -6rpx;
}
.address-tool.active {
padding-top: 0;
}
.address-icon {
float: right;
}
/* footer */
.address-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding-left: 30rpx;
padding-right: 30rpx;
background: white;
z-index: 9;
height: 120rpx;
}
.address-footer navigator {
width: 100%;
line-height: 90rpx;
height: 90rpx;
margin: 15rpx 0;
text-align: center;
background: #e92152;
font-size: 30rpx;
color: white;
border-radius: 10rpx
}

53
pages/classify/index.js Normal file
View File

@@ -0,0 +1,53 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
parentId : '',
categorieArr : [],
categorieindex : 0
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取商品分类
this.categorieInfo();
},
/**
* 商品分类信息
*/
categorieInfo() {
wx.$api.mall.Categorie({
parent_id: this.data.parentId
}).then(res => {
this.setData({
categorieArr: res.data
})
}).catch(err =>{
})
},
// 一级分类
categorieTap(e) {
this.setData({
categorieindex: e.currentTarget.dataset.index
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "全部分类"
}

23
pages/classify/index.wxml Normal file
View File

@@ -0,0 +1,23 @@
<!-- search -->
<view class="search">
<navigator class="mall-search" url="/pages/search/search" hover-class="none">
<image class="mall-search-icon" src="/static/icons/search.png" mode="widthFix"></image>搜索商品
</navigator>
</view>
<!-- 内容 -->
<scroll-view class="stair-nav" scroll-y>
<view class="stair-nav-li {{ item.category_id == categorieArr[categorieindex].category_id ? 'active' : ''}}" wx:for="{{categorieArr}}" wx:key="categorieArr" bindtap="categorieTap" data-index="{{index}}">{{item.name}}</view>
</scroll-view>
<scroll-view class="level-content" scroll-y>
<view class="levelList-title">{{categorieArr[categorieindex].name}}</view>
<view class="level-nav" wx:if="{{categorieArr[categorieindex].children.length > 0}}">
<navigator hover-class="none" url="/pages/mall/goods/goods?id={{categorieArr[categorieindex].category_id}}" class="level-nav-li" wx:for="{{categorieArr[categorieindex].children}}" wx:key="children" wx:for-item="items">
<view class="level-nav-cover"><image src="{{items.cover}}" mode="aspectFill"></image></view>
<view class="level-nav-title">{{items.name}}</view>
</navigator>
</view>
<view class="level-tips" wx:else>
暂无产品
</view>
</scroll-view>

138
pages/classify/index.wxss Normal file
View File

@@ -0,0 +1,138 @@
/* 搜索 */
.search {
height: 110rpx;
position: fixed;
left: 0;
top: 0;
width: 100%;
z-index: 999;
padding: 10rpx 30rpx 0;
box-sizing: border-box;
background: white;
}
.mall-search {
background: #f7f7f7;
height: 90rpx;
line-height: 90rpx;
padding: 0 30rpx;
box-sizing: border-box;
width: 100%;
border-radius: 80rpx;
color: #b8b7bc;
display: flex;
}
.mall-search-icon {
width: 38rpx;
height: 38rpx;
margin: 26rpx 20rpx 0 0;
}
/* 一级分类 */
.stair-nav {
position: fixed;
top: 110rpx;
left: 0;
background: #fcfafb;
height: calc(100vh - 100rpx);
width: 160rpx;
text-align: center;
z-index: 9;
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
.stair-nav-li {
line-height: 110rpx;
border-top: solid 1rpx #ffffff;
}
.stair-nav-li.active {
background: white;
color: #e92344;
font-weight: bold;
position: relative;
}
.stair-nav-li.active::before {
position: absolute;
content: "";
left: 0;
top: 30rpx;
height: 40rpx;
background: #e92344;
width: 6rpx;
}
/* 二级分类 */
.level-content{
position: fixed;
top: 0;
left: 0;
padding: 110rpx 0 0 170rpx;
box-sizing: border-box;
width: 100%;
height: 100vh;
background: white;
}
.levelList-title {
font-size: 26rpx;
color: #2c2c2c;
font-weight: 600;
line-height: 110rpx;
padding: 0 25rpx;
box-sizing: border-box;
}
.level-nav{
display: flex;
flex-wrap:wrap;
}
.level-nav-li{
width: 33.333%;
text-align: center;
padding: 0 20rpx;
box-sizing: border-box;
margin-bottom: 30rpx;
}
.level-nav-cover{
width: 100%;
padding-top: 100%;
position: relative;
border-radius: 10rpx;
overflow: hidden;
background-color: #fcfafb;
}
.level-nav-cover image {
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
.level-nav-title{
font-size: 26rpx;
margin-top: 15rpx;
color: #464854;
}
.level-tips {
text-align: center;
width: 100%;
padding: 80rpx 0;
color: #a3a3a3;
}

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

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

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

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

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

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

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

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

68
pages/login/index.js Normal file
View File

@@ -0,0 +1,68 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
checked : false, // 勾选协议
phone : "", // 手机号
password : "", // 密码
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 勾选协议
*/
radioChange() {
this.setData({
checked: !this.data.checked
})
},
/**
* 立即登录
*/
registerForm(e) {
if(this.data.checked) {
let value = e.detail.value
let data = {
username : value.username,
password : value.password,
}
wx.$api.auth.Login(data).then(res => {
// 存储登录信息
wx.setStorage({
key : 'token',
data : res.data.token_type + ' ' + res.data.access_token,
success: () =>{
// 回到上一页
wx.navigateBack()
}
})
}).catch(() =>{
this.setData({
disabled: false
})
})
return
}
wx.showToast({
title: '请勾选用户隐私和服务协议',
icon: "none"
})
}
})

5
pages/login/index.json Normal file
View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#f7f6fa"
}

25
pages/login/index.wxml Normal file
View File

@@ -0,0 +1,25 @@
<image class="loginImg" src="/static/imgs/loginImg.png" mode="widthFix"></image>
<view class="loginTitle">
<image class="loginImg" src="/static/imgs/loginTitle.png" mode="widthFix"></image>
</view>
<form bindsubmit="registerForm" class="site-form">
<!-- 输入手机号相关 -->
<view class="inputs">
<input type="number" placeholder="请输入账号" maxlength="11" name="username" />
</view>
<view class="inputs">
<input type="text" placeholder="请输入密码" name="password" />
</view>
<view class="forget"><navigator hover-class="none">忘记密码?</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>
</form>
<!-- 用户登录注册协议 -->
<view class="agreement">
<checkbox-group bindchange="radioChange">
<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>
</view>
</view>

127
pages/login/index.wxss Normal file
View File

@@ -0,0 +1,127 @@
page {
background-color: #f7f6fa;
}
.loginImg {
width: 100%;
}
.loginTitle {
width: 100%;
text-align: center;
padding: 0 50rpx;
box-sizing: border-box;
margin-top: -50rpx;
}
.site-form {
display: block;
padding: 50rpx 50rpx 40rpx;
box-sizing: border-box;
}
.inputs {
background: #edebf1;
border: none;
position: relative;
margin-bottom: 40rpx;
height: 100rpx;
line-height: 100rpx;
border-radius: 80rpx;
padding: 0 50rpx;
box-sizing: border-box;
display: flex;
position: relative;
}
.inputs input {
width: 100%;
height: 100rpx;
line-height: 100rpx;
border: none;
font-size: 32rpx;
}
.inputs-see {
position: absolute;
right: 50rpx;
top: 32rpx;
width: 38rpx;
height: 38rpx;
z-index: 9;
}
.sms-btn[size='mini'] {
font-weight: normal;
height: 100rpx;
line-height: 100rpx;
position: absolute;
top: 0;
right: 30rpx;
margin: 0;
border-radius: 0;
border-left: solid 1rpx #f2f2f2;
color: #da2b54 !important;
font-size: 32rpx;
background-color: transparent !important;
z-index: 9;
}
.forget {
text-align: right;
margin-bottom: 40rpx;
color: #da2b54;
}
.registerGo {
text-align: center;
margin-top: 30rpx;
color: #da2b54;
}
.btn {
background: #da2b54 !important;
width: 100% !important;
color: white !important;
border-radius: 100rpx;
font-size: 32rpx;
line-height: 100rpx;
height: 100rpx;
font-weight: bold;
padding: 0;
font-weight: normal;
}
.btn::after {
border: none;
}
.btn[disabled] {
background: #da2b54 !important;
}
/* 协议 */
.agreement {
padding: 0 60rpx 40rpx;
box-sizing: border-box;
font-size: 26rpx;
color: #9d9d9d;
display: flex;
}
.radioGroup {
transform: scale(.6);
width: 55rpx;
text-align: left;
}
.agreement-text {
width: calc(100% - 55rpx);
line-height: 48rpx;
}
.agreement-text navigator {
color: #000;
display: inline-block;
}

View File

@@ -0,0 +1,50 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
articleId : '', //文章id
indexShow : '', //内容
mallContent : '', //简介
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
articleId : options.id
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取详情数据
this.indexInfo();
},
/**
* 详情数据
*/
indexInfo () {
wx.$api.mall.articlesSee(this.data.articleId).then(res => {
console.log(res)
this.setData({
indexShow : res.data,
favoritesSee : res.data.isFavorite,
subscribesSee : res.data.isSubscribed,
favoritesNumber : res.data.favorites,
subscribesNumber: res.data.subscribes,
mallContent : res.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block;"')
})
}).catch(err => {})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "公告详情"
}

View File

@@ -0,0 +1,18 @@
<image class="articleImg" src="{{indexShow.cover ? indexShow.cover : 'https://cdn.douhuofalv.com/images/2023/08/10/b87a04a676b1f262758d5baec0571789.png'}}" mode="widthFix"></image>
<view class="articleCont">
<view class="articleTop">
<view class="articleName">
<text>水感应 </text> | {{indexShow.title}}
</view>
<view class="articleTool">
<text>{{indexShow.created_at}}</text>
<text>浏览 {{indexShow.clicks}}</text>
</view>
</view>
<view class="articleBanner">
<image mode="widthFix" src="https://cdn.douhuofalv.com/images/2023/08/10/59f5d6caf2d0766ac3d467d1e94769a9.png"></image>
</view>
<view class="articleText">
<rich-text nodes="{{mallContent}}"></rich-text>
</view>
</view>

View File

@@ -0,0 +1,43 @@
page {
background-color: #ffffff;
}
.articleImg {
width: 100%;
display: inline-block;
}
.articleCont {
padding: 30rpx;
box-sizing: border-box;
border-bottom: 160rpx transparent solid;
}
.articleName {
font-size: 36rpx;
margin-top: 20rpx;
}
.articleName text {
text-transform: uppercase;
}
.articleTool {
color: #666666;
font-size: 26rpx;
margin-top: 15rpx;
}
.articleTool text {
padding-right: 30rpx;
font-weight: 200;
}
.articleBanner {
text-align: center;
margin: 60rpx 0;
}
.articleBanner image {
width: 100%;
}

View File

@@ -0,0 +1,82 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
disabled : true,//按钮
skuId : '',
goodsQty : '', // 产品数量
address : '', // 地址
addressId : '', // 地址id
goodskData : '', // 数据
amount : '', // 总金额
freight : '', // 运费
weight : '', // 重量
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
goodsQty: options.qty,
skuId : options.skuId
})
// 获取商品下单信息
this.placeInfo(options.skuId, options.qty);
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 商品下单信息
*/
placeInfo(skuid, qty) {
wx.$api.mall.place({
goods_sku_id:skuid,
qty: qty,
address_id: this.data.addressId
}).then(res => {
console.log(res)
this.setData({
address : res.data.address,
addressId : res.data.address.address_id,
goodskData: res.data.detail,
amount : res.data.amount,
freight : res.data.freight,
weight : res.data.weight
})
}).catch(err =>{})
},
/**
* 商品确认下单
*/
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
})
wx.redirectTo({
url: '/pages/pay/index?params=' + encodeURIComponent(JSON.stringify(res.data))
})
}).catch(err =>{
this.setData({
disabled: false
})
})
},
})

View File

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

View File

@@ -0,0 +1,66 @@
<!-- 地址 -->
<view class="address">
<navigator hover-class="none" url="/pages/site/index?type=goodsAddress" 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" class="address-go">新增收货地址 +</navigator>
</view>
<image class="address-img" src="/static/imgs/address.png" mode="widthFix"></image>
</view>
<!-- 商品 -->
<view class="list-goods" wx:for="{{goodskData}}" wx:key="stockData">
<block 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>
</block>
</view>
<!-- 规格 -->
<view class="label">
<view class="label-item">
<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 class="footer">
<view class="number">
<view class="number-vip">合计:</view>
<text>¥</text>
<view class="number-price">{{amount}}</view>
</view>
<view class="btn" bindtap="buyTap" wx:if="{{disabled}}">立即支付</view>
<view class="btn active" wx:else>立即支付</view>
</view>
<!-- <view class="pack-center pages-hint grey" wx:if="{{paySuccess}}">
<image src="/static/icons/loadingGif.gif"></image>
<view>疯狂加载中...</view>
</view> -->

View File

@@ -0,0 +1,289 @@
page {
background-color: #f5f6f8;
padding: 30rpx;
box-sizing: border-box;
}
/* 地址 */
.address {
background-color: #FFFFFF;
border-radius: 15rpx;
overflow: hidden;
position: relative;
}
.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%;
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;
}
/* 商品 */
.list-goods {
background-color: #FFFFFF;
margin: 30rpx 0;
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;
}
.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;
}
/*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

@@ -0,0 +1,249 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
isFixedTop : 0,
barHeight : getApp().globalData.barHeight, // 状态栏高度
goodsId : '', // 商品id
goodsData : '', // 商品数据
mallContent : '', // 商品详情
skus : [], // 显示的规格-提交
skuid : '',
specselect : '', // 确认购买的规格
selectSkusValues: '', // 默认选项
valueId : '', // 选中规格id
valueIndex : '', // 选中规格下标index
specselectIndex : '',
qtyNumber : 1, // 产品数量
goodsSize : false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
goodsId: options.id
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取商品详情
this.goodsInfo();
},
/**
* 商品详情
*/
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 =>{})
},
/**
* 选规格
*/
selectSize(e) {
this.setData({
qtyNumber: 1
})
let valueid = e.currentTarget.dataset.valueid,
index = e.currentTarget.dataset.index
var temp1 = 'specselect['+index+']'
this.setData({
[temp1]: valueid
})
let newlist = []
let str = ''
for (var i in this.data.specselect) {
if (i == index) {
newlist.push(valueid);
if (i == 0) {
str = valueid
} else {
str = str + '|' + valueid
}
} else {
newlist.push(this.data.specselect[i])
if (i == 0) {
str = this.data.specselect[i]
} else {
str = str + '|' + this.data.specselect[i]
}
}
}
for (var i in this.data.skus) {
if (this.data.skus[i].unit == str) {
this.setData({
selectSkusValues: this.data.skus[i]
})
break;
}
}
this.setData({
specselect: newlist
})
},
/**
* 产品数量加减
*/
goodsNumber(e){
let num = this.data.qtyNumber,
val = e.currentTarget.dataset.type,
stock = this.data.selectSkusValues.stock
if (val == 'plus'){
num ++;
if(num > stock) {
wx.showToast({
title : '商品数量不能大于库存量',
icon : 'none'
})
this.setData({
qtyNumber: stock
})
} else {
this.setData({
qtyNumber: num
})
}
}else{
if (num > 1){
num --;
if(num < this.data.qtyNumber) {
this.setData({
qtyNumber: num
})
}
}else{
wx.showToast({
title : '商品数量不能小于1',
icon : 'none'
})
}
this.setData({
qtyNumber: num
})
}
},
/**
* 规格弹出
*/
buyPop() {
this.setData({
goodsSize: !this.data.goodsSize
})
},
/**
* 规格关闭
*/
closeTap() {
this.setData({
goodsSize: false
})
},
/**
* 确认购买
*/
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
})
}
}else{
// 去登录
wx.navigateTo({
url: "/pages/login/index"
})
}
},
/**
* 监听页面滑动事件
*/
onPageScroll(e) {
this.setData({
isFixedTop: parseInt(e.scrollTop)
});
},
/**
* 返回上一页
*/
returnGo() {
wx.navigateBack({
delta: 1,
fail: () => {
wx.switchTab({
url: '/pages/mall/index?invite=' + getApp().globalData.inviteText
})
}
})
},
/**
* 回到首页
*/
returnHome() {
wx.switchTab({
url: '/pages/mall/index?invite=' + getApp().globalData.inviteText
})
},
/**
* 放大轮播相册图片
*/
opneBanner(e){
let imgs = [],
index = e.currentTarget.dataset.index
for (let img of e.currentTarget.dataset.imgs){
imgs.push(img)
}
wx.previewImage({
urls : imgs,
current : imgs[index]
})
}
})

View File

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

View File

@@ -0,0 +1,99 @@
<view class="navigation {{isFixedTop > 0 ? 'active' : ''}}" style="padding-top:{{barHeight}}px;">
<view class="navigationCont">
<image bindtap="returnGo" class="navigation-arrow" src="/static/icons/arrowWrite.png"></image>
<image bindtap="returnHome" class="navigation-arrow" src="/static/icons/homeBlack.png"></image>
</view>
<!-- <image bindtap="returnGo" class="navigation-arrow" src="{{isFixedTop > 0 ? '/static/icons/returnBlack.png' : '/static/icons/returnWrite.png'}}"></image>
<image bindtap="returnHome" class="navigation-arrow" src="{{isFixedTop > 0 ? '/static/icons/homeBlack.png' : '/static/icons/homeWrite.png'}}"></image> -->
</view>
<!-- 产品图 -->
<view class="banner">
<swiper class="swiperCont" indicator-dots indicator-color="rgba(255,255,255,.5)" indicator-active-color="#fff" autoplay="true" circular>
<swiper-item wx:for="{{goodsData.pictures}}" wx:key="index" data-index="{{index}}" data-imgs="{{goodsData.pictures}}" bindtap="opneBanner">
<image class="swiperImg" src="{{item}}" mode="aspectFill"></image>
</swiper-item>
</swiper>
</view>
<!-- 商品信息 -->
<view class="goodsCont">
<view class="goodsWhite goodsInfo">
<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">
<image class="goodsInfo-share-image" src="/static/icons/goodsShare.png"></image>分享
</view>
</view>
<view class="goodsWhite goodsItem">
<view class="goodsItem-label">
<view class="goodsItem-label-logo">
<image src="{{goodsData.shop.cover}}"></image>
</view>
<view class="goodsItem-label-text">
{{goodsData.shop.name}}
<view class="goodsItem-label-tips">服务态度:<text>5.0</text></view>
</view>
</view>
</view>
<!-- 详情 -->
<view class="goodsBrief">
<rich-text nodes="{{mallContent}}"></rich-text>
</view>
</view>
<!-- 底部 -->
<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>
</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>
<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>
<text class="goods-size-tag-text {{specselect[idx] == items.value_id ? 'active':''}}" wx:for="{{item.values}}" wx:key="attribute" wx:for-item="items" data-valueid="{{items.value_id}}" data-index="{{idx}}" bindtap="selectSize">{{items.value}}</text>
</view>
<view class="goods-size-number">
<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>
<view class="goods-number-btn" bindtap="goodsNumber" data-type="plus">+</view>
</view>
<view class="goods-number" wx:else>
<view class="goods-number-btn">-</view>
<input class="goods-number-input" value="0" type="number" bindinput="goodsNumberInput" disabled></input>
<view class="goods-number-btn">+</view>
</view>
</view>
<view class="goods-size-btn" wx:if="{{selectSkusValues.stock == 0}}">
<view class="active">抱歉,商品库存不足了 ~</view>
</view>
<view class="goods-size-btn" wx:else>
<view bindtap="buyTap">立即购买</view>
</view>
</view>

View File

@@ -0,0 +1,419 @@
page {
background-color: #f6f6f6;
}
/* 返回 */
.navigation {
position: fixed;
top: 0;
left: 0;
z-index: 999;
width: 100%;
height: 90rpx;
background-color: transparent;
transition: .2s;
padding: 0 20rpx;
box-sizing: border-box;
}
.navigationCont {
background: white;
padding: 0 10rpx;
box-sizing: border-box;
display: inline-block;
border-radius: 80rpx;
height: 58rpx;
margin-top: 10rpx;
}
.navigation-arrow {
width: 38rpx;
height: 38rpx;
margin: 10rpx 15rpx;
}
/* 产品图 */
.banner {
overflow: hidden;
position: relative;
padding-top: 100%;
}
.swiperCont,
.swiperImg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* 产品 */
/* 产品详情 */
.goodsCont {
padding: 30rpx;
border-bottom: 60px solid transparent;
box-sizing: border-box;
}
.goodsWhite {
background-color: #ffffff;
box-sizing: border-box;
border-radius: 15rpx;
margin-bottom: 30rpx;
}
.goodsInfo {
padding: 30rpx;
box-sizing: border-box;
position: relative;
}
.goodsInfo-price {
display: flex;
position: relative;
line-height: 52rpx;
color: #da2b54;
}
.goodsInfo-cost {
font-size: 48rpx;
}
.goodsInfo-cost text {
font-size: 28rpx;
}
.goodsInfo-vip {
background-color: #ffebeb;
border-radius: 80rpx;
margin-left: 30rpx;
padding: 0 25rpx;
height: 52rpx;
font-size: 32rpx;
}
.goodsInfo-vip text {
font-size: 24rpx;
padding-right: 5rpx;
}
.goodsInfo-name {
margin-top: 20rpx;
font-size: 32rpx;
}
.goodsInfo-share {
position: absolute;
top: 40rpx;
right: 30rpx;
display: flex;
font-size: 27rpx;
line-height: 34rpx;
color: #9b9b9b;
}
.goodsInfo-share-image {
width: 34rpx;
height: 34rpx;
margin-right: 10rpx;
}
/* 参数 */
.goodsItem {
padding: 0 30rpx;
}
.goodsItem-label {
display: flex;
padding: 30rpx 0;
box-sizing: border-box;
}
.goodsItem-label-name {
color: #999999;
display: flex;
}
.goodsItem-label-logo {
width: 80rpx;
height: 80rpx;
background-color: #fff;
border: 2rpx solid #cecece;
padding: 9rpx;
text-align: center;
box-sizing: border-box;
margin-right:30rpx;
}
.goodsItem-label-logo image {
width: 60rpx;
height: 60rpx;
}
.goodsItem-label-see {
display: flex;
width: calc(100% - 120rpx);
background-color: #fff9fa;
padding: 10rpx 0;
border-radius: 15rpx;
}
.goodsItem-label-block {
flex: 3;
text-align: center;
font-size: 26rpx;
position: relative;
}
.goodsItem-label-block::after {
position: absolute;
content: '';
background-color: #cdcdcd;
width: 1rpx;
height: 60%;
top: 20%;
left: -1rpx;
}
.goodsItem-label-block:first-child::after {
display: none;
}
.goodsItem-label-title {
color: #da2b54;
line-height: 50rpx;
}
.goodsItem-label-tips {
color: #999999;
}
.goodsItem-label-text {
}
.goodsItem-label-tips {
font-size: 26rpx;
margin-top: 10rpx;
}
.goodsItem-label-tips text {
color: #da2b54;
}
/* 底部 */
.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: 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;
}
/* 规格弹出 */
/* 规格 */
.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;
}
.goods-size-close {
position: absolute;
width: 36rpx;
right: 20rpx;
top: 30rpx;
}
.goods-size-content.active {
bottom: 0;
}
.goods-size-img {
position: absolute;
left: 15rpx;
top: -40rpx;
background: white;
width: 200rpx;
height: 200rpx;
padding: 15rpx;
box-sizing: border-box;
border-radius: 6rpx;
}
.goods-size-img image {
width: 100%;
height: 100%;
}
.goods-size-info {
padding: 30rpx 30rpx 30rpx 230rpx;
height: 160rpx;
box-sizing: border-box;
}
.goods-size-info-price {
line-height: 60rpx;
font-size: 32rpx;
color: #da2b54;
font-weight: bold;
}
.goods-size-info-price text {
font-size: 26rpx;
}
.goods-size-info-text {
line-height: 40rpx;
color: #747788;
font-size: 26rpx;
}
.goods-size-specs {
padding: 10rpx 30rpx;
}
.goods-size-title {
color: #747788;
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 {
text-align: center;
line-height: 90rpx;
font-size: 28rpx;
background: #da2b54;
color: white;
width: 100%;
float: left;
}
.goods-size-btn view.active {
background: #b8b8b8;
}

145
pages/mall/goods/goods.js Normal file
View File

@@ -0,0 +1,145 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
name : '', // 搜索名字
sortStaus : false, // 分类弹出
ordertype : '', // 排序类型 price为价格 sales为销量
orderasc : '', // 排序方式 asc为正序 desc为倒序
goodsArr : [], // 商品列表
goodsId : '', // 分类id
categorieArr : [], // 分类列表
categorieindex : 0 // 第一分类下标
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
goodsId: options.id,
name: options.title
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取商品列表
this.goodsInfo();
},
/**
* 商品列表信息
*/
goodsInfo(page) {
wx.$api.mall.Goods({
name : this.data.name || '',
category_id: this.data.goodsId || '',
page : page || 1,
order_by : this.data.ordertype,
order_by_type: this.data.orderasc
}).then(res => {
let listArr = this.data.goodsArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
goodsArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
}).catch(err =>{
})
},
/**
* 销量排序
*/
orderTap (e) {
let type = e.currentTarget.dataset.type
this.setData({
ordertype : type,
})
if(type == 'price') {
if (this.data.orderasc == 'asc') {
this.setData({
orderasc : 'desc',
})
} else {
this.setData({
orderasc : 'asc',
})
}
} else {
this.setData({
orderasc: '',
})
}
// 拉取商品列表数据
this.goodsInfo();
},
/**
* 跳转商品详情
*/
detailsGo(e) {
wx.navigateTo({
url: '/pages/mall/details/details?id=' + e.currentTarget.dataset.id
})
this.setData({
name: ''
})
},
/**
* 搜索
*/
searchForm(e) {
this.setData({
name: e.detail.value.search
})
// 拉取商品列表数据
this.goodsInfo();
},
/**
* 商品分类展示
*/
sortShow() {
this.setData({
sortStaus : !this.data.sortStaus
})
// 获取商品分类
this.categorieInfo()
},
/**
* 商品分类信息
*/
categorieInfo() {
wx.$api.mall.Categorie().then(res => {
this.setData({
categorieArr: res.data
})
}).catch(err =>{})
},
// 一级分类
categorieTap(e) {
this.setData({
categorieindex: e.currentTarget.dataset.index
})
}
})

View File

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

View File

@@ -0,0 +1,83 @@
<!-- 搜索 -->
<block wx:if="{{goodsArr.length > 0}}">
<form bindsubmit="searchForm" class="mallSearch">
<view class="mallSearch-cont">
<image class="mallSearch-cont-icon" src="https://storage.funnyzhibo.com/images/2020/05/06/search_icon.png"></image>
<input class="search-navigator" placeholder="输入关键字" value="{{name}}" name="search" confirm-type="search" bindconfirm='confirmTap'></input>
<button class="mallSearch-btn" form-type="submit">搜索</button>
</view>
</form>
<!-- 分类 -->
<view class="mallTag">
<view class="mallTag-name {{ordertype == 'sales' ? 'active':''}}" data-type="sales" bindtap="orderTap">
销量
<!-- <image src="/static/icons/price_icon.png" wx:if="{{orderasc == 'asc'}}"></image>
<image src="/static/icons/price_icon_active.png" wx:else></image> -->
</view>
<view class="mallTag-name {{ordertype == 'price' ? 'active':''}}" data-index="{{daindex}}" data-type="price" bindtap="orderTap">
价格
<block wx:if="{{orderasc != ''}}">
<image src="/static/icons/price_icon.png" wx:if="{{orderasc == 'asc'}}"></image>
<image src="/static/icons/price_icon_active.png" wx:else></image>
</block>
<block wx:else>
<image src="/static/icons/price_nr.png"></image>
</block>
</view>
<image class="mallTag-one" src="/static/icons/sort.png" bindtap="sortShow"></image>
</view>
<view class="goodsList">
<view bindtap="detailsGo" data-id="{{item.goods_id}}" class="goodsItem" wx:for="{{goodsArr}}" wx:key="goodsArr">
<view class="goodsItem-img">
<image mode="aspectFill" src="{{item.cover}}"></image>
</view>
<view class="goodsItem-cont">
<view class="nowrap goodsItem-name">{{item.name}}</view>
<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>
</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>
</block>
<view class="pack-center pages-hint" wx:else>
<image src="/static/imgs/text_null.png"></image>
<view>暂无商品</view>
</view>
<!-- 分类展示 -->
<view class="sortBack {{sortStaus ? 'active' : ''}}" bindtap="sortShow"></view>
<view class="sortCont {{sortStaus ? 'active' : ''}}">
<scroll-view class="stair-nav" scroll-y>
<view class="stair-nav-li {{categorieArr[categorieindex].category_id == item.category_id ? 'active' : ''}}" wx:for="{{categorieArr}}" wx:key="categorieArr" bindtap="categorieTap" data-index="{{index}}">
{{item.name}}</view>
</scroll-view>
<scroll-view class="level-content" scroll-y>
<view class="levelList-title">{{categorieArr[categorieindex].name}}</view>
<view wx:if="{{categorieArr[categorieindex].children != ''}}">
<view class="level-nav">
<navigator hover-class="none" open-type="redirect" url="/pages/mall/goods/goods?id={{categorieArr[categorieindex].category_id}}" class="level-nav-li" wx:for="{{categorieArr[categorieindex].children}}" wx:key="children" wx:for-item="level">
<view class="level-nav-cover">
<image src="{{level.cover}}" mode="aspectFill"></image>
</view>
<view class="level-nav-title">{{level.name}}</view>
</navigator>
</view>
</view>
<view class="level-tips" wx:else>
暂无产品
</view>
</scroll-view>
</view>

272
pages/mall/goods/goods.wxss Normal file
View File

@@ -0,0 +1,272 @@
page {
background-color: #f6f6f6;
}
/* 商城搜索 */
.mallSearch {
position: fixed;
width: 100%;
top: 0;
left: 0;
height: 120rpx;
box-sizing: border-box;
padding: 20rpx 30rpx;
background-color: #fff;
z-index: 9;
}
.mallSearch-cont {
background-color: #f7f7f7;
border-radius: 100rpx;
padding: 18rpx 30rpx;
box-sizing: border-box;
display: flex;
color: #999999;
height: 80rpx;
width: 100%;
}
.mallSearch-cont-icon {
width: 34rpx;
height: 34rpx;
margin-right: 30rpx;
margin-top: 6rpx;
}
.mallSearch-cont input {
width: calc(100% - 120px);
height: 48rpx;
line-height: 48rpx;
color: #000000;
}
.mallSearch-btn {
line-height: 48rpx;
font-size: 28rpx;
background: transparent;
color: #4c4c4c;
width: 150rpx !important;
padding: 0 !important;
border-radius: 0;
text-align: right;
}
.mallTag {
position: fixed;
left: 0;
top: 110rpx;
width: 100%;
background-color: #fff;
padding: 40rpx;
box-sizing: border-box;
display: flex;
z-index: 99;
}
.mallTag-one {
width: 46rpx;
height: 46rpx;
position: absolute;
right: 30rpx;
}
.mallTag-name {
display: flex;
line-height: 46rpx;
width: 150rpx;
}
.mallTag-name image {
width: 30rpx;
height: 30rpx;
margin: 7rpx 10rpx;
}
.mallTag-name.active,
.mallTag-one.active {
color: #d32300;
}
/* 列表 */
.goodsList {
margin: 260rpx 10rpx 30rpx;
flex-wrap: wrap;
justify-content: flex-start;
}
.goodsItem {
margin: 0 15rpx 20rpx;
width: calc(50% - 30rpx);
display: inline-block;
background-color: white;
border-radius: 30rpx;
overflow: hidden;
}
.goodsItem-img {
width: 100%;
position: relative;
padding-top: 100%;
}
.goodsItem-img image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.goodsItem-cont {
padding: 30rpx 20rpx;
box-sizing: border-box;
}
.goodsItem-text {
color: #ff9b26;
font-size: 26rpx;
line-height: 54rpx;
}
.goodsItem-tips {
margin-top: 20rpx;
display: flex;
line-height: 40rpx;
}
.goodsItem-price {
flex: 1;
color: #ff1122;
font-size: 32rpx;
font-weight: 600;
}
.goodsItem-sales {
font-size: 26rpx;
color: #999999;
}
/* 分类弹出 */
.sortBack {
position: fixed;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
left: 0;
top: 0;
z-index: 998;
display: none;
}
.sortBack.active {
display: block;
}
.sortCont {
position: fixed;
right: -100%;
bottom: 0;
width: 70%;
background-color: #fff;
height: 100vh;
z-index: 999;
transition: .2s;
}
.sortCont.active {
right: 0;
}
/* 一级分类 */
.stair-nav{
position: absolute;
top: 0;
left: 0;
background: #f7f7f7;
height: 100%;
width: 160rpx;
text-align: center;
z-index: 9;
}
::-webkit-scrollbar{
width: 0;
height: 0;
color: transparent;
display:none;
}
.stair-nav-li{
line-height: 100rpx;
border-top: solid 1rpx #ffffff;
}
.stair-nav-li.active{
background: white;
color: #e92344;
font-weight: bold;
position: relative;
}
.stair-nav-li.active::before{
position: absolute;
content: "";
left: 0;
top: 30rpx;
height: 40rpx;
background: #e92344;
width: 6rpx;
}
/* 二级分类 */
.level-content{
position: absolute;
left: 160rpx;
width: calc(100% - 160rpx);
width: -webkit-calc(100% - 160rpx);
height: 100%;
padding: 10rpx;
background: white;
box-sizing: border-box;
}
.levelList-title {
color: #2c2c2c;
padding: 20rpx 20rpx 0;
font-weight: 600;
}
.level-nav{
display: flex;
flex-wrap:wrap;
}
.level-nav-li{
width: 50%;
text-align: center;
padding: 10rpx;
box-sizing: border-box;
}
.level-nav-cover{
width: 100%;
padding-top: 100%;
position: relative;
border-radius: 10rpx;
overflow: hidden;
}
.level-nav-cover image {
position: absolute;
border-radius: 4rpx;
width: 80%;
height: 80%;
left: 10%;
top: 10%;
}
.level-nav-title{
font-size: 28rpx;
color: #464854;
}

142
pages/mall/index.js Normal file
View File

@@ -0,0 +1,142 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
scrollLeft : '', // 商品分类
bannerArr : [], // 轮播信息
categorieArr: [], // 分类信息
goodsArr : [], // 商品信息
articlesArr : [], // 公告列表
page : {}, // 分页信息
lodingStats : false,// 加载状态
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取banner信息
this.bannerInfo();
// 获取商品分类
this.categorieInfo();
// 获取商品列表
this.goodsInfo();
// 获取公告列表
this.articlesInfo();
},
/**
* banner信息
*/
bannerInfo() {
wx.$api.mall.Banner().then(res => {
this.setData({
bannerArr: res.data
})
}).catch(err =>{
})
},
/**
* 商品分类信息
*/
categorieInfo() {
wx.$api.mall.Categorie().then(res => {
this.setData({
categorieArr: res.data
})
}).catch(err =>{
})
},
/**
* 商品列表信息
*/
goodsInfo(page) {
wx.$api.mall.Goods({
page : page || 1
}).then(res => {
let listArr = this.data.goodsArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
goodsArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
}).catch(err =>{
})
},
/**
* 获取公告列表
*/
articlesInfo() {
wx.$api.mall.articles().then(res => {
this.setData({
articlesArr: res.data.data
})
console.log(res)
}).catch(err =>{})
},
/**
* 分类选择
*/
tabsTap(e) {
let newOffsetLeft = e.currentTarget.offsetLeft,
newScrollLeft = ''
if(newOffsetLeft < 270) {
newScrollLeft = 0
} else {
newScrollLeft = newOffsetLeft - this.data.scrollViewWidth / 2 + 40
}
this.setData({
scrollLeft: newScrollLeft,
categoryId: e.currentTarget.dataset.id
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取商品列表
this.goodsInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取商品列表
this.goodsInfo(pageNumber);
}
}
})

5
pages/mall/index.json Normal file
View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "绚火健康",
"navigationBarBackgroundColor": "#fbe2e1"
}

138
pages/mall/index.wxml Normal file
View File

@@ -0,0 +1,138 @@
<view class="linearBack">
<!-- 搜索 -->
<navigator class="mall-search" url="/pages/search/search" hover-class="none">
<image class="mall-search-icon" src="/static/icons/search.png" mode="widthFix"></image>搜索商品
</navigator>
<!-- 轮播 -->
<view class="mallBanner-cont">
<swiper class="mallBanner-see" autoplay="true" circular duration="1000" interval="6000" indicator-dots>
<block wx:for="{{bannerArr}}" wx:key="bannerArr">
<swiper-item>
<image src="{{item.cover}}" mode="aspectFill" class="mallBanner-img"></image>
</swiper-item>
</block>
</swiper>
</view>
<!-- 分类 -->
<view class="sort">
<view class="sort-list">
<navigator hover-class="none" url="/pages/mall/goods/goods?id={{item.category_id}}" class="sort-item" wx:for="{{categorieArr}}" wx:key="categorieArr">
<image class="sort-item-icon" mode="widthFix" src="{{item.cover}}"></image>
<view class="sort-item-name">{{item.name}}</view>
</navigator>
</view>
</view>
</view>
<!-- 公告 -->
<view class="notice">
<view class="noticeCont">
<image class="noticeCont-icon" src="/static/icons/notice.png" mode="widthFix"></image>
<swiper class="noticeCont-swiper" autoplay="true" circular duration="1000" interval="6000" vertical>
<navigator wx:for="{{articlesArr}}" wx:key="articlesArr" hover-class="none" url="/pages/mall/article/article?id={{item.article_id}}">
<swiper-item>
<view class="nowrap noticeCont-name">{{item.title}}</view>
</swiper-item>
</navigator>
</swiper>
</view>
</view>
<!-- 推荐 -->
<view class="suggest">
<view class="suggestLeft">
<view class="suggestLeft-swiper">
<swiper class="suggestLeft-see" autoplay="true" circular duration="1500" interval="8000" indicator-dots>
<swiper-item>
<navigator url="/pages/user/about/about">
<image src="https://cdn.douhuofalv.com/images/2023/08/04/f5de3fbb2cddb9f2ab8158bdde0e3122.png" mode="aspectFill" class="suggestLeft-img"></image>
</navigator>
</swiper-item>
<swiper-item>
<navigator url="/pages/user/about/about">
<image src="https://cdn.douhuofalv.com/images/2023/08/04/f5de3fbb2cddb9f2ab8158bdde0e3122.png" mode="aspectFill" class="suggestLeft-img"></image>
</navigator>
</swiper-item>
</swiper>
</view>
</view>
<view class="suggestRight">
<view class="module">
<view class="moduleWrite">
<view class="moduleTitle">
<view class="moduleTitle-name">今日种草</view>
<view class="moduleTitle-text">教你挑选健康好物</view>
</view>
<view class="moduleList">
<view class="moduleList-item">
<image class="moduleList-item-img" mode="widthFix" src="/static/ls/11.png"></image>
<view class="moduleList-item-price">¥199.9</view>
</view>
<view class="moduleList-item">
<image class="moduleList-item-img" mode="widthFix" src="/static/ls/12.png"></image>
<view class="moduleList-item-price">¥199.9</view>
</view>
</view>
</view>
<view class="moduleWrite">
<view class="moduleTitle">
<view class="moduleTitle-name">超值好物</view>
<view class="moduleTitle-text">每日优选 限时抢购</view>
</view>
<view class="moduleList">
<view class="moduleList-item">
<image class="moduleList-item-img" mode="widthFix" src="/static/ls/13.png"></image>
<view class="moduleList-item-price">¥199.9</view>
</view>
<view class="moduleList-item">
<image class="moduleList-item-img" mode="widthFix" src="/static/ls/14.png"></image>
<view class="moduleList-item-price">¥199.9</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 商品 -->
<view class="tabs">
<scroll-view class="tabs-scroll" scroll-x="true" scroll-left="{{scrollLeft}}" scroll-with-animation>
<view class="tabs-scroll-name active" bindtap="tabsTap">为你推荐</view>
<view class="tabs-scroll-name" bindtap="tabsTap">面部护理</view>
<view class="tabs-scroll-name" bindtap="tabsTap">口腔健康</view>
<view class="tabs-scroll-name" bindtap="tabsTap">睡眠健康</view>
<view class="tabs-scroll-name" bindtap="tabsTap">控卡美食</view>
</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">
<view class="goodsItem-img">
<image mode="aspectFill" src="{{item.cover}}"></image>
</view>
<view class="goodsItem-cont">
<view class="nowrap goodsItem-name">{{item.name}}</view>
<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>
</view>
</navigator>
<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="goodsList-no pages-hint" wx:else>
<image src="/static/imgs/text_null.png"></image>
<view>暂无商品</view>
</view>
</view>

329
pages/mall/index.wxss Normal file
View File

@@ -0,0 +1,329 @@
page {
background-color: #f6f6f6;
}
.linearBack {
background-image: linear-gradient(to top, #ffffff 60%, #fde8e9);
padding: 30rpx;
box-sizing: border-box;
}
/* 搜索 */
.mall-search {
height: 90rpx;
line-height: 90rpx;
background-color: #ffffff;
border-radius: 100rpx;
padding: 0 40rpx;
display: flex;
color: #999999;
font-size: 32rpx;
}
.mall-search-icon {
width: 40rpx;
margin: 25rpx 20rpx 0 0;
}
/* 轮播 */
.mallBanner-cont {
margin: 40rpx 0 15rpx;
position: relative;
border-radius: 30rpx;
padding-top: 35%;
overflow: hidden;
}
.mallBanner-see,
.mallBanner-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* 修改dot形状 */
.mallBanner-see .wx-swiper-dots .wx-swiper-dot {
background-color: #ffffff;
opacity: .6;
}
.mallBanner-see .wx-swiper-dot-active {
background-color: #ffffff !important;
opacity: 1 !important;
}
/* 分类 */
.sort-list {
overflow: hidden;
}
.sort-item {
width: 20%;
float: left;
text-align: center;
margin-top: 30rpx;
}
.sort-item-icon {
width: 92rpx;
}
.sort-item-name {
font-size: 26rpx;
color: #111111;
margin-top: 10rpx;
}
/* 公告 */
.notice {
padding: 30rpx;
box-sizing: border-box;
}
.noticeCont {
background-color: #ffffff;
border-radius: 100rpx;
height: 90rpx;
padding: 0 40rpx;
box-sizing: border-box;
display: flex;
overflow: hidden;
}
.noticeCont-swiper {
width: calc(100% - 38rpx);
height: 90rpx;
line-height: 90rpx;
}
.noticeCont-icon {
width: 38rpx;
margin-top: 28rpx;
}
.noticeCont-name {
width: calc(100% - 38rpx);
padding-left: 30rpx;
box-sizing: border-box;
color: #da2b54;
}
/* 推荐 */
.suggest {
padding: 10rpx 30rpx 0;
box-sizing: border-box;
display: flex;
display: none;
}
.suggestLeft {
width: 50%;
padding-right: 15rpx;
box-sizing: border-box;
}
.suggestLeft-swiper {
position: relative;
border-radius: 30rpx;
padding-top: 158%;
overflow: hidden;
}
.suggestLeft-see,
.suggestLeft-img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
/* 修改dot形状 */
.suggestLeft-see .wx-swiper-dots.wx-swiper-dots-horizontal {
bottom: 25rpx;
}
.suggestLeft-see .wx-swiper-dots .wx-swiper-dot {
width: 32rpx;
/*宽*/
height: 12rpx;
/*高*/
border-radius: 10rpx;
/*圆角*/
background-color: transparent;
border: 4rpx solid #ffffff;
box-sizing: border-box;
}
.suggestLeft-see .wx-swiper-dot-active {
background-color: #ffffff !important;
}
.suggestRight {
width: 50%;
padding-left: 15rpx;
box-sizing: border-box;
}
.moduleWrite {
background-color: #ffffff;
padding: 20rpx 30rpx;
box-sizing: border-box;
border-radius: 30rpx;
margin-bottom: 20rpx;
}
.module:last-child {
margin-bottom: 0;
}
.moduleTitle-name {
font-weight: 600;
}
.moduleTitle-text {
color: #999999;
font-size: 26rpx;
line-height: 48rpx;
}
.moduleList {
overflow: hidden;
margin-top: 10rpx;
}
.moduleList-item {
width: 50%;
float: left;
padding: 0 20rpx;
box-sizing: border-box;
text-align: center;
}
.moduleList-item-img {
width: 80%;
}
.moduleList-item-price {
font-size: 26rpx;
color: #ff4040;
font-weight: 600;
}
/* 商品 */
.tabs {
box-sizing: border-box;
width: 100%;
display: none;
}
.tabs-scroll {
line-height: 80rpx;
height: 84rpx;
white-space: nowrap;
}
.tabs-scroll-name {
display: inline-block;
padding: 0 40rpx 10rpx;
font-size: 30rpx;
position: relative;
color: #111111;
}
.tabs-scroll-name::after {
content: '';
position: absolute;
bottom: 0;
left: calc(50% - 4rpx);
height: 18rpx;
width: 8rpx;
border-radius: 80rpx 0 0 80rpx;
border-top: 6rpx solid transparent;
border-left: 6rpx solid transparent;
border-bottom: 6rpx solid transparent;
transform: translate(0) rotate(-90deg);
}
.tabs-scroll-name.active {
color: #da2b54;
font-weight: 600;
}
.tabs-scroll-name.active::after {
border-top-color: #da2b54;
border-left-color:#da2b54;
border-bottom-color: #da2b54;
}
.goods {
padding: 0 30rpx;
box-sizing: border-box;
}
.goodsList {
flex-wrap: wrap;
justify-content: flex-start;
}
.goodsItem {
margin: 0 15rpx 20rpx;
width: calc(50% - 30rpx);
display: inline-block;
background-color: white;
border-radius: 30rpx;
overflow: hidden;
}
.goodsItem-img {
width: 100%;
position: relative;
padding-top: 100%;
}
.goodsItem-img image {
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
}
.goodsItem-cont {
padding: 30rpx 20rpx;
box-sizing: border-box;
}
.goodsItem-text {
color: #ff9b26;
font-size: 26rpx;
line-height: 54rpx;
}
.goodsItem-tips {
margin-top: 20rpx;
display: flex;
line-height: 40rpx;
}
.goodsItem-price {
flex: 1;
color: #ff1122;
font-size: 32rpx;
font-weight: 600;
}
.goodsItem-sales {
font-size: 26rpx;
color: #999999;
}
/* 暂无列表 */
.goodsList-no {
background-color: #ffffff;
border-radius: 20rpx;
padding: 30rpx 30rpx 60rpx;
box-sizing: border-box;
}

View File

@@ -0,0 +1,129 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
data: {
goodsData : '', //详情
canState : '', //操作按钮
express : '', //物流
orderNo : '' //订单号
},
onLoad(options) {
this.setData({
orderNo: options.order_no
})
},
onShow() {
// 获取订单详情
this.goodsInfo();
},
/**
* 订单详情
*/
goodsInfo() {
wx.$api.order.goodsDet(this.data.orderNo).then(res => {
this.setData({
goodsData : res.data,
canState : res.data.can,
express : res.data.express
})
}).catch(err => {})
},
/**
* 复制订单号
*/
copyUrl(val) {
wx.setClipboardData({
data: val.currentTarget.dataset.no,
success: () => {
wx.showToast({
title: "订单编号复制成功",
icon : "none"
})
}
})
},
/**
* 支付订单
*/
payClick() {
wx.navigateTo({
url: '/pages/pay/index?order_no=' + this.data.goodsData.order_no + '&total=' + this.data.goodsData.total
})
},
/**
* 订单签收
*/
signClick(e) {
wx.showModal({
title : '提示',
content : '是否签收',
success : res=> {
if (res.confirm) {
wx.$api.order.goodsSign(this.data.goodsData.order_no).then(res => {
wx.showToast({
title:'签收成功',
icon:'none'
})
// 获取订单详情
this.goodsInfo();
}).catch(err => {})
}
}
})
},
/**
* 取消订单
*/
cancelClick(e) {
wx.showModal({
title : '提示',
content : '是否取消订单',
success : res=> {
if (res.confirm) {
wx.$api.order.goodsCancel(this.data.goodsData.order_no).then(res => {
wx.showToast({
title:'取消成功',
icon:'none'
})
// 回到列表
wx.navigateBack(1)
}).catch(err => {})
}
}
})
},
/**
* 复制物流单号
*/
copyExpress(val) {
wx.setClipboardData({
data: val.currentTarget.dataset.no,
success: () => {
wx.showToast({
title: "物流单号复制成功",
icon : "none"
})
}
})
},
// 查看物流
h5url() {
wx.navigateTo({
url: "/pages/order/logistic/logistic?orderno=" + this.data.goodsData.order_no
})
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "订单详情"
}

View File

@@ -0,0 +1,91 @@
<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>
<view class="orderData-cont-text">
<view class="orderData-cont-name">订单编号</view>
<view class="orderData-cont-copy">
<text class="nowrap">{{goodsData.order_no}}</text>
<view bindtap="copyUrl" data-no="{{goodsData.order_no}}">复制</view>
</view>
</view>
</view>
<view class="orderData-cont-label">
<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>
</view>
</view>
<view class="While">
<view class="shopSee">
<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>
</block>
</view>
</view>
<view class="While reserveCont">
<view class="reserveCont-title">订单信息</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>
<view class="reserve-label">
<view class="reserve-name">交易状态</view>
<view class="reserve-text reserve-status">{{goodsData.state}}</view>
</view>
<view class="reserve-label">
<view class="reserve-name">实付款</view>
<view class="reserve-text reserve-price">¥{{goodsData.total}}</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>
<view class="reserve-label">
<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>
</view>
</view>
<view class="reserve-label">
<view class="reserve-name">查看物流信息</view>
<view class="reserve-text reserve-text-btn" bindtap="h5url">
去查看
</view>
</view>
</view>
</view>
<view class="order-data-footer">
<view class="list-btn">
<view class="order-btn" bindtap="cancelClick" wx:if="{{canState.cancel}}">取消订单</view>
<view class="order-btn" bindtap="payClick" wx:if="{{canState.pay}}">立即付款</view>
<view class="order-btn" bindtap="signClick" wx:if="{{canState.sign}}">签收订单</view>
<navigator hover-class="none" class="order-btn grey" open-type="navigateBack">返回订单</navigator>
</view>
</view>

View File

@@ -0,0 +1,256 @@
page {
background: #f3f4f6;
padding: 30rpx;
box-sizing: border-box;
}
.While {
border-radius: 10rpx;
margin-bottom: 30rpx;
background-color: #FFFFFF;
box-shadow: 0 0 10rpx rgba(0, 0, 0, .05);
}
.orderData {
border-bottom: 100rpx transparent solid;
}
/* 订单 */
.orderData-cont-label {
padding: 40rpx 30rpx;
display: flex;
box-sizing: border-box;
border-bottom: #f2f2f2 2rpx solid;
}
.orderData-cont-img {
width: 38rpx;
height: 38rpx;
margin-top: 4rpx;
}
.orderData-cont-text {
width: calc(100% - 68rpx);
margin-left: 20rpx;
box-sizing: border-box;
font-size: 30rpx;
}
.orderData-cont-site {
width: calc(100% - 108rpx);
}
.orderData-cont-name {
margin-bottom: 10rpx;
}
.orderData-cont-name text {
color: #999;
padding-left: 20rpx;
}
.orderData-cont-copy {
display: flex;
font-size: 28rpx;
color: #999;
}
.orderData-cont-copy text {
flex: 1;
display: inline-block;
margin-right: 20rpx;
}
.orderData-cont-copy view {
color: #da2b54;
}
.address-btn {
width: 42rpx;
height: 42rpx;
margin-top: 46rpx;
}
/* 产品 */
.list-goods {
display: flex;
padding: 30rpx;
box-sizing: border-box;
}
.shopSee {
line-height: 40rpx;
display: flex;
padding: 30rpx 30rpx 10rpx;
box-sizing: border-box;
}
.shopSee-name {
flex: 1;
display: flex;
}
.shopSee-name image {
width: 34rpx;
margin: 5rpx 15rpx 0 0;
}
.shopSee-state {
font-size: 28rpx;
}
.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 {
text-align: right;
font-size: 28rpx;
}
.list-goods-parice text {
font-size: 34rpx;
}
/* 规格 */
.reserveCont-title {
padding: 30rpx;
font-size: 30rpx;
}
.reserve-label {
display: flex;
padding: 0 30rpx 30rpx;
box-sizing: border-box;
font-size: 28rpx;
line-height: 48rpx;
}
.reserve-name {
flex: 1;
width: 200rpx;
margin-right: 20rpx;
color: #7e7e7e;
}
.reserve-text {
width: calc(100% - 240rpx);
text-align: right;
line-height: 50rpx;
}
.reserve-text-btn {
width: 120rpx;
text-align: center;
color: #ffffff;
background-color: #da2b54;
font-size: 26rpx;
border-radius: 10rpx;
line-height: 54rpx;
}
.reserve-text-copy {
display: contents;
}
.reserve-text-tap {
color: #ff9951;
padding-left: 30rpx;
}
.reserve-text text {
font-size: 24rpx;
display: inline-block;
background-image: linear-gradient(to right, #f16e06, #f34206);
color: #FFFFFF;
border-radius: 6rpx;
padding: 0 10rpx;
height: 44rpx;
line-height: 44rpx;
margin-top: 6rpx;
}
.reserve-text text.active {
background-image: linear-gradient(to right, #027be6, #2855f0);
}
.reserve-text.reserve-price {
font-weight: 600;
font-size: 34rpx;
color: #da2b54;
}
.reserve-copy {
color: #da2b54;
border: #da2b54 2rpx solid;
display: inline-block;
height: 34rpx;
line-height: 34rpx;
font-size: 26rpx;
padding: 0 10rpx;
border-radius: 4rpx;
margin-left: 10rpx;
}
.reserve-status {
color: #ff8100
}
/* 底部菜单 */
.order-data-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
border-top: solid 1rpx #f2f2f2;
padding-top: 20rpx;
padding-right: 30rpx;
padding-left: 30rpx;
height: 110rpx;
background: white;
flex-wrap: wrap;
flex-direction: row-reverse;
z-index: 9;
}
.list-btn {
text-align: right;
}
.order-btn {
border: 2rpx solid #da2b54;
color: #da2b54;
border-radius: 80rpx;
height: 56rpx;
line-height: 56rpx;
padding: 0 20rpx;
display: inline-block;
font-size: 26rpx;
margin-left: 30rpx;
}
.order-btn.grey {
color: grey;
border-color: grey;
}

141
pages/order/index.js Normal file
View File

@@ -0,0 +1,141 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
data: {
listType : '', // 订单状态
listsArr : [], // 订单列表
page : {}, // 分页信息
lodingStats : false,// 加载状态
},
onLoad(options) {
this.setData({
listType: options.list_type
})
},
onShow() {
// 获取订单列表
this.listInfo()
},
/**
* 订单列表
*/
listInfo(page) {
wx.$api.order.list({
state: this.data.listType,
page : page || 1
}).then(res => {
let listArr = this.data.listsArr,
newData = []
if(page == 1 || page == undefined) listArr = []
newData = listArr.concat(res.data.data)
this.setData({
listsArr : newData,
page : res.data.page,
lodingStats : false
})
wx.stopPullDownRefresh()
}).catch(err => {})
},
/**
* 状态筛选
*/
onTabs(val){
if(this.data.listType === val) return
this.setData({
listType: val.currentTarget.dataset.type
})
// 获取订单列表
this.listInfo()
},
/**
* 支付订单
*/
payClick(e) {
wx.navigateTo({
url: '/pages/pay/index?order_no=' + e.currentTarget.dataset.order_no + '&total=' + e.currentTarget.dataset.total
})
},
/**
* 更多操作
*/
operateMore(e) {
wx.showActionSheet({
itemList: ['取消订单'],
success: ()=> {
wx.showModal({
title : '提示',
content : '是否取消订单',
success : res=> {
if (res.confirm) {
wx.$api.order.goodsCancel(e.currentTarget.dataset.order_no).then(res => {
wx.showToast({
title:'取消成功',
icon:'none'
})
// 获取订单列表
this.listInfo()
}).catch(err => {})
}
}
})
},
fail: err=> {}
})
},
/**
* 订单签收
*/
signClick(e) {
wx.showModal({
title : '提示',
content : '是否签收',
success : res=> {
if (res.confirm) {
wx.$api.order.goodsSign(e.currentTarget.dataset.order_no).then(res => {
wx.showToast({
title:'签收成功',
icon:'none'
})
// 获取订单列表
this.listInfo()
}).catch(err => {})
}
}
})
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
// 获取订单列表
this.listInfo();
},
/**
* 上拉加载
*/
onReachBottom(){
this.setData({
lodingStats: true
})
let pageNumber = this.data.page.current
if(this.data.page.has_more){
pageNumber++
// 获取订单列表
this.listInfo(pageNumber);
}
}
})

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

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

66
pages/order/index.wxml Normal file
View File

@@ -0,0 +1,66 @@
<view class="header">
<view class="tabs">
<view class="tabs-item {{listType == '' ? 'show' : ''}}" bindtap="onTabs" data-type="">全部</view>
<view class="tabs-item {{listType == 'unpay' ? 'show' : ''}}" bindtap="onTabs" data-type="unpay">待付款</view>
<view class="tabs-item {{listType == 'paid' ? 'show' : ''}}" bindtap="onTabs" data-type="paid">待发货</view>
<view class="tabs-item {{listType == 'delivered' ? 'show' : ''}}" bindtap="onTabs" data-type="delivered">待收货</view>
<view class="tabs-item {{listType == 'signed' ? 'show' : ''}}" bindtap="onTabs" data-type="signed">已签收</view>
</view>
</view>
<view class="list" wx:if="{{listsArr.length > 0}}">
<view class="list-item" wx:for="{{listsArr}}" wx:key="listsArr">
<view class="list-top">
<view class="list-top-no">{{item.order_no}}</view>
<view class="list-top-status">{{item.state}}</view>
</view>
<view class="list-goods" wx:for-item="goodItem" wx:for="{{item.items}}" wx:key="items">
<image class="list-goods-img" mode="aspectFill" src="{{goodItem.sku.cover}}"></image>
<view class="list-goods-cont">
<view class="nowrap list-goods-name">{{goodItem.sku.goods_name}}</view>
<view class="list-goods-text">
<text>规格 99ml</text>x{{goodItem.qty}}
</view>
<view class="list-goods-parice">
¥<text>{{goodItem.sku.price}}</text>
</view>
</view>
</view>
<view class="list-total" wx:if="{{item.total != 0}}">
交易金额 <text>¥</text>
<view class="list-total-price">{{item.total}}</view>
</view>
<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 bindtap="signClick" data-order_no="{{item.order_no}}" class="list-btn-labor" wx:if="{{item.can.sign}}">签收订单</view>
<navigator hover-class="none" url="./details/details?order_no={{item.order_no}}" class="list-btn-labor grey">查看详情</navigator>
</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>

174
pages/order/index.wxss Normal file
View File

@@ -0,0 +1,174 @@
page {
background-color: #f7faff;
}
/* tabs */
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 99;
height: 100rpx;
background-color: #f7faff;
}
.tabs {
display: flex;
justify-content: space-around;
padding: 30rpx 10rpx;
font-size: 30rpx;
color: #3c3d3e;
}
.tabs-item.show {
color: #da2b54;
}
/* 列表 */
.list {
padding: 20rpx 30rpx 30rpx;
box-sizing: border-box;
margin-top: 100rpx;
}
.list-item {
background-color: #ffffff;
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
margin-bottom: 30rpx;
box-shadow: 0 4rpx 30rpx 2rpx rgba(0, 0, 0, .05);
}
.list-top {
display: flex;
margin-bottom: 30rpx;
line-height: 48rpx;
}
.list-top-no {
flex: 1;
}
.list-top-status {
color: #ff8100;
}
.list-goods {
display: flex;
}
.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 {
text-align: right;
font-size: 28rpx;
}
.list-goods-parice text {
font-size: 32rpx;
}
.list-total {
text-align: right;
margin-top: 30rpx;
font-size: 30rpx;
}
.list-total.active {
color: #da2b54;
}
.list-total text {
font-size: 30rpx;
}
.list-total-price {
display: inline-block;
font-weight: 600;
font-size: 38rpx;
}
.list-tips {
background-color: #f7faff;
display: flex;
padding: 20rpx 30rpx;
box-sizing: border-box;
margin: 30rpx 0 40rpx;
border-radius: 10rpx;
line-height: 44rpx;
font-size: 28rpx;
}
.list-tips-left {
display: flex;
margin-right: 40rpx;
}
.list-tips-img {
width: 44rpx;
height: 44rpx;
margin-right: 10rpx;
}
.list-tips-right {
color: #707070;
width: calc(100% - 210rpx);
}
.list-operate {
display: flex;
}
.list-more {
flex: 1;
line-height: 56rpx;
font-size: 26rpx;
color: #999999;
}
.list-btn {
text-align: right;
}
.list-btn-labor {
border: 2rpx solid #ff8100;
color: #ff8100;
border-radius: 80rpx;
height: 56rpx;
line-height: 56rpx;
padding: 0 25rpx;
display: inline-block;
font-size: 26rpx;
margin-left: 30rpx;
}
.list-btn-labor.grey {
color: grey;
border-color: grey;
}

View File

@@ -0,0 +1,41 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
data: {
orderNo : '',
logisticArr : [],
expressData : '',
},
onLoad(options) {
this.setData({
orderNo: options.orderno
})
},
onShow() {
// 查看物流
this.h5url();
},
// 查看物流
h5url() {
wx.$api.order.kuaiDi(this.data.orderNo).then(res => {
this.setData({
expressData: res.data.orderExpress,
logisticArr: res.data.logistics
})
}).catch(err => {})
// wx.request({
// url: 'http://shanhe.kim/api/za/kuaidi.php?id=' + this.data.expressData.express_no, //需更换需请求数据的接口
// success: res=> {
// this.setData({
// logisticArr: res.data.data
// })
// },
// });
}
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "物流信息"
}

View File

@@ -0,0 +1,42 @@
<block wx:if="{{logisticArr.length > 0}}">
<view class="top">
<view class="top-logo">
<image src="{{expressData.logistic_cover ? expressData.logistic_cover : '/static/imgs/logistics.png'}}" mode="aspectFill"></image>
</view>
<view class="top-cont">
<view class="top-name">
{{expressData.logistic_name}}
<view class="top-no">
{{expressData.express_no}}
</view>
</view>
<view class="top-type">{{expressData.order_state}}</view>
</view>
</view>
<view class="white">
<view class="address">
<view class="address-tips">
</view>
<view class="address-text">
{{expressData.address}}
</view>
</view>
<view class="list">
<view class="item" wx:for="{{logisticArr}}" wx:key="logisticArr">
<view class="item-name">
<view class="item-time">
{{item.time}}
</view>
</view>
<view class="item-text">
{{item.context}}
</view>
</view>
</view>
</view>
</block>
<view class="pack-center pages-hint" wx:else>
<image src="/static/imgs/cont_null.png"></image>
<view>暂无物流信息</view>
</view>

View File

@@ -0,0 +1,141 @@
.top {
background-color: #da2b54;
padding: 30rpx 30rpx 60rpx;
box-sizing: border-box;
display: flex;
}
.top-logo {
background-color: #ffffff;
border-radius: 10rpx;
width: 100rpx;
height: 100rpx;
padding: 10rpx;
box-sizing: border-box;
}
.top-logo image {
width: 100%;
height: 100%;
}
.top-cont {
color: #ffffff;
width: calc(100% - 130rpx);
margin-left: 30rpx;
}
.top-name {
display: flex;
line-height: 44rpx;
padding: 10rpx 0;
}
.top-no {
font-size: 26rpx;
padding-left: 30rpx;
opacity: .9;
}
.top-type {
font-size: 24rpx;
}
.top-type text {
padding-left: 20rpx;
}
.address {
color: #333333;
font-size: 24rpx;
display: flex;
padding: 30rpx 30rpx 0;
}
.address-tips {
width: 54rpx;
text-align: center;
height: 54rpx;
line-height: 54rpx;
border-radius: 50%;
background-color: #EEEEEE;
margin-left: -15rpx;
font-size: 24rpx
}
.address-text {
width: calc(100% - 74rpx);
margin-left: 20rpx;
padding-top: 10rpx;
}
.white {
margin-top: -30rpx;
background-color: #ffffff;
border-radius: 20rpx;
}
.list {
padding: 0 30rpx;
box-sizing: border-box;
}
.item {
padding-bottom: 40rpx;
padding-left: 40rpx;
box-sizing: border-box;
position: relative;
}
.item:first-child {
padding-top: 30rpx;
}
.item::after {
position: absolute;
content: '';
background-color: #DDDDDD;
width: 14rpx;
height: 14rpx;
border-radius: 50%;
left: 0;
top: calc(50% - 6rpx);
z-index: 3;
border: 2rpx solid #ffffff;
}
.item::before {
position: absolute;
content: '';
background-color: #F0F0F0;
width: 2rpx;
height: 100%;
border-radius: 50%;
left: 8rpx;
top: 0;
}
.item-name {
display: flex;
}
.item-status {
font-weight: 600;
padding-right: 20rpx;
}
.item-time {
color: #868686;
}
.item-text {
color: #868686;
font-size: 24rpx;
line-height: 40rpx;
margin-top: 20rpx;
}
.item:first-child .item-time,
.item:first-child .item-text {
color: #ff8100 !important;
}

28
pages/pay/index.js Normal file
View File

@@ -0,0 +1,28 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const params = JSON.parse(decodeURIComponent(options.params));
console.log(params)
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
})

4
pages/pay/index.json Normal file
View File

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

23
pages/pay/index.wxml Normal file
View File

@@ -0,0 +1,23 @@
<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>
</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}}">
<image src="/static/icons/loadingGif.gif"></image>
<view>疯狂加载中...</view>
</view>

86
pages/pay/index.wxss Normal file
View File

@@ -0,0 +1,86 @@
page {
background-color: #f4f4f6;
}
.payTop {
text-align: center;
padding: 140rpx 0;
}
.payTop-price {
font-weight: 600;
font-size: 78rpx;
line-height: 70rpx;
padding: 20rpx 0 0;
}
.payTop-price text {
font-size: 36rpx;
}
.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;
}

149
pages/register/index.js Normal file
View File

@@ -0,0 +1,149 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
successHide : false, // 注册成功
checked : false, // 勾选协议
codename : '获取验证码',
smsDisabled : false,// 获取验证码 禁止点击
seeState : false, //小眼睛
againState : false, //小眼睛-再次输入密码
passwordState: true, //小眼睛-显示
passwordAgain: true, //小眼睛-显示-再次输入密码
phone : "", // 手机号
code : "", // 验证码
},
/**
* 生命周期函数--监听页面加载
*/
onLoad() {},
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
/**
* 手机号码
*/
bindInput(e) {
this.setData({
phone: e.detail.value
})
},
/**
* 短信验证码
*/
bindCode(e) {
this.setData({
code: e.detail.value
})
},
/**
* 获取短信验证码
*/
getPhoneCode(e) {
let mobile = this.data.phone
var _this = this
if (mobile == "") {
wx.showToast({
title : '手机号不能为空',
icon : 'none',
duration : 1000
})
return false;
}else{
wx.$api.auth.getSms({
mobileNo: mobile
}).then(res=>{
console.log(res)
_this.setData({
smsDisabled : true
})
wx.showToast({
title : '发送成功',
icon : 'success',
duration: 2000
})
var num = 60;
var timer = setInterval(function () {
num--;
if (num <= 0) {
clearInterval(timer);
_this.setData({
codename : '重新发送',
smsDisabled : false
})
} else {
_this.setData({
codename : num + "s后重新获取",
smsDisabled : true
})
}
}, 1000)
}).catch(err=>{})
}
},
/**
* 查看密码
*/
seeClick() {
this.setData({
seeState : !this.data.seeState,
passwordState: !this.data.passwordState
})
},
/**
* 查看密码-再次
*/
seeAgain() {
this.setData({
againState : !this.data.againState,
passwordAgain : !this.data.passwordAgain
})
},
/**
* 立即注册
*/
registerForm(e) {
let value = e.detail.value
let data = {
username : this.data.phone,
code : value.code,
password : value.password,
password_confirmation : value.password_confirmation,
parent_id : ''
}
wx.$api.auth.register(data).then(res => {
// 存储登录信息
wx.setStorage({
key : 'token',
data : res.data.token_type + ' ' + res.data.access_token,
success: () =>{
this.setData({
successHide: true
})
}
})
}).catch(() =>{
this.setData({
disabled: false
})
})
}
})

View File

@@ -0,0 +1,5 @@
{
"usingComponents": {},
"navigationBarTitleText": "",
"navigationBarBackgroundColor": "#f7f6fa"
}

35
pages/register/index.wxml Normal file
View File

@@ -0,0 +1,35 @@
<image class="loginImg" src="/static/imgs/loginImg.png" mode="widthFix"></image>
<view class="loginTitle">
<image class="loginImg" src="/static/imgs/loginTitle.png" mode="widthFix"></image>
</view>
<form bindsubmit="registerForm" class="site-form">
<!-- 输入手机号相关 -->
<view class="inputs">
<input type="number" placeholder="请输入手机号" maxlength="11" bindinput="bindInput" />
</view>
<view class="inputs">
<input type="number" placeholder="请输入验证码" maxlength="4" name="code" class="inputs-sms" />
<button class="sms-btn" type="default" size="mini" disabled="{{phone == '' || smsDisabled}}" bindtap="getPhoneCode">{{codename}}</button>
</view>
<view class="inputs">
<input type="text" placeholder="密码须包含大小写最少8位" name="password" password="{{passwordState}}" />
<image class="inputs-see" bindtap="seeClick" src="{{seeState ? '/static/icons/see_active.png' : '/static/icons/see.png'}}" mode="aspectFill"></image>
</view>
<view class="inputs">
<input type="text" placeholder="密码须包含大小写最少8位" name="password_confirmation" password="{{passwordAgain}}" />
<image class="inputs-see" bindtap="seeAgain" src="{{againState ? '/static/icons/see_active.png' : '/static/icons/see.png'}}" mode="aspectFill"></image>
</view>
<button class="btn" type="default" form-type="submit">立即注册</button>
</form>
<view class="refertoEject {{successHide ? 'active' : ''}}" catchtouchmove='true'></view>
<view class="refertoCont {{successHide ? 'active' : ''}}" catchtouchmove='true'>
<view class="refertoWrite">
<image class="refertoCont-img" src="https://cdn.douhuofalv.com/images/2023/08/04/b099539e6c5d6d89b69516002412a4d9.png" mode="widthFix"></image>
<view class="refertoCont-name">
<view class="refertoCont-title">注册成功</view>
<view class="refertoCont-text">恭喜您成功注册,请登录绚火平台</view>
<navigator class="refertoCont-go" hover-class="none" open-type="redirect" url="/pages/login/index">立即登录</navigator>
</view>
</view>
</view>

158
pages/register/index.wxss Normal file
View File

@@ -0,0 +1,158 @@
page {
background-color: #f7f6fa;
}
.loginImg {
width: 100%;
}
.loginTitle {
width: 100%;
text-align: center;
padding: 0 50rpx;
box-sizing: border-box;
margin-top: -50rpx;
}
.site-form {
display: block;
padding: 50rpx 50rpx 20rpx;
box-sizing: border-box;
}
.inputs {
background: #edebf1;
border: none;
position: relative;
margin-bottom: 40rpx;
height: 100rpx;
line-height: 100rpx;
border-radius: 80rpx;
padding: 0 50rpx;
box-sizing: border-box;
display: flex;
position: relative;
}
.inputs input {
width: 100%;
height: 100rpx;
line-height: 100rpx;
border: none;
font-size: 32rpx;
}
.inputs-see {
position: absolute;
right: 50rpx;
top: 32rpx;
width: 38rpx;
height: 38rpx;
z-index: 9;
}
.sms-btn[size='mini'] {
font-weight: normal;
height: 100rpx;
line-height: 100rpx;
position: absolute;
top: 0;
right: 30rpx;
margin: 0;
border-radius: 0;
border-left: solid 1rpx #f2f2f2;
color: #da2b54 !important;
font-size: 32rpx;
background-color: transparent !important;
z-index: 9;
}
.btn {
background: #da2b54 !important;
width: 100% !important;
color: white !important;
border-radius: 100rpx;
font-size: 32rpx;
line-height: 100rpx;
height: 100rpx;
font-weight: bold;
font-weight: normal;
padding: 0;
}
.btn::after {
border: none;
}
.btn[disabled] {
background: #da2b54 !important;
}
/* 注册成功弹出 */
/* 弹出 */
.refertoEject {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
background-color: rgba(0, 0, 0, .7);
z-index: 1000;
display: none;
}
.refertoEject.active {
display: block;
}
.refertoCont {
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 10000;
padding: 0 15%;
box-sizing: border-box;
text-align: center;
display: none;
}
.refertoCont.active {
display: -webkit-box;
}
.refertoWrite {
background-color: white;
border-radius: 20rpx;
overflow: hidden;
}
.refertoCont-img {
width: 100%;
}
.refertoCont-name {
padding: 30rpx 0 40rpx;
}
.refertoCont-title {
color: #da2b54;
font-size: 40rpx;
}
.refertoCont-text {
padding: 20rpx 0 40rpx;
color: #999999;
}
.refertoCont-go {
background-color: #da2b54;
display: inline-block;
color: #ffffff;
line-height: 88rpx;
width: 80%;
border-radius: 80rpx;
}

72
pages/search/search.js Normal file
View File

@@ -0,0 +1,72 @@
/*
* 手太欠
* 肥督督商城
*/
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
searchHistory : []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
if (wx.getStorageSync('searchHistory')) {
this.setData({
searchHistory: wx.getStorageSync('searchHistory')
})
}
},
/**
* 搜索
*/
searchForm(e) {
// 存入历史搜索
let searchHistory = this.data.searchHistory,
searchValue = e.detail.value.search,
newsearchHistory
if (searchValue != '') {
searchHistory.push(searchValue)
newsearchHistory = Array.from(new Set(searchHistory))
// 写入缓存
wx.setStorageSync('searchHistory', newsearchHistory)
// 转跳搜索结果页
wx.navigateTo({
url: '/pages/mall/goods/goods?title=' + searchValue
})
}
},
/**
* 历史记录搜索
*/
bindSearch(e) {
wx.navigateTo({
url: '/pages/mall/goods/goods?title=' + e.currentTarget.dataset.value
})
},
/**
* 清理搜索结果
*/
removeSearchHistory() {
wx.removeStorage({
key: 'searchHistory',
success: res => {
if (res.errMsg == "removeStorage:ok") {
this.setData({
searchHistory: []
})
}
}
})
}
})

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

@@ -0,0 +1,4 @@
{
"usingComponents" : {},
"navigationBarTitleText": "商品搜索"
}

23
pages/search/search.wxml Normal file
View File

@@ -0,0 +1,23 @@
<!-- 搜索 -->
<view class="search">
<!-- search -->
<form bindsubmit="searchForm">
<view class="search-input">
<input class="search-navigator" placeholder="输入关键字" name="search" value="{{searchTitle}}" focus></input>
<button class="search-btn" form-type="submit">搜索</button>
</view>
</form>
</view>
<!-- 搜索历史 -->
<view class="search-history" wx:if="{{searchHistory != ''}}" style="padding-top: {{systemInfo.barHeight + 90}}px">
<view class="search-history-title">搜索历史
<text bindtap="removeSearchHistory">清理</text>
</view>
<view class="search-history-tag">
<view wx:for="{{searchHistory}}" wx:key="searchHistory" bindtap="bindSearch" data-value="{{item}}">{{item}}</view>
</view>
</view>
<view class="search-history-null" wx:else style="padding-top: {{systemInfo.barHeight + 90}}px">无历史搜索</view>

79
pages/search/search.wxss Normal file
View File

@@ -0,0 +1,79 @@
/* 搜索 */
.search {
padding: 30rpx;
box-sizing: border-box;
position: relative;
left: 0;
top: 0;
width: 100%;
background: #fff;
color: #999;
z-index: 999;
}
.search-input {
display: flex;
width: 100%;
height: 90rpx;
line-height: 90rpx;
background: #f7f7f7;
}
.search-input input {
padding: 0 30rpx;
box-sizing: border-box;
height: 90rpx;
color: #000;
font-size: 28rpx;
flex: 1;
width: calc(100% - 150rpx);
}
.search-btn {
font-size: 28rpx;
background: #f1f1f1;
color: #4c4c4c;
width: 150rpx !important;
padding: 0 !important;
line-height: 90rpx;
border-radius: 0;
}
.search-btn::after {
border: none;
}
/* 搜索历史 */
.search-history{
padding: 20rpx 20rpx 0 20rpx;
}
.search-history-title{
padding: 0 10rpx 20rpx 10rpx;
}
.search-history-title text{
float: right;
font-size: 26rpx;
color: #a2a7ba;
}
.search-history-tag{
overflow: hidden;
}
.search-history-tag view{
display: inline-block;
margin: 0 10rpx 20rpx 10rpx;
background: #f5f6fa;
padding: 10rpx 20rpx;
font-size: 26rpx;
}
.search-history-null{
text-align: center;
padding: 50rpx 0;
color: #747788;
}

179
pages/site/add/add.js Normal file
View File

@@ -0,0 +1,179 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
nameValue : '', // 姓名
mobile : '', // 电话
address : '', // 地址
isDefault : '', // 默认地址
// 省份选择
areasArr : [],
areaId : 0,
areaIndex : 0,
// 市级选择
cityArr : [],
cityId : 0,
cityIndex : 0,
// 区域选择
regiArr : [],
regiId : 0,
regiIndex : 0,
disabled : false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.setData({
experience: options.experience
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取省市区列表
this.createInfo();
},
/**
* 省市区列表
*/
createInfo() {
wx.$api.site.create().then(res => {
let areas = res.data,
areaIndex = this.data.areaIndex
this.setData({
areasArr : areas,
areaId : areas[areaIndex].id,
})
this.citylist(areas[areaIndex].id)
}).catch(err => {})
},
/**
* 所在省份-下拉
*/
areasChange(e) {
let area = this.data.areasArr,
index = e.detail.value,
atcode = area[index].id
if (index != this.data.areaIndex) {
this.setData({
areaIndex : index,
areaId : atcode
})
// 获取市级列表
this.citylist(atcode)
}
},
/**
* 市级列表
*/
citylist(cityId) {
wx.$api.site.create({
parent_id: cityId
}).then(res=>{
let cityArr = res.data
this.setData({
cityId : cityArr[0].id,
cityIndex : 0,
cityArr : cityArr
})
// 获取区级列表
this.regilist(cityArr[0].id)
})
},
/**
* 市级下拉筛选
*/
cityDrop(e) {
let city = this.data.cityArr,
index = e.detail.value,
citycode = city[index].id
if (index != this.data.cityIndex) {
this.setData({
cityIndex : index,
cityId : citycode
})
// 获取市级列表
this.regilist(citycode)
}
},
/**
* 区列表
*/
regilist(areaId) {
wx.$api.site.create({
parent_id: areaId
}).then(res=>{
this.setData({
regiArr : res.data,
regiId : res.data[0].id,
regiIndex : 0
})
})
},
/**
* 区下拉筛选
*/
regiDrop(e) {
let newIndex = e.detail.value
this.setData({
regiIndex : newIndex,
regiId : this.data.regiArr[newIndex].id
})
},
/*
姓名截取
*/
bindinput(e) {
this.setData({
nameValue: e.detail.value.substr(0,5)
})
},
// 提交表单
siteform(e) {
let value = e.detail.value
let data = {
name : this.data.nameValue,
mobile : value.mobile,
address : value.address,
province_id : this.data.areaId,
city_id : this.data.cityId,
district_id : this.data.regiId
}
this.setData({
disabled: true
})
wx.$api.site.siteAdd(data).then(res => {
wx.navigateBack()
}).catch(() =>{
this.setData({
disabled: false
})
})
}
})

4
pages/site/add/add.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "新增地址"
}

44
pages/site/add/add.wxml Normal file
View File

@@ -0,0 +1,44 @@
<form bindsubmit="siteform" class="site-form">
<view class="site-input">
<label>收货人</label>
<input placeholder="请输入收货人姓名" name="name" type="text" value="{{nameValue}}" bindinput="bindinput"></input>
</view>
<view class="site-input">
<label>手机号码</label>
<input placeholder="请输入手机号码" maxlength="11" name="mobile" type="number"></input>
</view>
<view class="site-input">
<label>所在省份</label>
<picker bindchange="areasChange" value="{{areaIndex}}" range="{{areasArr}}" range-key="name">
<view class="picker">
{{ areasArr[areaIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在城市</label>
<picker bindchange="cityDrop" value="{{cityIndex}}" range="{{cityArr}}" range-key="name" class="conneColor">
<view class="picker">
{{ cityArr[cityIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在区域</label>
<picker bindchange="regiDrop" value="{{regiIndex}}" range="{{regiArr}}" range-key="name" class="conneColor">
<view class="picker">
{{ regiArr[regiIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>收货地址</label>
<input placeholder="请输入详细地址" name="address"></input>
</view>
<view class="site-btn">
<button form-type="submit" size="mini" disabled="{{disabled}}">保存</button>
</view>
</form>

79
pages/site/add/add.wxss Normal file
View File

@@ -0,0 +1,79 @@
.site-form {
background: white;
display: block;
}
.site-input {
padding: 0 30rpx 0 200rpx;
position: relative;
line-height: 110rpx;
min-height: 110rpx;
border-bottom: 2rpx solid #f3f3f3;
}
.site-input::before {
position: absolute;
bottom: 0;
left: 30rpx;
right: 0;
height: 1rpx;
content: "";
background: #e4e6f2;
}
.site-input:last-child::before {
display: none;
}
.site-input label {
position: absolute;
left: 30rpx;
top: 0;
}
.site-input input {
height: 110rpx;
}
.site-input image {
width: 44rpx;
height: 44rpx;
position: absolute;
right: 20rpx;
top: calc(50% - 22rpx);
}
.site-btn {
padding: 20rpx 30rpx;
margin-top: 100rpx;
}
.site-btn button[size="mini"] {
width: 100%;
background: #e92152;
height: 88rpx;
line-height: 88rpx;
font-size: 30rpx;
color: white;
padding: 0;
}
.site-btn button[disabled] {
background: #e92152 !important;
color: #fff !important;
}
.site-switch {
font-size: 32rpx;
margin: 30rpx;
display: flex;
line-height: 40rpx;
}
.site-switch text {
flex: 1;
}
.site-switch-active {
color: #797979;
}

225
pages/site/edit/edit.js Normal file
View File

@@ -0,0 +1,225 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
data: {
addressId : '',
nameValue : '',
mobile : '',
address : '',
isDefault : '',
disabled : false,
//省份选择
areas : [],
areaId : '',
areaIndex : 0,
//市级选择
cityList : [],
cityId : 0,
cityIndex : 0,
//区域选择
regiList : [],
regiId : 0,
regiIndex : 0,
},
onLoad(options) {
this.setData({
addressId: options.addressid
})
},
onShow() {
// 获取收货人信息
this.getUserAddress()
},
/**
* 收货人信息
*/
getUserAddress(){
wx.$api.site.siteSee(this.data.addressId).then(res => {
let areasValue = res.data.provinces.findIndex(val=> val.name == res.data.province.name),
cityValue = res.data.cities.findIndex(val=> val.name == res.data.city.name),
regiValue = res.data.districts.findIndex(val=> val.name == res.data.district.name)
this.setData({
nameValue : res.data.name,
mobile : res.data.mobile,
areas : res.data.provinces,
cityList : res.data.cities,
regiList : res.data.districts,
areaIndex : areasValue,
cityIndex : cityValue,
regiIndex : regiValue,
areaId : res.data.province.region_id,
cityId : res.data.city.region_id,
regiId : res.data.district.region_id,
address : res.data.address,
isDefault : res.data.default
})
}).catch(err => {})
},
/**
* 省市区列表
*/
createInfo() {
wx.$api.site.create().then(res => {
let areas = res.data,
areaIndex = this.data.areaIndex
this.setData({
areas : areas,
areaId : areas[areaIndex].id,
})
this.citylist(areas[areaIndex].id)
}).catch(err => {})
},
/**
* 所在省份-下拉
*/
areasChange(e) {
let area = this.data.areas,
index = e.detail.value,
atcode = area[index].id
if (index != this.data.areaIndex) {
this.setData({
areaIndex : index,
areaId : atcode
})
// 获取市级列表
this.citylist(atcode)
}
},
/**
* 市级列表
*/
citylist(cityId) {
wx.$api.site.create({
parent_id: cityId
}).then(res=>{
let cityArr = res.data
this.setData({
cityId : cityArr[0].id,
cityIndex : 0,
cityList : cityArr
})
// 获取区级列表
this.regilist(cityArr[0].id)
})
},
/**
* 市级下拉筛选
*/
cityDrop(e) {
let city = this.data.cityList,
index = e.detail.value,
citycode = city[index].id
if (index != this.data.cityIndex) {
this.setData({
cityIndex : index,
cityId : citycode
})
// 获取区列表
this.regilist(citycode)
}
},
/**
* 区列表
*/
regilist(areaId) {
wx.$api.site.create({
parent_id: areaId
}).then(res=>{
this.setData({
regiList : res.data,
regiId : res.data[0].id,
regiIndex : 0
})
})
},
/**
* 区下拉筛选
*/
regiDrop(e) {
let newIndex = e.detail.value
this.setData({
regiIndex : newIndex,
regiId : this.data.regiList[newIndex].id
})
},
/**
* 默认地址
*/
addressDefault() {
wx.$api.site.siteDefault(this.data.addressId).then(res => {
this.setData({
isDefault: !this.data.isDefault
})
}).catch(err => {})
},
/*
姓名截取
*/
bindinput(e) {
this.setData({
nameValue: e.detail.value.substr(0,5)
})
},
/**
* 提交表单
*/
siteform(e) {
let value = e.detail.value
let data = {
name : this.data.nameValue,
mobile : value.mobile,
address : value.address,
province_id : this.data.areaId,
city_id : this.data.cityId,
district_id : this.data.regiId,
is_default : this.data.isDefault
}
wx.$api.site.siteEdit(this.data.addressId, data).then(res => {
this.setData({
disabled: true
})
wx.navigateBack()
}).catch(err => {})
},
/**
* 删除地址
*/
addressRemove(){
wx.showModal({
title : '提示',
content : '是否删除地址',
success : res=> {
if (res.confirm) {
wx.showLoading({
title: '删除中',
})
wx.$api.site.siteDel(this.data.addressId).then(res=>{
wx.navigateBack()
})
}
}
})
},
})

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "编辑地址"
}

52
pages/site/edit/edit.wxml Normal file
View File

@@ -0,0 +1,52 @@
<form bindsubmit="siteform" class="site-form">
<view class="site-input">
<label>收货人</label>
<input placeholder="请输入收货人姓名" name="name" value="{{nameValue}}" type="text" bindinput="bindinput"></input>
</view>
<view class="site-input">
<label>手机号码</label>
<input placeholder="请输入手机号码" maxlength="11" name="mobile" type="number" value="{{mobile}}"></input>
</view>
<view class="site-input">
<label>所在省份</label>
<picker bindchange="areasChange" value="{{areaIndex}}" range="{{areas}}" range-key="name" name="region_id">
<view class="picker">
{{ areas[areaIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在城市</label>
<picker bindchange="cityDrop" value="{{cityIndex}}" range="{{cityList}}" range-key="name" class="conneColor" name="city_id">
<view class="picker">
{{ cityList[cityIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>所在区域</label>
<picker bindchange="regiDrop" value="{{regiIndex}}" range="{{regiList}}" range-key="name" class="conneColor" name="district_id">
<view class="picker">
{{ regiList[regiIndex].name }}
</view>
<image src="/static/icons/orderArrow.png"></image>
</picker>
</view>
<view class="site-input">
<label>收货地址</label>
<input placeholder="请输入详细地址" name="address" value="{{address}}"></input>
</view>
<view class="site-switch">
<text>设置默认地址</text>
<switch style='zoom:.6;' bindchange="addressDefault" color="#ff9951" checked="{{isDefault}}" />
</view>
<view class="site-del" bindtap="addressRemove">
<image class="site-del-img" src="/static/icons/siteDel.png"></image>
<text>删除地址</text>
</view>
<view class="site-btn">
<button form-type="submit" size="mini" disabled="{{disabled}}">保存</button>
</view>
</form>

99
pages/site/edit/edit.wxss Normal file
View File

@@ -0,0 +1,99 @@
.site-form {
background: white;
display: block;
}
.site-input {
padding: 0 30rpx 0 200rpx;
position: relative;
line-height: 110rpx;
min-height: 110rpx;
}
.site-input::before {
position: absolute;
bottom: 0;
left: 30rpx;
right: 0;
height: 1rpx;
content: "";
background: #e4e6f2;
}
.site-input:last-child::before {
display: none;
}
.site-input label {
position: absolute;
left: 30rpx;
top: 0;
}
.site-input input {
height: 110rpx;
}
.site-input image {
width: 44rpx;
height: 44rpx;
position: absolute;
right: 20rpx;
top: calc(50% - 22rpx);
}
.site-btn {
padding: 20rpx 30rpx;
margin-top: 100rpx;
}
.site-btn button[size="mini"] {
width: 100%;
background: #e92152;
height: 88rpx;
line-height: 88rpx;
font-size: 30rpx;
color: white;
padding: 0;
}
.site-btn button[disabled] {
background: #e92152 !important;
color: #fff !important;
}
.site-switch {
font-size: 32rpx;
margin: 30rpx;
display: flex;
line-height: 40rpx;
}
.site-switch text {
flex: 1;
}
.site-switch-active {
color: #797979;
}
.site-del {
width: 100%;
text-align: center;
margin-top: 40rpx;
padding-top: 60rpx;
border-top: 2rpx solid rgb(228, 230, 242);
color: #ff9951;
}
.site-del-btn {
text-align: center;
}
.site-del-img {
width: 46rpx;
height: 46rpx;
display: inline-block;
vertical-align: -10rpx;
margin-right: 5rpx;
}

76
pages/site/index.js Normal file
View File

@@ -0,0 +1,76 @@
/*
* 手太欠
* 愿这世界都如故事里一样 美好而动人~
*/
Page({
/**
* 页面的初始数据
*/
data: {
type : '', //类型
listArr : [] //收货地址
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if(options) {
this.setData({
type: options.type
})
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取地址列表
this.listInfo();
},
/**
* 地址列表
*/
listInfo (){
wx.$api.site.siteList().then(res => {
this.setData({
listArr: res.data
})
}).catch(err => { })
},
/**
* 选择地址
*/
selectAddress(e){
let atAdds = this.data.listArr[e.currentTarget.dataset.index]
let pages = getCurrentPages(),
prepage = pages[pages.length-2]
if(this.data.type == 'goodsAddress') {
prepage.setData({
address: atAdds,
addressId: atAdds.address_id
})
wx.navigateBack()
return
}
prepage.setData({
address: atAdds
})
wx.navigateBack()
},
/**
* 编辑地址
*/
addressEdit(e) {
wx.navigateTo({
url: './edit/edit?addressid=' + e.currentTarget.dataset.id,
})
},
})

4
pages/site/index.json Normal file
View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "地址管理"
}

37
pages/site/index.wxml Normal file
View File

@@ -0,0 +1,37 @@
<view class="list" wx:if="{{listArr.length > 0}}">
<view class="address" wx:for="{{listArr}}" wx:key="listArr">
<!-- "hover-class="none" url="./edit/edit?id={{item.address_id}} -->
<view class="address-top">
<view class="address-img">
<image src="/static/icons/siteIcon.png" mode="aspectFill"></image>
</view>
<view class="address-cont">
<view class="address-cont-title">
<view class="address-cont-name">
{{item.name}}
</view>
<view class="address-cont-mobile">
{{item.mobile}}
</view>
<view class="address-cont-default" wx:if="{{item.default}}">
默认
</view>
</view>
<view class="nowrap-multi address-cont-text">{{item.full_address}}</view>
</view>
<image src="/static/icons/siteEdit.png" bindtap="addressEdit" data-id="{{item.address_id}}" class="address-btn"></image>
</view>
<view class="select" wx:if="{{type == 'selectAddress' || type == 'goodsAddress'}}">
<view class="select-btn" bindtap="selectAddress" data-index="{{index}}">
选择地址
</view>
</view>
</view>
</view>
<view class="pack-center pages-hint" wx:else>
<image src="/static/imgs/cont_null.png"></image>
<view>暂无收货地址</view>
</view>
<view class="footer">
<navigator hover-class="none" url="./add/add" class="btn">添加收货地址</navigator>
</view>

116
pages/site/index.wxss Normal file
View File

@@ -0,0 +1,116 @@
page{
background-color: #f4f4f6;
}
.list {
border-bottom: 90px solid transparent;
padding: 30rpx;
box-sizing: border-box;
}
.address {
background-color: #FFFFFF;
margin-bottom: 30rpx;
padding: 30rpx;
box-sizing: border-box;
border-radius: 10rpx;
}
.address:last-child {
margin-bottom: 0;
}
.address-top {
display: flex;
}
.address-img {
background-color: #eeeeee;
border-radius: 50%;
width: 60rpx;
height: 60rpx;
padding: 10rpx;
box-sizing: border-box;
margin-top: 25rpx;
}
.address-img image {
width: 100%;
height: 100%;
}
.address-btn {
width: 40rpx;
height: 40rpx;
margin-top: 62rpx;
}
.address-cont {
width: calc(100% - 102rpx);
padding: 0 30rpx;
box-sizing: border-box;
}
.address-cont-title {
display: flex;
margin-bottom: 20rpx;
line-height: 44rpx;
}
.address-cont-mobile {
margin: 0 20rpx;
color: rgb(104, 104, 104);
}
.address-cont-default {
background-color: #ff9951;
color: #FFFFFF;
font-size: 24rpx;
border-radius: 40rpx;
padding: 0 15rpx;
height: 38rpx;
line-height: 38rpx;
margin-top: 2rpx;
}
.address-cont-text {
line-height: 42rpx;
font-size: 28rpx;
}
.select {
text-align: right;
padding-top: 30rpx;
}
.select-btn {
border: 2rpx solid #e92152;
color: #ff9951;
display: inline-block;
font-size: 28rpx;
padding: 0 30rpx;
line-height: 54rpx;
border-radius: 5rpx;
}
/* 按钮 */
.footer {
width: 100%;
height: 90px;
background-color: #FFFFFF;
position: fixed;
left: 0;
bottom: 0;
z-index: 9;
padding: 20px;
box-sizing: border-box;
}
.btn {
line-height: 50px;
background-color: #e92152;
height: 100%;
text-align: center;
color: #FFFFFF;
border-radius: 10rpx;
}

66
pages/user/about/about.js Normal file
View File

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

View File

@@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "关于我们"
}

View File

@@ -0,0 +1,3 @@
<view class="about">
<image src="https://cdn.douhuofalv.com/images/2023/08/07/cb93881489af4532322ead5fabd36b0d.png" mode="widthFix"></image>
</view>

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