diff --git a/README.md b/README.md
index 7008566..f5bcb37 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,417 @@
-#酒店桌布小程序
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+# 商城项目文档
+
+## 项目概述
+本项目是一个基于uni-app开发的商城小程序,采用Vue框架开发,集成了完整的商城功能模块。
+
+## 目录结构
+```
+├── api # API接口目录
+│ ├── api.js # API统一出口
+│ ├── http.js # HTTP请求封装
+│ └── model # 业务模块API
+├── components # 公共组件
+├── mixins # 混入文件
+├── pages # 页面文件
+├── static # 静态资源
+├── store # Vuex状态管理
+├── utils # 工具函数
+└── uni_modules # uni-app插件模块
+```
+
+## 分包结构说明
+
+### pages_order分包
+分包是小程序优化加载性能的重要手段,pages_order作为独立分包,包含以下模块:
+
+```
+├── auth # 认证相关页面
+│ ├── loginAndRegisterAndForgetPassword.vue # 登录注册
+│ ├── wxLogin.vue # 微信登录
+│ └── wxUserInfo.vue # 微信用户信息
+├── components # 分包内公共组件
+│ ├── address/ # 地址选择组件
+│ ├── areaSelector/ # 区域选择器
+│ └── product/ # 商品相关组件
+├── home # 首页相关
+│ ├── addEnterprise.vue # 添加企业
+│ ├── contact.vue # 联系我们
+│ ├── introduce.vue # 介绍页面
+│ ├── journalism.vue # 新闻资讯
+│ └── notice.vue # 公告
+├── mine # 我的模块
+│ ├── address.vue # 收货地址
+│ ├── balance.vue # 余额
+│ ├── commission.vue # 佣金
+│ ├── coupon.vue # 优惠券
+│ ├── memberCenter.vue # 会员中心
+│ └── more... # 更多功能页面
+├── order # 订单模块
+│ ├── createOrder.vue # 创建订单
+│ ├── orderDetail.vue # 订单详情
+│ └── giftList.vue # 礼品列表
+├── product # 商品模块
+│ └── productDetail.vue # 商品详情
+└── static # 分包静态资源
+ ├── address/ # 地址相关图片
+ ├── auth/ # 认证相关图片
+ ├── coupon/ # 优惠券图片
+ └── more... # 其他静态资源
+```
+
+**分包特点:**
+- 静态资源就近原则:分包相关的图片等静态资源存放在分包目录下,避免主包体积过大
+- 模块化组织:按功能模块划分目录,便于维护和管理
+- 组件复用:分包内的通用组件集中管理,提高代码复用性
+
+## 配置文件说明
+
+### config.js
+项目核心配置文件,包含以下配置:
+
+**1. 环境配置**
+```javascript
+// 当前环境
+const type = 'prod'
+
+// 环境配置
+const config = {
+ dev: {
+ baseUrl: 'http://h5.xzaiyp.top/jewelry-admin',
+ },
+ prod: {
+ baseUrl: 'https://jewelry-admin.hhlm1688.com/jewelry-admin',
+ }
+}
+```
+
+**2. 默认配置**
+```javascript
+const defaultConfig = {
+ // 腾讯地图Key
+ mapKey: 'XMBBZ-BCPCV-SXPPQ-5Y7MY-PHZXK-YFFVU',
+ // 阿里云OSS配置
+ aliOss: {
+ url: 'https://image.hhlm1688.com/',
+ config: {
+ region: 'oss-cn-guangzhou',
+ accessKeyId: '***',
+ accessKeySecret: '***',
+ bucket: 'hanhaiimage',
+ endpoint: 'oss-cn-shenzhen.aliyuncs.com',
+ }
+ }
+}
+```
+
+**3. UI框架配置**
+```javascript
+uni.$uv.setConfig({
+ config: {
+ unit: 'rpx' // 设置默认单位
+ },
+})
+
+// UI文档地址 https://www.uvui.cn/
+```
+
+## 核心模块详解
+
+### 1. Mixins 混入
+
+#### 1.1 list.js - 列表数据加载混入
+提供列表数据的加载、分页、下拉刷新、上拉加载更多等功能。
+
+**主要功能:**
+- 统一的分页参数处理
+- 下拉刷新和上拉加载更多
+- 数据加载状态管理
+
+**使用示例:**
+```javascript
+// 在页面中使用list混入
+import listMixin from '@/mixins/list.js'
+
+export default {
+ mixins: [listMixin],
+ data() {
+ return {
+ // 指定API接口
+ mixinsListApi: 'productList'
+ }
+ }
+}
+```
+
+#### 1.2 configList.js - 全局配置混入
+已全局引入的配置管理混入,无需手动引入即可使用。
+
+**主要功能:**
+- 统一的分享配置
+- 全局配置管理
+- 用户信息关联
+
+**配置参数:**
+```javascript
+// 分享配置示例
+this.Gshare.title = '分享标题'
+this.Gshare.path = '分享路径'
+```
+
+### 2. API 模块
+
+#### 2.1 http.js - 请求封装
+统一的HTTP请求处理,包含:
+- 请求拦截器
+- 响应拦截器
+- 统一的错误处理
+- Token管理
+
+#### 2.2 api.js - 接口管理
+统一管理API接口,支持模块化组织。API模块采用分层结构,便于维护和扩展。
+
+**目录结构:**
+```
+api/
+├── api.js # API统一出口
+├── http.js # HTTP请求封装
+└── model/ # 业务模块API
+ ├── product.js # 商品相关接口
+ ├── order.js # 订单相关接口
+ └── user.js # 用户相关接口
+```
+
+**接口定义示例:**
+```javascript
+// api/model/product.js
+export default {
+ // GET请求示例
+ list: {
+ url: '/api/product/list',
+ method: 'GET',
+ loading: true // 显示加载提示
+ },
+
+ // POST请求示例
+ create: {
+ url: '/api/product/create',
+ method: 'POST',
+ loading: true // 显示加载提示
+ auth : true,//效验登录
+ debounce : 1000,//接口防抖,1s
+ limit : 500,//接口限流,0.5s
+ },
+}
+```
+
+**调用接口示例:**
+```javascript
+// 第一种写法:callback方式处理响应
+this.$api('product.list', {
+ pageNo: 1,
+ pageSize: 10,
+ categoryId: '123'
+}, res => {
+ // 处理列表数据
+})
+
+// 第二种写法:Promise方式处理响应
+this.$api('product.create', {
+ name: '商品名称',
+ price: 99.99,
+ description: '商品描述'
+}).then(res => {
+ if (res.code === 200) {
+ // 创建成功
+ uni.showToast({ title: '创建成功' })
+ }
+})
+```
+
+
+### 3. 公共代码
+
+#### 3.1 工具函数 (utils)
+- authorize.js: 授权处理
+- pay.js: 微信网页支付相关
+- utils.js: 通用工具函数
+- timeUtils.js: 时间处理
+- position.js: 定位与位置计算
+- oss-upload: 阿里云OSS上传模块
+
+
+**使用示例:**
+```javascript
+
+// 授权处理
+async preservationImg(img) {
+ await this.$authorize('scope.writePhotosAlbum')
+ //在执行$authorize之后,await下面的代码都是确保授权完成的情况下执行
+},
+
+// 时间格式化
+const formattedTime = this.$timeUtils.formatTime(new Date())
+
+// 项目中在Vue集成了dayjs >>,可以直接使用
+// 在utils/index中Vue.prototype.$dayjs
+this.$dayjs()
+
+// 微信网页支付调用
+import { wxPay } from '@/utils/pay'
+wxPay(orderData)
+```
+
+#### 3.2 公共组件
+- navbar.vue: 自定义导航栏
+- tabbar.vue: 底部导航栏
+- productItem.vue: 商品列表项
+
+**使用示例:**
+```html
+
+
+
+
+
+
+```
+
+
+#### 3.3 OSS上传模块
+
+**配置说明:**
+项目使用阿里云OSS进行文件存储,相关配置位于config.js中:
+
+
+**使用示例:**
+
+1. 单文件上传
+```javascript
+export default {
+ methods: {
+ onUpload(file) {
+ this.$Oss.ossUpload(file.path).then(url => {
+ this.filePath = url
+ })
+ }
+ }
+}
+```
+
+2. 在uv-upload组件中使用
+```html
+
+
+
+
+
+```
+
+**注意事项:**
+1. 上传前请确保OSS配置正确
+2. 建议对上传文件大小进行限制
+3. 支持的文件类型:图片、视频、文档等
+4. 上传失败时会抛出异常,请做好错误处理
+
+## 最佳实践
+
+### 1. 列表页面开发
+```javascript
+// pages/product/list.vue
+import listMixin from '@/mixins/list.js'
+
+export default {
+ mixins: [listMixin],
+ data() {
+ return {
+ mixinsListApi: 'productList',
+ }
+ },
+ methods: {
+ // 分类切换
+ onCategoryChange(categoryId) {
+ this.queryParams.categoryId = categoryId
+ this.getData()
+ }
+ }
+}
+```
+
+### 2. 详情页面开发
+```javascript
+// pages/product/detail.vue
+import configMixin from '@/mixins/configList.js'
+
+export default {
+ mixins: [configMixin],
+ data() {
+ return {
+ productId: '',
+ detail: {}
+ }
+ },
+ onLoad(options) {
+ this.productId = options.id
+ this.getDetail()
+ },
+ methods: {
+ getDetail() {
+ this.$api('productDetail', {
+ id: this.productId
+ }, res => {
+ this.detail = res.result
+ // 设置分享信息
+ this.Gshare.title = this.detail.name
+ this.Gshare.path = `/pages/product/detail?id=${this.productId}`
+ })
+ }
+ }
+}
+```
+
+## 注意事项
+1. 使用mixins时注意命名冲突
+2. API调用建议统一使用this.$api方式
+3. 页面开发建议继承相应的混入来复用通用功能
+
+## 常见问题
+1. 列表加载失败
+ - 检查mixinsListApi是否正确配置
+ - 确认网络请求是否正常
+ - 查看请求参数格式是否正确
+
diff --git a/api/api.js b/api/api.js
index 9301696..d566315 100644
--- a/api/api.js
+++ b/api/api.js
@@ -5,7 +5,7 @@ import utils from '../utils/utils.js'
let limit = {}
let debounce = {}
-const models = []
+const models = ['login', 'index', 'vip', 'info']
const config = {
// 示例
@@ -14,7 +14,7 @@ const config = {
// limit : 1000
// },
- getConfig : {url : '/api/getConfig', method : 'GET', limit : 500},
+ getConfig : {url : '/config_common/getConfig', method : 'GET', limit : 500},
}
@@ -22,8 +22,8 @@ export function api(key, data, callback, loadingTitle) {
let req = config[key]
if (!req) {
- console.error('无效key--------' + key);
- return
+ console.error('无效key' + key);
+ return Promise.reject()
}
if (typeof callback == 'string') {
@@ -40,7 +40,7 @@ export function api(key, data, callback, loadingTitle) {
let storageKey = req.url
let storage = limit[storageKey]
if (storage && new Date().getTime() - storage < req.limit) {
- return
+ return Promise.reject()
}
limit[storageKey] = new Date().getTime()
}
@@ -49,8 +49,8 @@ export function api(key, data, callback, loadingTitle) {
if (req.auth) {
if (!uni.getStorageSync('token')) {
utils.toLogin()
- console.error('需要登录')
- return
+ console.error('需要登录', req.url)
+ return Promise.reject()
}
}
@@ -74,19 +74,22 @@ export function api(key, data, callback, loadingTitle) {
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}, req.debounce)
- return
+ return Promise.reject()
}
- http.http(req.url, data, callback, req.method,
+ return http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}
-
function addApiModel(model, key){
for(let k in model){
if(config[`${k}`]){
console.error(`重名api------model=${key},key=${k}`);
+ uni.showModal({
+ title: `重名api`,
+ content: `model=${key},key=${k}`
+ })
continue
}
config[`${k}`] = model[k]
@@ -98,4 +101,5 @@ models.forEach(key => {
addApiModel(require(`./model/${key}.js`).default, key)
})
+
export default api
\ No newline at end of file
diff --git a/api/http.js b/api/http.js
index 3c18457..6c3da63 100644
--- a/api/http.js
+++ b/api/http.js
@@ -1,7 +1,7 @@
import Vue from 'vue'
import utils from '../utils/utils.js'
-
+import store from '../store/store.js'
function http(uri, data, callback, method = 'GET', showLoading, title) {
@@ -11,16 +11,23 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
});
}
+ let reject, resolve;
+
+ let promise = new Promise((res, rej) => {
+ reject = rej
+ resolve = res
+ })
+
uni.request({
url: Vue.prototype.$config.baseUrl + uri,
- data: enhanceData(data),
+ data,
method: method,
header: {
'X-Access-Token': uni.getStorageSync('token'),
- 'Content-Type' : method == 'POST' ? 'application/x-www-form-urlencoded' : 'application/json'
+ 'Content-Type' : 'application/x-www-form-urlencoded'
},
success: (res) => {
-
+ // console.log(res,'res')
if(showLoading){
uni.hideLoading();
}
@@ -28,12 +35,13 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
if(res.statusCode == 401 ||
res.data.message == '操作失败,token非法无效!' ||
res.data.message == '操作失败,用户不存在!'){
- uni.removeStorageSync('token')
+ store.commit('logout')
console.error('登录过期');
utils.toLogin()
}
- if(res.statusCode == 200 && res.data.code != 200){
+ if(res.statusCode == 200 && res.data.code != 200
+ && res.data.code != 902){
uni.showToast({
mask: true,
duration: 1000,
@@ -42,10 +50,12 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
});
}
- callback(res.data)
+ callback && callback(res.data)
+ resolve(res.data)
},
fail: () => {
+ reject('api fail')
uni.showLoading({})
setTimeout(()=>{
uni.hideLoading()
@@ -57,79 +67,11 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
}
}
});
+
+ return promise
}
-function deleted(uri, data, callback) {
- http(uri, data, callback, 'DELETE')
-}
-
-function post(uri, data, callback) {
- http(uri, data, callback, 'POST')
-}
-
-function get(uri, data, callback) {
- http(uri, data, callback, 'GET')
-}
-
-function enhanceData(data) {
- const userid = uni.getStorageSync("userid")
- if (!data) {
- data = {}
- }
- if (userid) {
- data.userid = userid
- }
- return data
-}
-
-
-
-
-
-function sync(method, uri, data) {
- return new Promise((resolve, reject) => {
- uni.request({
- url: uri,
- data: data,
- method: method,
- header: {
- 'auth': '1AS9F1HPC4FBC9EN00J7KX2L5RJ99XHZ'
- },
- success: (res) => {
- resolve(res.data)
- },
- fail: (err) => {
- reject(err);
- }
- })
- })
-}
-
-
-let cache = null
-
-function async (method, uri, data) {
- const promise = sync(method, uri, data).then(res => {
- cache = res
- }).catch(err => {
-
- })
-}
-
-
-function syncHttp(uri, data, method = 'GET') {
- async (method, uri, data)
-}
-
-
-
-
-
export default {
http: http,
- delete: deleted,
- post: post,
- get: get,
- syncHttp: syncHttp
}
\ No newline at end of file
diff --git a/api/model/index.js b/api/model/index.js
new file mode 100644
index 0000000..3bd6c97
--- /dev/null
+++ b/api/model/index.js
@@ -0,0 +1,215 @@
+// 首页相关接口
+
+const api = {
+ // 获取首页轮播图
+ getRiceBanner: {
+ url: '/index_common/getRiceBanner',
+ method: 'GET',
+ },
+ // 获取首页常规产品【废弃】
+ // getRiceCommonProductList: {
+ // url: '/index_common/getRiceCommonProductList',
+ // method: 'GET',
+ // },
+ // 获取首页跳转图标
+ getRiceIconList: {
+ url: '/index_common/getRiceIconList',
+ method: 'GET',
+ },
+ // 获取首页新闻详情
+ getRiceNewsDetail: {
+ url: '/index_common/getCommonNewsDetail',
+ method: 'GET',
+ },
+ // 获取首页新闻列表
+ getRiceNewsList: {
+ url: '/index_common/getRiceNewsList',
+ method: 'GET',
+ },
+ // 获取首页公告列表
+ getRiceNoticeList: {
+ url: '/index_common/getRiceNoticeList',
+ method: 'GET',
+ },
+ // 获取首页商品详情
+ getRiceProductDetail: {
+ url: '/index_common/getRiceProductDetail',
+ method: 'GET',
+ },
+ // 获取首页体验产品
+ getRiceProductList: {
+ url: '/index_common/getRiceProductList',
+ method: 'GET',
+ },
+ // 查询分类接口
+ getCategoryList: {
+ url: '/index_common/getCategoryList',
+ method: 'GET',
+ },
+ // 新查询分类以及商品数据接口
+ getCategoryPidList: {
+ url: '/index_common/getCategoryPidList',
+ method: 'GET',
+ debounce : 250,
+ },
+ // 查询一级分类接口
+ getPidList: {
+ url: '/index_common/getCategoryPidList',
+ method: 'GET',
+ },
+ // 获取分类分页商品列表接口
+ getClassShopPageList: {
+ url: '/index_common/getClassShopPageList',
+ method: 'GET',
+ },
+ // 加入购物车
+ addCart: {
+ url: '/index_common/addCart',
+ method: 'GET',
+ auth: true,
+ showLoading: true,
+ limit : 500,
+ },
+ // 删除购物车信息
+ deleteCart: {
+ url: '/index_common/deleteCart',
+ method: 'DELETE',
+ auth: true,
+ showLoading: true,
+ },
+ // 修改购物车信息数量
+ updateCartNum: {
+ url: '/index_common/updateCartNum',
+ method: 'POST',
+ auth: true,
+ debounce: 300,
+ },
+ // 创建订单
+ createOrder: {
+ url: '/index_common/createOrder',
+ method: 'GET',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 创建订单-再次支付
+ createOrderTwo: {
+ url: '/index_common/createOrderTwo',
+ method: 'GET',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 多商品创建订单
+ createSumOrder: {
+ url: '/index_common/createSumOrder',
+ method: 'POST',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 多商品订单再次支付
+ createSumOrderAgain: {
+ url: '/index_common/createSumOrderAgain',
+ method: 'POST',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 确认收货
+ confirmOrder: {
+ url: '/index_common/confirmOrder',
+ method: 'GET',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 取消订单
+ cancelOrder: {
+ url: '/index_common/cancelOrder',
+ method: 'GET',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 获取首页广告列表
+ getRiceProductList: {
+ url: '/index_common/getRiceAdList',
+ method: 'GET',
+ },
+ // 获取首页广告列表
+ getRiceAdDetail: {
+ url: '/index_common/getRiceAdDetail',
+ method: 'GET',
+ },
+ //获取优惠券信息
+ getRiceCouponList: {
+ url: '/info_common/getRiceCouponList',
+ method: 'GET',
+ },
+ //增加或者修改合伙人申请信息
+ addOrUpdateCommonUser: {
+ url: '/index_common/addOrUpdateCommonUser',
+ method: 'POST',
+ },
+ //根据用户查询渠合伙人申请信息表单
+ getCommonUser: {
+ url: '/index_common/getCommonUser',
+ method: 'GET'
+ },
+ //提交反馈信息
+ addFeedback: {
+ url: '/info_common/addFeedback',
+ method: 'POST'
+ },
+ // 获取我的直接推荐间接推荐用户列表带分页
+ getHanHaiMemberUser: {
+ url: '/info_common/getHanHaiMemberUser',
+ method: 'GET'
+ },
+ // 获取祝福背景图
+ getRiceBlessing: {
+ url: '/index_common/getRiceBlessing',
+ method: 'GET'
+ },
+ // 随机获取祝福语
+ getRiceBlessingWords: {
+ url: '/index_common/getRiceBlessingWords',
+ method: 'GET'
+ },
+ // 根据订单标识修改订单祝福语背景
+ updateOrderBlessing: {
+ url: '/index_common/updateOrderBlessing',
+ method: 'POST',
+ auth : true,
+ limit : 1000,
+ },
+ // 1.收礼流程 =》点击收礼
+ getGiveShop: {
+ url: '/index_common/getGiveShop',
+ method: 'GET',
+ auth : true,
+ limit : 1000,
+ },
+ // 2.点击抽奖 =》抽奖
+ getGiveShopLottery: {
+ url: '/index_common/getGiveShopLottery',
+ method: 'GET',
+ auth : true,
+ limit : 1000,
+ },
+ // 获取我的礼品订单
+ getMyGiftOrder: {
+ url: '/index_common/getMyGiftOrder',
+ method: 'GET',
+ auth : true,
+ },
+ // 获取我的礼品订单详情
+ getMyGiftOrderDetail: {
+ url: '/index_common/getMyGiftOrderDetail',
+ method: 'GET',
+ auth : true,
+ },
+}
+
+export default api
\ No newline at end of file
diff --git a/api/model/info.js b/api/model/info.js
new file mode 100644
index 0000000..a695abd
--- /dev/null
+++ b/api/model/info.js
@@ -0,0 +1,115 @@
+// 个人相关接口
+
+const api = {
+ // 充值
+ recharge: {
+ url: '/info_common/withdraw',
+ method: 'GET',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 提现
+ withdraw: {
+ url: '/info_common/withdraw',
+ method: 'GET',
+ auth: true,
+ limit: 1000,
+ showLoading: true,
+ },
+ // 获取地址列表带分页
+ getAddressPageList: {
+ url: '/info_common/getAddressPageList',
+ method: 'GET',
+ auth: true,
+ },
+ // 增加或修改地址信息
+ addOrUpdateAddress: {
+ url: '/info_common/addOrUpdateAddress',
+ method: 'POST',
+ limit: 500,
+ auth: true,
+ showLoading: true,
+ },
+ // 删除地址
+ deleteAddress: {
+ url: '/info_common/deleteAddress',
+ method: 'GET',
+ limit: 500,
+ auth: true,
+ showLoading: true,
+ },
+ // 修改默认地址
+ updateDefaultAddress: {
+ url: '/info_common/updateDefaultAddress',
+ method: 'GET',
+ auth: true,
+ limit: 1000,
+ },
+ // 获取粉丝列表带分页
+ getFansPageList: {
+ url: '/info_common/getFansPageList',
+ method: 'GET',
+ auth: true,
+ },
+ // 获取相关介绍
+ getInfoIntroduce: {
+ url: '/info_common/getInfoIntroduce',
+ method: 'GET',
+ auth: true,
+ },
+ // 获取个人邀请码
+ getInviteCode: {
+ url: '/info_common/getInviteCode',
+ method: 'GET',
+ auth: true,
+ },
+ // 获取订单列表带分页
+ getOrderPageList: {
+ url: '/info_common/getOrderPageList',
+ method: 'GET',
+ auth: true,
+ },
+ // 获取订单详情
+ getOrderDetail: {
+ url: '/info_common/getOrderDetail',
+ method: 'GET',
+ auth: true,
+ },
+ // 获取流水记录带分页
+ getWaterPageList: {
+ url: '/info_common/getWaterPageList',
+ method: 'GET',
+ auth: true,
+ },
+ // 获取相关介绍
+ getInfoIntroduce: {
+ url: '/info_common/getInfoIntroduce',
+ method: 'GET',
+ },
+ // 获取相关介绍详情
+ getInfoIntroduceDetail: {
+ url: '/info_common/getRiceNewsDetail',
+ method: 'GET',
+ },
+ // 查询个人信息相关
+ getRiceInfo: {
+ url: '/info_common/getRiceInfo',
+ method: 'GET',
+ limit: 500,
+ },
+ // 获取购物车信息列表带分页
+ getCartPageList: {
+ url: '/info_common/getCartPageList',
+ method: 'GET',
+ },
+ // 领取新人优惠券
+ getRiceCoupon: {
+ url: '/info_common/getRiceCoupon',
+ method: 'GET',
+ limit: 500,
+ auth: true,
+ },
+}
+
+export default api
\ No newline at end of file
diff --git a/api/model/login.js b/api/model/login.js
index cb3cbc8..c818a04 100644
--- a/api/model/login.js
+++ b/api/model/login.js
@@ -10,6 +10,12 @@ const api = {
limit : 500,
showLoading : true,
},
+ // 获取绑定手机号码
+ bindPhone: {
+ url: '/login_common/bindPhone',
+ method: 'GET',
+ auth: true,
+ },
// 修改个人信息接口
updateInfo: {
url: '/info_common/updateInfo',
@@ -24,16 +30,6 @@ const api = {
method: 'GET',
auth: true,
},
- //隐私政策
- getPrivacyPolicy: {
- url: '/login/getPrivacyPolicy',
- method: 'GET',
- },
- //用户协议
- getUserAgreement: {
- url: '/login/getUserAgreement',
- method: 'GET',
- },
}
export default api
\ No newline at end of file
diff --git a/api/model/vip.js b/api/model/vip.js
new file mode 100644
index 0000000..c2d4b7b
--- /dev/null
+++ b/api/model/vip.js
@@ -0,0 +1,20 @@
+
+// vip相关接口
+
+const api = {
+ // 获取会员权益列表
+ getRiceVipList: {
+ url: '/index_common/getVipInfoList',
+ method: 'GET',
+ },
+ // 申请成为会员
+ applyRiceVip: {
+ url: '/rice_vip/applyRiceVip',
+ method: 'POST',
+ limit : 500,
+ auth : true,
+ showLoading : true,
+ },
+}
+
+export default api
\ No newline at end of file
diff --git a/components/base/navbar.vue b/components/base/navbar.vue
index 49636c4..34d6fee 100644
--- a/components/base/navbar.vue
+++ b/components/base/navbar.vue
@@ -116,7 +116,7 @@
justify-content: center;
font-size: 32rpx;
align-items: center;
- z-index: 99999;
+ z-index: 999;
.left{
position: absolute;
left: 40rpx;
diff --git a/components/base/tabbar.vue b/components/base/tabbar.vue
index ad879c9..9c70362 100644
--- a/components/base/tabbar.vue
+++ b/components/base/tabbar.vue
@@ -1,19 +1,14 @@
-
-
+
-
-
-
+
+
+ item.iconPath" class="tabbar-icon-image" mode="aspectFill">
-
+
{{ item.title }}
@@ -22,54 +17,58 @@
\ No newline at end of file
diff --git a/config.js b/config.js
index bc0bb92..4175d2b 100644
--- a/config.js
+++ b/config.js
@@ -24,18 +24,18 @@ const config = {
// 默认配置
const defaultConfig = {
mapKey : 'XMBBZ-BCPCV-SXPPQ-5Y7MY-PHZXK-YFFVU',
- aliOss : {
- url : 'https://tennis-oss.xzaiyp.top/',
- config : {
+ aliOss: {
+ url: 'https://image.hhlm1688.com/',
+ config: {
//桶的地址
region: 'oss-cn-guangzhou',
//id
- accessKeyId:'LTAI5tNycA46YTwm383dRvMV',
+ accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9',
//密钥
- accessKeySecret:'tAdbYQCmdur6jbZ8hjvgB7T1Z52mIG',
+ accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
//桶的名字
- bucket: 'zhuoqiu-image',
- endpoint:'oss-cn-guangzhou.aliyuncs.com',
+ bucket: 'hanhaiimage',
+ endpoint: 'oss-cn-shenzhen.aliyuncs.com',
}
},
}
diff --git a/doc/address.png b/doc/address.png
deleted file mode 100644
index 90d2487..0000000
Binary files a/doc/address.png and /dev/null differ
diff --git a/doc/c.png b/doc/c.png
deleted file mode 100644
index c5e7e67..0000000
Binary files a/doc/c.png and /dev/null differ
diff --git a/doc/cart.png b/doc/cart.png
deleted file mode 100644
index 4dab96f..0000000
Binary files a/doc/cart.png and /dev/null differ
diff --git a/doc/category.png b/doc/category.png
deleted file mode 100644
index 335c270..0000000
Binary files a/doc/category.png and /dev/null differ
diff --git a/doc/center.png b/doc/center.png
deleted file mode 100644
index 4c72a48..0000000
Binary files a/doc/center.png and /dev/null differ
diff --git a/doc/editAddress.png b/doc/editAddress.png
deleted file mode 100644
index de90d40..0000000
Binary files a/doc/editAddress.png and /dev/null differ
diff --git a/doc/home-s.png b/doc/home-s.png
deleted file mode 100644
index 394de5f..0000000
Binary files a/doc/home-s.png and /dev/null differ
diff --git a/doc/home.png b/doc/home.png
deleted file mode 100644
index 564a41d..0000000
Binary files a/doc/home.png and /dev/null differ
diff --git a/doc/order.png b/doc/order.png
deleted file mode 100644
index 1a218e6..0000000
Binary files a/doc/order.png and /dev/null differ
diff --git a/doc/productDetail.png b/doc/productDetail.png
deleted file mode 100644
index 0bd6dab..0000000
Binary files a/doc/productDetail.png and /dev/null differ
diff --git a/doc/productUnit.png b/doc/productUnit.png
deleted file mode 100644
index 348b83b..0000000
Binary files a/doc/productUnit.png and /dev/null differ
diff --git a/doc/purse.png b/doc/purse.png
deleted file mode 100644
index 6f091b4..0000000
Binary files a/doc/purse.png and /dev/null differ
diff --git a/mixins/configList.js b/mixins/configList.js
index f621471..a79666f 100644
--- a/mixins/configList.js
+++ b/mixins/configList.js
@@ -13,17 +13,21 @@ export default {
}
},
computed: {
- ...mapState(['configList', 'userInfo']),
+ ...mapState(['configList', 'userInfo', 'riceInfo']),
},
// 定义全局分享
// 1.发送给朋友
onShareAppMessage(res) {
let o = {
- ...this.Gshare,
title : this.configList.logo_name,
+ ...this.Gshare,
}
if(this.userInfo.id){
- o.path = this.Gshare.path + '?shareId=' + this.userInfo.id
+ if(this.Gshare.path.includes('?')){
+ o.path += '&shareId=' + this.userInfo.id
+ }else{
+ o.path += '?shareId=' + this.userInfo.id
+ }
}
return o
},
diff --git a/mixins/list.js b/mixins/list.js
index 4f072f9..23bb70e 100644
--- a/mixins/list.js
+++ b/mixins/list.js
@@ -1,22 +1,21 @@
-
-
-
+/**
+ * 处理查询参数
+ * @param {Object} self - 组件实例
+ * @param {Object} queryParams - 额外的查询参数
+ * @returns {Object} 合并后的查询参数
+ */
function query(self, queryParams){
- // return (self.beforeGetData && self.beforeGetData()) ||
- // queryParams || self.queryParams
-
// 深度合并对象
return self.$utils.deepMergeObject(
-
- self.$utils.deepMergeObject(self.queryParams,
-
- (self.beforeGetData && self.beforeGetData()) || {}),
-
- queryParams)
+ self.$utils.deepMergeObject(self.queryParams,
+ (self.beforeGetData && self.beforeGetData()) || {}),
+ queryParams)
}
-
-
+/**
+ * 列表数据加载混入
+ * 提供列表数据的加载、分页、下拉刷新、上拉加载更多等功能
+ */
export default {
data() {
return {
@@ -28,16 +27,24 @@ export default {
list : [],
}
},
+ // 下拉刷新
onPullDownRefresh() {
this.getData()
},
+ // 上拉加载更多
onReachBottom() {
this.loadMoreData()
},
+ // 页面显示时加载数据
onShow() {
this.getData()
},
methods: {
+ /**
+ * 获取列表数据
+ * @param {Object} queryParams - 查询参数
+ * @returns {Promise} 返回Promise对象
+ */
getData(queryParams){
return new Promise((success, error) => {
if(!this.mixinsListApi){
@@ -47,20 +54,21 @@ export default {
query(this, queryParams), res => {
uni.stopPullDownRefresh()
if(res.code == 200){
-
- this.getDataThen && this.getDataThen(res.result.records, res.result.total, res.result)
-
success(res.result)
-
- this[this.mixinsListKey || 'list'] = res.result.records
-
- this.total = res.result.total
+ // 更新列表数据
+ this[this.mixinsListKey || 'list'] = res.result.records || res.result
+ // 更新总数
+ this.total = res.result.total || res.result.length
+ // 调用数据加载完成的回调
+ this.getDataThen && this.getDataThen(res.result.records, res.result.total, res.result)
}
})
})
},
+ /**
+ * 加载更多数据
+ */
loadMoreData(){
- console.log('loadMoreData----', this.queryParams.pageSize < this.total);
if(this.queryParams.pageSize < this.total){
this.queryParams.pageSize += 10
this.getData()
diff --git a/mixins/order.js b/mixins/order.js
new file mode 100644
index 0000000..b1650dd
--- /dev/null
+++ b/mixins/order.js
@@ -0,0 +1,70 @@
+
+
+export default {
+ data() {
+ return {
+ }
+ },
+ computed: {
+ },
+ methods: {
+ // 立即支付
+ toPayOrder(item){
+ let api = ''
+
+ // if([0, 1].includes(item.shopState)){
+ // api = 'createOrderTwo'
+ // }else{
+ api = 'createSumOrderAgain'
+ // }
+
+ this.$api(api, {
+ orderId : item.id,
+ addressId : item.addressId
+ }, res => {
+ if(res.code == 200){
+ uni.requestPaymentWxPay(res)
+ .then(res => {
+ uni.showToast({
+ title: '支付成功',
+ icon: 'none'
+ })
+ this.getData()
+ }).catch(n => {
+ this.getData()
+ })
+ }
+ })
+ },
+ // 确认收货
+ confirmOrder(item){
+ uni.showModal({
+ title: '您收到货了吗?',
+ success : e => {
+ if(e.confirm){
+ this.$api('confirmOrder', {
+ orderId : item.id,
+ }, res => {
+ this.getData()
+ })
+ }
+ }
+ })
+ },
+ // 取消订单
+ cancelOrder(item){
+ uni.showModal({
+ title: '确认取消订单吗?',
+ success : e => {
+ if(e.confirm){
+ this.$api('cancelOrder', {
+ orderId : item.id,
+ }, res => {
+ this.getData()
+ })
+ }
+ }
+ })
+ },
+ }
+}
\ No newline at end of file
diff --git a/pages/index/cart.vue b/pages/index/cart.vue
index 4c9a7c2..6a6d37f 100644
--- a/pages/index/cart.vue
+++ b/pages/index/cart.vue
@@ -201,6 +201,7 @@
justify-content: center;
align-items: center;
overflow: hidden;
+ z-index: 999;
.icon{
position: relative;
width: 80rpx;
diff --git a/pages_order/auth/loginAndRegisterAndForgetPassword.vue b/pages_order/auth/loginAndRegisterAndForgetPassword.vue
index 1680203..7de7898 100644
--- a/pages_order/auth/loginAndRegisterAndForgetPassword.vue
+++ b/pages_order/auth/loginAndRegisterAndForgetPassword.vue
@@ -1,10 +1,63 @@
-
+
-
-
+
+
+
+
+ {{titleList[titleIndex]}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{tips}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 请你阅读并同意我们的《隐私条款》和《服务协议》
+
+
+
+
+
+
+
+
+
{{titleList[titleIndex]}}
@@ -18,8 +71,8 @@
-
+
-
+
请你阅读并同意我们的《隐私条款》和《隐私条款》和《服务协议》
+ @click="$refs.popup.open('fwxy')">《服务协议》
@@ -44,19 +97,19 @@
-
+
{{titleList[titleIndex]}}
-
-
@@ -64,32 +117,31 @@
- {{tips}}
-
-
-
-
+
+
-
+
-
+
-
-
+
+
@@ -123,36 +175,133 @@
titleList: ['注册', '登录', '重置密码'],
checkboxValue: [],
form: {
- account: '13135294009',
- password: 'lzx123456',
+ username: '',//19330214982
+ password: '',//1234567
+ loginModel: 0,
+ captcha: '',
},
form1: {
- userName: '',
- code: '',
- password1: '',
- password2: '',
+ username: '',
+ captcha: '',
+ password: '',
+ newPassword: '',
},
tips: '获取验证码',
seconds: 60,
}
},
methods: {
- submit(){
- if(!this.checkboxValue.length){
+ submit() {
+ if (!this.checkboxValue.length && this.titleIndex != 2) {
return uni.showToast({
title: '请先同意隐私协议',
- icon:'none'
+ icon: 'none'
+ })
+ }
+
+ if (this.titleIndex == 0) {
+ // 注册
+ this.register()
+ } else if (this.titleIndex == 1) {
+ // 登录
+ this.login()
+ } else {
+ // 忘记密码
+ this.updatePassword()
+ }
+ },
+ // 登录
+ login(){
+
+ if (this.$utils.verificationAll(this.form, {
+ username: '请输入账号',
+ password: '请输入密码',
+ })) {
+ return
+ }
+
+ if (!this.$utils.verificationPhone(this.form.username)) {
+ return uni.showToast({
+ title: '请输入合法的手机号',
+ icon: 'none'
})
}
- if(this.$utils.verificationAll(this.form, {
- account: '请输入账号',
- password: '请输入密码',
- })){
+ // 登录
+ this.$store.commit('login', this.form)
+ },
+ // 注册
+ register(){
+
+ if (this.$utils.verificationAll(this.form1, {
+ username: '请输入账号',
+ captcha : '请输入验证码',
+ password: '请输入密码',
+ newPassword: '请确认密码',
+ })) {
return
}
- this.$store.commit('accountLogin', this.form)
+ if (!this.$utils.verificationPhone(this.form1.username)) {
+ return uni.showToast({
+ title: '请输入合法的手机号',
+ icon: 'none'
+ })
+ }
+
+ if (this.form1.password != this.form1.newPassword) {
+ return uni.showToast({
+ title: '密码与确认密码不一致',
+ icon: 'none'
+ })
+ }
+
+ this.$api('registerUser', this.form1, res => {
+ this.form1 = {}
+ if (res.code == 200) {
+ this.titleIndex = 1
+ uni.showToast({
+ title: '注册成功,请登录!',
+ icon: 'none'
+ })
+ }
+ })
+ },
+ updatePassword(){
+
+ if (this.$utils.verificationAll(this.form1, {
+ username: '请输入账号',
+ captcha : '请输入验证码',
+ password: '请输入新密码',
+ newPassword: '请确认密码',
+ })) {
+ return
+ }
+
+ if (!this.$utils.verificationPhone(this.form1.username)) {
+ return uni.showToast({
+ title: '请输入合法的手机号',
+ icon: 'none'
+ })
+ }
+
+ if (this.form1.password != this.form1.newPassword) {
+ return uni.showToast({
+ title: '密码与确认密码不一致',
+ icon: 'none'
+ })
+ }
+
+ this.$api('newPassword', this.form1, res => {
+ this.form1 = {}
+ if (res.code == 200) {
+ this.titleIndex = 1
+ uni.showToast({
+ title: '修改成功,请登录!',
+ icon: 'none'
+ })
+ }
+ })
},
// 切换页面
changePage(index) {
@@ -167,17 +316,28 @@
},
getCode() {
if (this.$refs.code.canGetCode) {
- // 模拟向后端请求验证码
+
+ if (!this.$utils.verificationPhone(this.form1.username)) {
+ return uni.showToast({
+ title: '请输入合法的手机号',
+ icon: 'none'
+ })
+ }
+
uni.showLoading({
title: '正在获取验证码'
})
- setTimeout(() => {
- uni.hideLoading();
- // 这里此提示会被this.start()方法中的提示覆盖
- uni.$uv.toast('验证码已发送');
- // 通知验证码组件内部开始倒计时
- this.$refs.code.start();
- }, 2000);
+ this.$api('sendSms', {
+ username: this.form1.username,
+ }, res => {
+ if (res.code == 200) {
+ uni.hideLoading();
+ // 这里此提示会被this.start()方法中的提示覆盖
+ uni.$uv.toast('验证码已发送');
+ // 通知验证码组件内部开始倒计时
+ this.$refs.code.start();
+ }
+ })
} else {
uni.$uv.toast('请勿重复发送');
}
@@ -197,11 +357,16 @@
* {
box-sizing: border-box;
}
+
+ .content{
+ font-size: 22rpx;
+ margin: 0 auto;
+ }
.refundsOrExchange {
background-color: #FFF;
height: 100vh;
-
+
.frame {
background-color: #FFF;
@@ -209,6 +374,7 @@
display: flex;
flex-direction: column;
gap: 40rpx;
+ padding-bottom: 50rpx;
.title {
display: flex;
@@ -234,7 +400,8 @@
}
.form {
- line-height: 50rpx;
+ height: 12vh;
+
>view:nth-of-type(1) {
padding: 20rpx 100rpx;
}
@@ -246,18 +413,18 @@
>view:nth-of-type(3) {
display: flex;
padding: 30rpx 100rpx 0 100rpx;
- font-size: 22rpx
+ font-size: 22rpx;
}
}
}
-
-
+
+
.btn {
// height: 5vh;
display: flex;
justify-content: center;
margin: 90rpx 0 0 0;
-
+
.a {
display: flex;
justify-content: center;
@@ -266,23 +433,23 @@
height: 80rpx;
color: #FFF;
background-color: $uni-color;
- border: 1px solid red;
+ box-shadow: 0 0 4rpx 4rpx rgba($uni-color, 0.2);
border-radius: 100rpx;
font-size: 30rpx;
}
}
-
+
.bottomTab {
display: flex;
justify-content: space-between;
height: 10vh;
padding: 0 80rpx;
margin-top: 30rpx;
-
+
.tabbarItemActive {
color: $uni-color;
}
-
+
.tabbarItemNoActive {
color: #9c9fa4;
}
diff --git a/pages_order/auth/wxLogin.vue b/pages_order/auth/wxLogin.vue
index 5354815..292f9d1 100644
--- a/pages_order/auth/wxLogin.vue
+++ b/pages_order/auth/wxLogin.vue
@@ -18,6 +18,10 @@
+
+ 取消登录
+
@@ -58,7 +62,6 @@
}
},
methods: {
-
wxLogin(){
if(!this.checkboxValue.length){
return uni.showToast({
@@ -68,12 +71,11 @@
}
this.$store.commit('login')
},
-
- //打开应用配置
- openConfigDetail(key){
- this.$refs.popup.open(key)
- }
-
+ qux(){
+ uni.reLaunch({
+ url: '/pages/index/index'
+ })
+ },
}
}
diff --git a/pages_order/components/commodity/commoditySelect.vue b/pages_order/components/commodity/commoditySelect.vue
deleted file mode 100644
index c068258..0000000
--- a/pages_order/components/commodity/commoditySelect.vue
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-
-
-
-
-
-
- {{ item.title }}
- {{ item.smallTitle }}
-
- ×{{item.total}}
-
-
-
-
-
-
-
-
-
diff --git a/pages_order/order/refundsOrExchange.vue b/pages_order/order/refundsOrExchange.vue
index d2e3c7d..9ea20e6 100644
--- a/pages_order/order/refundsOrExchange.vue
+++ b/pages_order/order/refundsOrExchange.vue
@@ -80,21 +80,18 @@
-