From a9533e2d7fa52e0f39458c897a73119969f677aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=B0=91=E5=90=9B?= <476671688@qq.com> Date: Tue, 5 Mar 2024 12:16:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2js=E8=AD=A6=E5=91=8A?= =?UTF-8?q?=EF=BC=8C=E5=85=85=E5=80=BC=E8=AE=A2=E5=8D=95=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?bug=E4=BB=A5=E5=8F=8A=E5=85=B6=E4=BB=96bug=E3=80=82refactor:=20?= =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=9C=B0=E5=9D=80=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/address.js | 2 +- api/order.js | 2 + components/PayPopup/index.vue | 2 +- config/index.js | 4 +- hooks/useInterface.js | 53 ++-- hooks/useRouter.js | 2 +- index.html | 6 +- main.js | 2 +- pages/address/address.vue | 373 ++++++++---------------- pages/address/component/AddressItem.vue | 139 +++++++++ pages/createAddress/createAddress.vue | 368 +++++++++-------------- pages/payStatus/index.vue | 108 ++++--- pages/submitOrder/submitOrder.vue | 91 +++--- store/modules/useMainStore.js | 27 +- style/style.css | 9 - utils/paymentUtils.js | 20 +- utils/utils.js | 12 +- views/account/recharge/index.vue | 4 +- 18 files changed, 553 insertions(+), 671 deletions(-) create mode 100644 pages/address/component/AddressItem.vue diff --git a/api/address.js b/api/address.js index 3ef4f1b..d85e469 100644 --- a/api/address.js +++ b/api/address.js @@ -17,7 +17,7 @@ export function getAddressAddAndEdit(data) { // 用户地址列表 export function getAddressList(data) { - return requestUtil.get(`/address/list`, data, {login: true}) + return requestUtil.get(`/address/list`, data) } // 城市列表 diff --git a/api/order.js b/api/order.js index 796f2b5..d23da7d 100644 --- a/api/order.js +++ b/api/order.js @@ -162,3 +162,5 @@ export const wechatPay = (data) => requestUtil.post(`/pay/payment`, data) * @returns {*} */ export const checkPay = (data) => requestUtil.post(`/order/pay/orderQuery`, data) + +export const checkRecharge = (data) => requestUtil.get(`/recharge-order/isPay`, data) diff --git a/components/PayPopup/index.vue b/components/PayPopup/index.vue index fb7f15f..cf39d60 100644 --- a/components/PayPopup/index.vue +++ b/components/PayPopup/index.vue @@ -60,7 +60,7 @@ async function handleSubmit() { close() } catch (e) { console.error(e) - push({url: '/pages/payStatus/index'}, {data: {type: 2}}) + push({url: '/pages/payStatus/index'}, {data: {type: 1}}) toast({title: '支付失败了'}) close() } diff --git a/config/index.js b/config/index.js index 1050896..8017ff6 100644 --- a/config/index.js +++ b/config/index.js @@ -1,11 +1,11 @@ -export const VUE_APP_API_URL = 'https://b2c-pro-api-dev.zkthink.com/app-api' +export const VUE_APP_API_URL = 'https://b2c-pro-api.zkthink.com/app-api' // export const VUE_APP_API_URL = 'https://843308749k.wocp.fun/app-api' export const VUE_APP_UPLOAD_URL = VUE_APP_API_URL + '/infra/file/upload' export const VUE_APP_STATIC_URL = "https://b2c-pro-static-dev.zkthink.com/" // 静态资源路径 export const VUE_SHARE_TITLE = '邀请您使用YShop~' // export const VUE_H5_DOMAIN_NAME = "http://localhost:10086/#" -export const VUE_H5_DOMAIN_NAME = "https://b2c-pro-ui-h5-dev.zkthink.com/#" +export const VUE_H5_DOMAIN_NAME = "https://b2c-pro-ui-h5.zkthink.com/#" const orderListStatus = {} diff --git a/hooks/useInterface.js b/hooks/useInterface.js index 9d7d22d..0fcee51 100644 --- a/hooks/useInterface.js +++ b/hooks/useInterface.js @@ -8,22 +8,36 @@ /** * 封装uni app界面相关接口,利于维护 - * @returns { * } + * @returns { + * { + * toast:Function, + * loading:Function, + * hideLoading:Function, + * setNavTitle:Function, + * setNavBgColor:Function, + * scrollTo:Function, + * pageResize:Function, + * unPageResize:Function, + * startPullDownRefresh:Function, + * stopPullDownRefresh:Function, + * createSelectorQuery:Function, + * createObserver:Function, + * createMediaObserver:Function, + * createAnimation:Function, + * getMenuButtonInfo:Function + * } + * } */ export const useInterface = () => { /** * 使用uni的toast * @param options - * @returns {Promise} + * @returns {Promise} */ function toast(options) { return new Promise((resolve, reject) => { uni.showToast({ - icon: 'none', - mask: false, - ...options, - success: () => resolve(true), - fail: (error) => reject(error) + icon: 'none', mask: false, ...options, success: () => resolve(true), fail: (error) => reject(error) }) }) } @@ -36,11 +50,7 @@ export const useInterface = () => { function loading(options = {}) { return new Promise((resolve, reject) => { uni.showLoading({ - icon: 'none', - mask: true, - ...options, - success: () => resolve(true), - fail: (error) => reject(error) + icon: 'none', mask: true, ...options, success: () => resolve(true), fail: (error) => reject(error) }) }) } @@ -57,9 +67,7 @@ export const useInterface = () => { function setNavTitle(title) { return new Promise((resolve, reject) => { uni.setNavigationBarTitle({ - title, - success: () => resolve(true), - fail: (error) => reject(error) + title, success: () => resolve(true), fail: (error) => reject(error) }) }) } @@ -73,18 +81,14 @@ export const useInterface = () => { function setNavBgColor(options, timeout = 500) { return new Promise((resolve, reject) => { const setNavigationBarColor = () => uni.setNavigationBarColor({ - ...options, - success: () => resolve(true), - fail: (error) => reject(error) + ...options, success: () => resolve(true), fail: (error) => reject(error) }) if (timeout === 0) { setNavigationBarColor() } else { setTimeout(() => { uni.setNavigationBarColor({ - ...options, - success: () => resolve(true), - fail: (error) => reject(error) + ...options, success: () => resolve(true), fail: (error) => reject(error) }) }, timeout) } @@ -100,9 +104,7 @@ export const useInterface = () => { function scrollTo(options) { return new Promise((resolve, reject) => { uni.pageScrollTo({ - ...options, - success: () => resolve(true), - fail: (error) => reject(error) + ...options, success: () => resolve(true), fail: (error) => reject(error) }) }) } @@ -134,8 +136,7 @@ export const useInterface = () => { function startPullDownRefresh() { return new Promise((resolve, reject) => { uni.startPullDownRefresh({ - success: () => resolve(true), - fail: (error) => reject(error) + success: () => resolve(true), fail: (error) => reject(error) }) }) } diff --git a/hooks/useRouter.js b/hooks/useRouter.js index ae0bf62..fa4b068 100644 --- a/hooks/useRouter.js +++ b/hooks/useRouter.js @@ -17,7 +17,7 @@ export const useRouter = () => { * 注意:2.8.9+以后版本可以使用events参数传递一个方法对象和新打开的页面建立一个channel通讯,getOpenerEventChannel获取到这个channel * @docs: https://uniapp.dcloud.net.cn/api/router.html#navigateto * @param {object} options 原始参数 - * @param {object} config 配置参数 + * @param {any} config 配置参数 * @param {'navigateTo'|'redirectTo'|'reLaunch'} config.type 跳转类型 * @param {object} config.data 跳转参数 * @param {number} config.timeout 延时时间 diff --git a/index.html b/index.html index 16f3af5..f6d41a6 100644 --- a/index.html +++ b/index.html @@ -2,9 +2,9 @@ - - - + diff --git a/pages/address/component/AddressItem.vue b/pages/address/component/AddressItem.vue new file mode 100644 index 0000000..1f04179 --- /dev/null +++ b/pages/address/component/AddressItem.vue @@ -0,0 +1,139 @@ + + + + + + diff --git a/pages/createAddress/createAddress.vue b/pages/createAddress/createAddress.vue index 60c8ab6..efc42de 100644 --- a/pages/createAddress/createAddress.vue +++ b/pages/createAddress/createAddress.vue @@ -1,13 +1,7 @@