From 877ae6e69f7aca38b24c0c71e48d874167368c5f Mon Sep 17 00:00:00 2001
From: Fox-33 <1466778434@qq.com>
Date: Fri, 15 Aug 2025 19:19:57 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5;?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 2 +-
api/api.js | 4 +-
api/fetch.js | 2 +-
api/model/address.js | 41 +++
api/model/cart.js | 37 +++
api/model/index.js | 217 ++-------------
api/model/info.js | 109 --------
api/model/login.js | 12 +-
api/model/order.js | 37 +++
api/model/product.js | 22 ++
api/model/vip.js | 20 --
config.js | 16 +-
pages.json | 6 +-
pages/index/cart.vue | 165 +++++-------
pages/index/center.vue | 5 +
pages/index/index.vue | 49 ++++
pages/index/product.vue | 53 +++-
pages/index/report.vue | 5 +
pages_order/address/addressCard.vue | 10 +-
pages_order/address/addressList.vue | 109 +++-----
pages_order/address/addressPopup.vue | 92 +++++--
pages_order/address/addressView.vue | 11 +-
pages_order/auth/wxUserInfo.vue | 45 ++--
pages_order/cart/productCard.vue | 16 +-
pages_order/order/orderConfirm/index.vue | 77 ++++--
pages_order/order/orderConfirm/productCard.vue | 67 +++--
pages_order/order/orderList/index.vue | 292 +--------------------
pages_order/order/orderList/orderCard.vue | 36 ++-
pages_order/order/payPopup.vue | 83 ++++--
pages_order/product/countSelectPopup.vue | 11 +-
pages_order/product/productCard.vue | 11 +-
...utrientCustomView.vue => productCustomView.vue} | 69 +++--
pages_order/product/productDetail.vue | 107 +++++---
pages_order/product/productList.vue | 105 ++++++++
.../product/sectionHeader.vue | 0
pages_order/product/tabCourse/index.vue | 28 +-
pages_order/product/tabDetect/detectCustomView.vue | 77 ------
pages_order/product/tabDetect/index.vue | 21 +-
pages_order/product/tabNutrient/index.vue | 18 +-
store/store.js | 20 +-
40 files changed, 1006 insertions(+), 1101 deletions(-)
create mode 100644 api/model/address.js
create mode 100644 api/model/cart.js
create mode 100644 api/model/order.js
create mode 100644 api/model/product.js
delete mode 100644 api/model/vip.js
rename pages_order/product/{tabNutrient/nutrientCustomView.vue => productCustomView.vue} (80%)
create mode 100644 pages_order/product/productList.vue
rename {components => pages_order}/product/sectionHeader.vue (100%)
delete mode 100644 pages_order/product/tabDetect/detectCustomView.vue
diff --git a/App.vue b/App.vue
index cc1058b..651fe9f 100644
--- a/App.vue
+++ b/App.vue
@@ -3,7 +3,7 @@
onLaunch: function() {
},
onShow: function() {
- // this.$store.commit('initConfig')
+ this.$store.commit('initConfig')
},
onHide: function() {
}
diff --git a/api/api.js b/api/api.js
index d566315..0693664 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 = ['login', 'index', 'vip', 'info']
+const models = ['login', 'index', 'cart', 'product', 'order', 'address', 'info']
const config = {
// 示例
@@ -14,7 +14,7 @@ const config = {
// limit : 1000
// },
- getConfig : {url : '/config_common/getConfig', method : 'GET', limit : 500},
+ getConfig : {url : '/config/list', method : 'GET', limit : 500},
}
diff --git a/api/fetch.js b/api/fetch.js
index 848bd68..87ed77c 100644
--- a/api/fetch.js
+++ b/api/fetch.js
@@ -1,7 +1,7 @@
import api from './api.js'
const fetch = (key, data = {}, transform = true, loadingTitle) => {
- return new Promise(resolve => {
+ return new Promise((resolve, reject) => {
const callback = (res) => {
if (!transform) {
diff --git a/api/model/address.js b/api/model/address.js
new file mode 100644
index 0000000..6d15594
--- /dev/null
+++ b/api/model/address.js
@@ -0,0 +1,41 @@
+
+// 收货地址相关接口
+
+const api = {
+ // 小程序收货地址-地址列表查询
+ getAddressList: {
+ url: '/address/list',
+ method: 'GET',
+ auth: true,
+ showLoading : true,
+ },
+ // 小程序收货地址-通过id查询
+ getAddressById: {
+ url: '/address/getById',
+ method: 'GET',
+ showLoading : true,
+ },
+ // 小程序收货地址-添加地址
+ addAddress: {
+ url: '/address/add',
+ method: 'POST',
+ limit : 500,
+ showLoading : true,
+ },
+ // 小程序收货地址-修改地址
+ updateAddress: {
+ url: '/address/update',
+ method: 'PUT',
+ limit : 500,
+ showLoading : true,
+ },
+ // 小程序收货地址-设置默认地址
+ setAddressDefault: {
+ url: '/address/setDefault',
+ method: 'PUT',
+ limit : 500,
+ showLoading : true,
+ },
+}
+
+export default api
\ No newline at end of file
diff --git a/api/model/cart.js b/api/model/cart.js
new file mode 100644
index 0000000..011baac
--- /dev/null
+++ b/api/model/cart.js
@@ -0,0 +1,37 @@
+
+// 购物车相关接口
+
+const api = {
+ // 购物车-列表查询
+ getCartList: {
+ url: '/cart/list',
+ method: 'GET',
+ auth: true,
+ showLoading : true,
+ },
+ // 购物车-添加
+ addCart: {
+ url: '/cart/add',
+ method: 'POST',
+ auth: true,
+ limit : 500,
+ showLoading : true,
+ },
+ // 购物车-批量删除
+ deleteCartBatch: {
+ url: '/cart/deleteBatch',
+ method: 'DELETE',
+ auth: true,
+ showLoading: true,
+ },
+ // 购物车-编辑购物车
+ editCart: {
+ url: '/cart/edit',
+ method: 'PUT',
+ auth: true,
+ limit : 500,
+ showLoading : true,
+ },
+}
+
+export default api
\ No newline at end of file
diff --git a/api/model/index.js b/api/model/index.js
index 3bd6c97..be15255 100644
--- a/api/model/index.js
+++ b/api/model/index.js
@@ -1,215 +1,42 @@
// 首页相关接口
const api = {
- // 获取首页轮播图
- getRiceBanner: {
- url: '/index_common/getRiceBanner',
+ // Banner列表查询
+ getBanner: {
+ url: '/index/banner',
method: 'GET',
},
- // 获取首页常规产品【废弃】
- // getRiceCommonProductList: {
- // url: '/index_common/getRiceCommonProductList',
- // method: 'GET',
- // },
- // 获取首页跳转图标
- getRiceIconList: {
- url: '/index_common/getRiceIconList',
+ // 个性化推荐
+ getPersonalized: {
+ url: '/index/personalized',
method: 'GET',
},
- // 获取首页新闻详情
- getRiceNewsDetail: {
- url: '/index_common/getCommonNewsDetail',
+ // 关于普兆
+ getAbout: {
+ url: '/index/about',
method: 'GET',
},
- // 获取首页新闻列表
- getRiceNewsList: {
- url: '/index_common/getRiceNewsList',
+ // 关于普兆详情
+ getAboutDetail: {
+ url: '/index/aboutDetail',
method: 'GET',
},
- // 获取首页公告列表
- getRiceNoticeList: {
- url: '/index_common/getRiceNoticeList',
+
+ // 普兆介绍->视频介绍
+ getVideo: {
+ url: '/index/video',
method: 'GET',
},
- // 获取首页商品详情
- getRiceProductDetail: {
- url: '/index_common/getRiceProductDetail',
+ // 推荐产品
+ getRecommendProduct: {
+ url: '/index/recommendProduct',
method: 'GET',
},
- // 获取首页体验产品
- getRiceProductList: {
- url: '/index_common/getRiceProductList',
+ // 普兆介绍->步骤条《左右滑动的内容》
+ getIntroduce: {
+ url: '/index/getIntroduce',
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
index a695abd..5f170cc 100644
--- a/api/model/info.js
+++ b/api/model/info.js
@@ -1,115 +1,6 @@
// 个人相关接口
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 c818a04..bfc2ad1 100644
--- a/api/model/login.js
+++ b/api/model/login.js
@@ -5,20 +5,20 @@
const api = {
// 微信登录接口
wxLogin: {
- url: '/login_common/appletLogin',
- method: 'GET',
+ url: '/login/wxLogin',
+ method: 'POST',
limit : 500,
showLoading : true,
},
// 获取绑定手机号码
bindPhone: {
- url: '/login_common/bindPhone',
- method: 'GET',
+ url: '/login/getPhoneNumber',
+ method: 'POST',
auth: true,
},
// 修改个人信息接口
updateInfo: {
- url: '/info_common/updateInfo',
+ url: '/login/updateUserInfo',
method: 'POST',
auth: true,
limit : 500,
@@ -26,7 +26,7 @@ const api = {
},
// 获取个人信息
getInfo: {
- url: '/info_common/getInfo',
+ url: '/login/getUserInfo',
method: 'GET',
auth: true,
},
diff --git a/api/model/order.js b/api/model/order.js
new file mode 100644
index 0000000..77141a2
--- /dev/null
+++ b/api/model/order.js
@@ -0,0 +1,37 @@
+
+// 订单相关接口
+
+const api = {
+ // 订单-列表查询
+ getOrderList: {
+ url: '/order/list',
+ method: 'GET',
+ auth: true,
+ showLoading : true,
+ },
+ // 订单详情
+ getOrderDetail: {
+ url: '/order/detail',
+ method: 'GET',
+ auth: true,
+ showLoading : true,
+ },
+ // 创建订单
+ createOrder: {
+ url: '/order/create',
+ method: 'POST',
+ auth: true,
+ limit : 500,
+ showLoading : true,
+ },
+ // 再次支付
+ payOrder: {
+ url: '/order/pay',
+ method: 'POST',
+ auth: true,
+ limit : 500,
+ showLoading : true,
+ },
+}
+
+export default api
\ No newline at end of file
diff --git a/api/model/product.js b/api/model/product.js
new file mode 100644
index 0000000..e1fe7c6
--- /dev/null
+++ b/api/model/product.js
@@ -0,0 +1,22 @@
+
+// 产品相关接口
+
+const api = {
+ // 产品分类查询
+ getProductCategory: {
+ url: '/product/category',
+ method: 'GET',
+ },
+ // 产品列表查询
+ getProductList: {
+ url: '/product/list',
+ method: 'GET',
+ },
+ // 产品详情查询
+ getProductDetail: {
+ url: '/product/detail',
+ method: 'GET',
+ },
+}
+
+export default api
\ No newline at end of file
diff --git a/api/model/vip.js b/api/model/vip.js
deleted file mode 100644
index c2d4b7b..0000000
--- a/api/model/vip.js
+++ /dev/null
@@ -1,20 +0,0 @@
-
-// 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/config.js b/config.js
index d8c3365..8525bca 100644
--- a/config.js
+++ b/config.js
@@ -8,7 +8,7 @@ import uvUI from '@/uni_modules/uv-ui-tools'
Vue.use(uvUI);
// 当前环境
-const type = 'dev'
+const type = 'prod'
// 环境配置
@@ -17,26 +17,26 @@ const config = {
baseUrl : 'http://www.gcosc.fun:82',
},
prod : {
- baseUrl : 'http://xxx.xxx.xxx/xxx',
+ baseUrl : 'https://www.petualmedical.com/health-admin/appletApi',
}
}
// 默认配置
const defaultConfig = {
- mapKey : 'XMBBZ-BCPCV-SXPPQ-5Y7MY-PHZXK-YFFVU',
+ mapKey : 'WH3BZ-5M4EA-RT3KU-CCBEN-OGGWF-T5BVB',
aliOss: {
url: 'https://image.hhlm1688.com/',
config: {
//桶的地址
- region: 'oss-cn-guangzhou',
+ region: 'oss-cn-shanghai',
//id
- accessKeyId: 'LTAI5tQSs47izVy8DLVdwUU9',
+ accessKeyId: 'LTAI5tRbkjEJmdibzfCT8ymy',
//密钥
- accessKeySecret: 'qHI7C3PaXYZySr84HTToviC71AYlFq',
+ accessKeySecret: 'gE6BnsfaEGk23Zv2lOUvkvaWwhS6BV',
//桶的名字
- bucket: 'hanhaiimage',
- endpoint: 'oss-cn-shenzhen.aliyuncs.com',
+ bucket: 'petualmedical',
+ endpoint: 'oss-cn-shanghai.aliyuncs.com',
}
},
}
diff --git a/pages.json b/pages.json
index 20ad1c9..452739a 100644
--- a/pages.json
+++ b/pages.json
@@ -31,7 +31,8 @@
"componentPlaceholder": {
"tab-nutrient": "view",
"tab-detect": "view",
- "tab-course": "view"
+ "tab-course": "view",
+ "product-custom-view": "view"
}
}
},
@@ -96,6 +97,9 @@
{
"path": "report/compare/result"
},
+ {
+ "path": "product/productList"
+ },
{
"path": "product/productDetail"
},
diff --git a/pages/index/cart.vue b/pages/index/cart.vue
index c6fbaa6..2daad97 100644
--- a/pages/index/cart.vue
+++ b/pages/index/cart.vue
@@ -69,7 +69,7 @@
-
+
@@ -108,8 +108,7 @@
},
data() {
return {
- // todo
- mixinsListApi: '',
+ mixinsListApi: 'getCartList',
// todo
keyword: '',
mode: 'read',
@@ -125,108 +124,49 @@
// },
totalPrice() {
return this.selectedList.reduce((price, item) => {
+ // todo: check key
// return price + item.price * (item.count || 1)
- return price + item.price
+ return price + item.currentPrice
}, 0)
},
},
+ onLoad() {
+ if(uni.getStorageSync('token')){
+ this.$store.commit('getUserInfo')
+ }
+ },
methods: {
// 搜素
search() {
// todo
},
- // todo: delete
- getData() {
- this.list = [
- {
- id: '001',
- url: '',
- name: '月度装定制营养包',
- price: 688,
- count: 1,
- countDesc: '1月装',
- options: [
- { id: '001', label: '1月装', count: 1, value: 688 },
- { id: '002', label: '3月装', count: 3, value: 688*3 },
- { id: '003', label: '6月装', count: 6, value: 688*6 },
- ],
- customized: true,
- checked: false,
- },
- {
- id: '002',
- url: '',
- name: '月度装定制营养包',
- price: 688,
- count: 1,
- countDesc: '1月装',
- options: [
- { id: '001', label: '1月装', count: 1, value: 688 },
- { id: '002', label: '3月装', count: 3, value: 688*3 },
- { id: '003', label: '6月装', count: 6, value: 688*6 },
- ],
- free: true,
- checked: false,
- },
- {
- id: '003',
- url: '',
- name: '月度装定制营养包',
- price: 688,
- count: 1,
- countDesc: '1月装',
- options: [
- { id: '001', label: '1月装', count: 1, value: 688 },
- { id: '002', label: '3月装', count: 3, value: 688*3 },
- { id: '003', label: '6月装', count: 6, value: 688*6 },
- ],
- free: true,
- checked: false,
- },
- {
- id: '004',
- url: '',
- name: '月度装定制营养包',
- price: 688,
- count: 1,
- countDesc: '1月装',
- options: [
- { id: '001', label: '1月装', count: 1, value: 688 },
- { id: '002', label: '3月装', count: 3, value: 688*3 },
- { id: '003', label: '6月装', count: 6, value: 688*6 },
- ],
- free: true,
- checked: false,
- },
- {
- id: '005',
- url: '',
- name: '月度装定制营养包',
- price: 688,
- count: 1,
- countDesc: '1月装',
- options: [
- { id: '001', label: '1月装', count: 1, value: 688 },
- { id: '002', label: '3月装', count: 3, value: 688*3 },
- { id: '003', label: '6月装', count: 6, value: 688*6 },
- ],
- free: true,
- checked: false,
- },
- ]
-
- this.total = this.list.length
-
- this.getDataThen && this.getDataThen(this.list, this.total)
- },
getDataThen(records, total) {
console.log('getDataThen')
- // todo
if (total) {
+
+ this.selectedList.forEach(selectedItem => {
+ let target = records.find(item => item.id === selectedItem.id)
+ target.selected = true
+ })
+
+ this.list = records.map(item => {
+ const { skuId, product } = item
+ const { currentPrice, specs } = product || {}
+
+ return {
+ ...item,
+ // todo: check key
+ currentPrice,
+ specName: specs?.find?.(spec => spec.id === skuId)?.specName || ''
+ }
+ })
+ this.recommendList = []
+
return
}
+ // todo: check
this.recommendList = [
{
id: '001',
@@ -270,21 +210,28 @@
console.log('onSelect', index, selected)
this.list[index].selected = selected
- // todo
this.updateSelectedList()
},
- onChange(index, obj) {
+ async onChange(index, obj) {
console.log('onChange', index, obj)
- // todo: check
- this.list[index].price = obj.price
-
- this.list[index].count = obj.count
- this.list[index].countDesc = obj.countDesc
- // todo
+ try {
+ // todo
+ // await this.$fetch('editCart', obj)
+
+ // todo: check
+ // this.list[index].price = obj.price
+ // this.list[index].count = obj.count
+ this.list[index].skuId = obj.id
+ this.list[index].specName = obj.specName
+
+ this.updateSelectedList()
+ } catch (err) {
+
+ }
+
- this.updateSelectedList()
},
onEnterEdit() {
this.mode = 'edit'
@@ -292,18 +239,32 @@
onLeaveEdit() {
this.mode = 'read'
},
+ async fetchDelete() {
+ try {
+ const ids = this.selectedList.map(item => item.id)
+
+ await this.$fetch('deleteCartBatch', { ids })
+
+ this.getData()
+
+ uni.showToast({
+ icon: 'success',
+ title: '删除成功',
+ });
+
+ } catch (err) {
+
+ }
+ },
onDelete() {
uni.showModal({
title: '确认删除?',
success : e => {
if(e.confirm){
- // todo
- this.list = this.list.filter(item => !item.selected)
- this.total = this.list.length
+ this.fetchDelete()
}
}
})
-
},
onBuy() {
this.$store.commit('createOrder', this.selectedList)
diff --git a/pages/index/center.vue b/pages/index/center.vue
index d679c55..ef35b86 100644
--- a/pages/index/center.vue
+++ b/pages/index/center.vue
@@ -138,6 +138,11 @@
return this.userInfo && this.userInfo.id
}
},
+ onLoad() {
+ if(uni.getStorageSync('token')){
+ this.$store.commit('getUserInfo')
+ }
+ },
methods: {
onClick(target) {
const { key, path } = target
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 689a64c..1035559 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -72,6 +72,13 @@
}
},
onLoad() {
+ this.fetchBanner()
+ this.fetchPersonalized()
+ this.fetchAbout()
+
+ if(uni.getStorageSync('token')){
+ this.$store.commit('getUserInfo')
+ }
this.productSwiperList = [
{
@@ -115,6 +122,7 @@
},
]
+ return
this.recommendList = [
{
id: '001',
@@ -266,6 +274,47 @@
]
},
methods: {
+ async fetchBanner() {
+ try {
+ await this.$fetch('getBanner')
+ } catch (err) {
+
+ }
+ },
+ async fetchPersonalized() {
+ try {
+ let result = await this.$fetch('getPersonalized')
+
+ this.recommendList = result.map(item => {
+ const { id, title, subTitle, info, btnTxt } = item
+
+ return {
+ id,
+ // todo: check img url?
+ // url
+ arr: [
+ { text: title, class: 'font1' },
+ { text: subTitle, class: 'font2' },
+ { text: info, class: 'font3' },
+ ],
+ // btn: { text: btnTxt, path: '/pages_order/auth/wxLogin' },
+ // todo: check path?
+ btn: { text: btnTxt },
+ }
+ })
+ } catch (err) {
+
+ }
+ },
+ async fetchAbout() {
+ try {
+ await this.$fetch('getAbout')
+
+ this.followReasonList
+ } catch (err) {
+
+ }
+ },
},
}
diff --git a/pages/index/product.vue b/pages/index/product.vue
index 2385dd3..a4841ee 100644
--- a/pages/index/product.vue
+++ b/pages/index/product.vue
@@ -29,11 +29,23 @@
-
+
+
+
+
+
-
+
+
+
+
+
-
+
+
+
+
+
@@ -41,16 +53,21 @@
+
+
\ No newline at end of file
diff --git a/components/product/sectionHeader.vue b/pages_order/product/sectionHeader.vue
similarity index 100%
rename from components/product/sectionHeader.vue
rename to pages_order/product/sectionHeader.vue
diff --git a/pages_order/product/tabCourse/index.vue b/pages_order/product/tabCourse/index.vue
index a83d631..e763892 100644
--- a/pages_order/product/tabCourse/index.vue
+++ b/pages_order/product/tabCourse/index.vue
@@ -30,15 +30,21 @@
-
+
+
+
+
+
+
-
-
\ No newline at end of file
diff --git a/pages_order/product/tabDetect/index.vue b/pages_order/product/tabDetect/index.vue
index 050c084..661bd70 100644
--- a/pages_order/product/tabDetect/index.vue
+++ b/pages_order/product/tabDetect/index.vue
@@ -51,23 +51,21 @@
-
+