diff --git a/apis/addressManageApi.js b/apis/addressManageApi.js new file mode 100644 index 0000000..e9eb485 --- /dev/null +++ b/apis/addressManageApi.js @@ -0,0 +1,45 @@ +import http from '../utils/http/index.js' +/** + * 查询收货地址 + * swagger: http://api-ops-uec-test.qniao.cn/uec/swagger-ui/index.html?urls.primaryName=CustomerApi#/%E4%BC%81%E4%B8%9A%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3/getEnterpriseShippingAddressListByEnterpriseIdUsingGET + */ +export const getAddress = (data = {}) => { + return http.get({ + url: '/uec/get/enterprise-shipping-address-list/by-enterpriseId', + data + }) +} + + +/** + * 保存收货地址 + * swagger: http://api-ops-uec-test.qniao.cn/uec/swagger-ui/index.html?urls.primaryName=CustomerApi#/%E4%BC%81%E4%B8%9A/saveEnterpriseShippingAddressByEnterpriseIdUsingPOST + */ +export const createAddress = (data = {}) => { + return http.post({ + url: '/uec/save/enterprise-shipping-address/by/enterprise-id', + data + }) +} +// 删除收货地址 +export const delAddress = (data = {}) => { + return http.post({ + url: '/uec/delete/enterprise-shipping-address', + data + }) +} +// 设置默认地址 +export const setDefaultAddress = (data = {}) => { + return http.post({ + url: '/uec/set/enterprise-shipping-address/as/default', + data + }) +} +// 通过id查询企业收货地址 /uec/get/enterprise-shipping-address-detail + +export const getAddressDetail = (data = {}) => { + return http.get({ + url: '/uec/get/enterprise-shipping-address-detail', + data + }) +} \ No newline at end of file diff --git a/enums/index.js b/enums/index.js index 0bd7120..2df3540 100644 --- a/enums/index.js +++ b/enums/index.js @@ -168,6 +168,57 @@ export const fsAuditStatus = { REJECT: 3 } +/** + * 客户订单状态 0: 全部 ; 30100: 待确认 ; 30204: 待供应商确认 ; 30101: 已下单 ; 30104: 已完成 ; 30105: 已取消 + */ +export const orderStatusEnum = { + ALL: 0, + WAIT_CONFIRM: 30100, + WAIT_SUPPLIER_CONFIRM: 30204, + ORDERED: 30101, + FINISHED: 30104, + CANCELED: 30105 +} + +/** + * 客户订单状态 0: 全部 ; 30100: 待确认 ; 30204: 待供应商确认 ; 30101: 已下单 ; 30104: 已完成 ; + */ +export const orderStatusArray = [ + { + value: orderStatusEnum.ALL, + label: '全部' + }, + { + value: orderStatusEnum.WAIT_CONFIRM, + label: '待确认' + }, + { + value: orderStatusEnum.WAIT_SUPPLIER_CONFIRM, + label: '待供应商确认' + }, + { + value: orderStatusEnum.ORDERED, + label: '已下单' + }, + { + value: orderStatusEnum.FINISHED, + label: '已完成' + }, + { + value: orderStatusEnum.CANCELED, + label: '已取消' + } +] + +export const orderStatusMap = { + [orderStatusEnum.ALL]: '全部', + [orderStatusEnum.WAIT_CONFIRM]: '待确认', + [orderStatusEnum.WAIT_SUPPLIER_CONFIRM]: '待供应商确认', + [orderStatusEnum.ORDERED]: '已下单', + [orderStatusEnum.FINISHED]: '已完成', + [orderStatusEnum.CANCELED]: '已取消' +} + /** * 供应商订单状态 待客户确认订单/30202,待供应商确认订单/30205,待发货/30106,已发货/30107 ,待客户借款/30207,支付中/30208,待客户支付/30214,付款失败/30211,已完成/30213,待客户还款/30217,已取消/30212,还款中/30216 */ diff --git a/pages.json b/pages.json index e60e607..c695016 100644 --- a/pages.json +++ b/pages.json @@ -107,6 +107,22 @@ "navigationStyle": "custom" } }, + { + "path": "pages/address-manage/index", + "style": { + "navigationBarTitleText": "地址管理", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/add-address-manage/index", + "style": { + "navigationBarTitleText": "地址管理", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, { "path": "pages/paper-details/index", "style": { @@ -123,6 +139,22 @@ "navigationStyle": "custom" } }, + { + "path": "pages/order-list/index", + "style": { + "navigationBarTitleText": "订单列表", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path": "pages/order-detail/index", + "style": { + "navigationBarTitleText": "订单详情", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, { "path": "pages/mine/index", "style": { diff --git a/pages/add-address-manage/index.vue b/pages/add-address-manage/index.vue new file mode 100644 index 0000000..2ab4365 --- /dev/null +++ b/pages/add-address-manage/index.vue @@ -0,0 +1,270 @@ + + + + + diff --git a/pages/address-manage/index.vue b/pages/address-manage/index.vue new file mode 100644 index 0000000..f0cec99 --- /dev/null +++ b/pages/address-manage/index.vue @@ -0,0 +1,272 @@ + + + + + diff --git a/pages/cart/index.vue b/pages/cart/index.vue index 6511280..5723a50 100644 --- a/pages/cart/index.vue +++ b/pages/cart/index.vue @@ -83,14 +83,11 @@ diff --git a/pages/mall/index.vue b/pages/mall/index.vue index 4fcf021..b7adb75 100644 --- a/pages/mall/index.vue +++ b/pages/mall/index.vue @@ -45,7 +45,7 @@ - + diff --git a/pages/mine/index.vue b/pages/mine/index.vue index 1663cae..839d857 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -1,102 +1,62 @@ diff --git a/pages/order-detail/index.vue b/pages/order-detail/index.vue new file mode 100644 index 0000000..b733762 --- /dev/null +++ b/pages/order-detail/index.vue @@ -0,0 +1,572 @@ + + + + + diff --git a/pages/order-list/index.vue b/pages/order-list/index.vue new file mode 100644 index 0000000..987a719 --- /dev/null +++ b/pages/order-list/index.vue @@ -0,0 +1,271 @@ + + + + + diff --git a/pages/order-make/index.vue b/pages/order-make/index.vue index 3821457..73ed90b 100644 --- a/pages/order-make/index.vue +++ b/pages/order-make/index.vue @@ -97,16 +97,16 @@ 使用月结额度 - 剩余额度: {{ payMap['month'].availableCreditLine }} + 剩余额度: {{ payMap['month'].availableCreditLine }} - 待申请 - + 待申请 + 余额不足 @@ -114,16 +114,16 @@ 使用飞算资金 - 剩余额度: {{ payMap['fs'].availableCreditLine }} + 剩余额度: {{ payMap['fs'].availableCreditLine }} - 待申请 - + 待申请 + 余额不足 @@ -156,7 +156,7 @@ import { go2, back, getCache } from '@/utils/hook.js' import { getPreOrderInfo, getDefaultAddress, submitClientOrder, calcNotInvoiceOrderInfo } from '@/apis/orderApi' import { getFsCredit, getMonthCredit } from '@/apis/commonApi' import { isObject } from '@/utils/is' -import { invoiceStatusEnum } from '@/enums/index' +import { invoiceStatusEnum, paymentMethodEnum } from '@/enums/index' export default { data() { @@ -166,20 +166,22 @@ export default { receivedTime: null }, invoiceInfo: {}, // 开票的订单详情 - noInvoiceInfo: null, // 不开票的订单详情 deliveryAddress: {}, currentPayType: null, payMap: { month: { availableCreditLine: 0, - value: 2 + value: paymentMethodEnum.MONTHLY_PAY, + isShow: false }, fs: { availableCreditLine: 0, - value: 4 + value: paymentMethodEnum.FLY_PAY, + isShow: false }, wxpay: { - value: 1 + value: paymentMethodEnum.WECHAT_PAY, + isShow: false } }, loading: false, @@ -194,6 +196,7 @@ export default { if (res) { this.orderInfo = res this.invoiceInfo = res + this.completePayment(res.paymentMethods) } }) } else { @@ -209,7 +212,13 @@ export default { } }, created() { - this.init() + // 获取默认地址 + getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => { + if (res) { + this.deliveryAddress = res + this.deliveryAddress.addressId = res.id + } + }) }, onShow() { let address = getCache('address') @@ -227,21 +236,16 @@ export default { selectInvoice(type) { this.isInvoice = type if (!type) { - // 计算不开票的订单信息 - if (this.noInvoiceInfo) { - this.orderInfo = this.noInvoiceInfo - } else { - // 请求后端获取价格信息 - calcNotInvoiceOrderInfo({ - customerOrderId: this.orderInfo.orderId, - invoiceOrNot: invoiceStatusEnum.NO_INVOICE // 1: 不开票 - }).then((res) => { - if (res) { - this.noInvoiceInfo = res - this.orderInfo = res - } - }) - } + // 请求后端获取价格信息 + calcNotInvoiceOrderInfo({ + customerOrderId: this.orderInfo.orderId, + invoiceOrNot: invoiceStatusEnum.NO_INVOICE, // 1: 不开票 + paymentMethod: this.payMap[this.currentPayType].value + }).then((res) => { + if (res) { + this.orderInfo = res + } + }) } else { this.orderInfo = this.invoiceInfo } @@ -287,7 +291,14 @@ export default { icon: 'success', success: () => { setTimeout(() => { - window.location.href = res.signUrl + // #ifdef APP-PLUS + go2('page-view', { title: '合同签署', url: encodeURIComponent(res.signUrl) }) + // #endif + // #ifdef H5 + if (window) { + window.location.href = res.signUrl + } + // #endif }, 1000) } }) @@ -297,37 +308,62 @@ export default { this.loading = false }) }, - init() { - // 获取月结额度 + completePayment(paymentMethods) { + let map = { + [paymentMethodEnum.MONTHLY_PAY]: 'month', + [paymentMethodEnum.FLY_PAY]: 'fs', + [paymentMethodEnum.WECHAT_PAY]: 'wxpay' + } + if (paymentMethods && paymentMethods.length > 0) { + for (let item of paymentMethods) { + // 飞算额度查询 + if (item.value == this.payMap.fs.value) { + this.payMap.fs.isShow = true + this.completeFsCredit() + } + // 月结额度查询 + if (item.value == this.payMap.month.value) { + this.payMap.month.isShow = true + this.completeMonthCredit() + } + // 微信支付 + if (item.value == this.payMap.wxpay.value) { + this.payMap.wxpay.isShow = true + } + if (item.isDefault) { + this.currentPayType = map[item.value] + } + } + } + }, + // 获取月结额度 + completeMonthCredit() { getMonthCredit({ enterpriseId: this.$store.state.companyInfo.id, supplierId: this.$store.state.supplierId }).then((res) => { if (res) { - if (res.supplierCredit !== null) { - this.payMap['month'].availableCreditLine = res.supplierCredit - } else { - this.payMap['month'] = null + this.payMap['month'].availableCreditLine = res.supplierCredit + if (this.payMap['month'].availableCreditLine < this.orderInfo.totalOfferPrice && this.currentPayType == 'month') { + this.currentPayType = null } } else { - this.payMap['month'] = null + this.payMap['month'].isShow = false } }) - // 获取飞算额度 + }, + // 获取飞算额度 + completeFsCredit() { getFsCredit({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => { - if (isObject(res)) { + if (res) { this.payMap['fs'].availableCreditLine = res.availableCreditLine + if (this.payMap['fs'].availableCreditLine < this.orderInfo.totalOfferPrice && this.currentPayType == 'fs') { + this.currentPayType = null + } } else { - this.payMap['fs'] = null - } - }) - // 获取默认地址 - getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => { - if (res) { - this.deliveryAddress = res - this.deliveryAddress.addressId = res.id + this.payMap['fs'].isShow = false } }) } diff --git a/static/imgs/.DS_Store b/static/imgs/.DS_Store index f4ec0cd..ac42259 100644 Binary files a/static/imgs/.DS_Store and b/static/imgs/.DS_Store differ diff --git a/static/imgs/digital-workshops/个人中心.sketch b/static/imgs/digital-workshops/个人中心.sketch new file mode 100644 index 0000000..d9fc5ac Binary files /dev/null and b/static/imgs/digital-workshops/个人中心.sketch differ diff --git a/static/imgs/mine/.DS_Store b/static/imgs/mine/.DS_Store deleted file mode 100644 index 5008ddf..0000000 Binary files a/static/imgs/mine/.DS_Store and /dev/null differ diff --git a/static/imgs/mine/address-icon.png b/static/imgs/mine/address-icon.png new file mode 100644 index 0000000..0518249 Binary files /dev/null and b/static/imgs/mine/address-icon.png differ diff --git a/static/imgs/mine/certification-icon.png b/static/imgs/mine/certification-icon.png new file mode 100644 index 0000000..fa4b43c Binary files /dev/null and b/static/imgs/mine/certification-icon.png differ diff --git a/static/imgs/mine/certified-icon.png b/static/imgs/mine/certified-icon.png new file mode 100644 index 0000000..8ad38cf Binary files /dev/null and b/static/imgs/mine/certified-icon.png differ diff --git a/static/imgs/mine/client-default.png b/static/imgs/mine/client-default.png new file mode 100644 index 0000000..37557b5 Binary files /dev/null and b/static/imgs/mine/client-default.png differ diff --git a/static/imgs/mine/contract-icon.png b/static/imgs/mine/contract-icon.png new file mode 100644 index 0000000..13dc629 Binary files /dev/null and b/static/imgs/mine/contract-icon.png differ diff --git a/static/imgs/mine/default-avatar.png b/static/imgs/mine/default-avatar.png new file mode 100644 index 0000000..8976eb6 Binary files /dev/null and b/static/imgs/mine/default-avatar.png differ diff --git a/static/imgs/mine/enquiry-icon.png b/static/imgs/mine/enquiry-icon.png new file mode 100644 index 0000000..b26f8f1 Binary files /dev/null and b/static/imgs/mine/enquiry-icon.png differ diff --git a/static/imgs/mine/enterprise-icon.png b/static/imgs/mine/enterprise-icon.png new file mode 100644 index 0000000..07ebedc Binary files /dev/null and b/static/imgs/mine/enterprise-icon.png differ diff --git a/static/imgs/mine/logout-icon.png b/static/imgs/mine/logout-icon.png new file mode 100644 index 0000000..e0914a9 Binary files /dev/null and b/static/imgs/mine/logout-icon.png differ diff --git a/static/imgs/mine/mine-top-bg.png b/static/imgs/mine/mine-top-bg.png new file mode 100644 index 0000000..ec34e1e Binary files /dev/null and b/static/imgs/mine/mine-top-bg.png differ diff --git a/static/imgs/mine/non-certified-icon.png b/static/imgs/mine/non-certified-icon.png new file mode 100644 index 0000000..aa5c772 Binary files /dev/null and b/static/imgs/mine/non-certified-icon.png differ diff --git a/static/imgs/mine/order-all-icon.png b/static/imgs/mine/order-all-icon.png new file mode 100644 index 0000000..16af855 Binary files /dev/null and b/static/imgs/mine/order-all-icon.png differ diff --git a/static/imgs/mine/order-done-icon.png b/static/imgs/mine/order-done-icon.png new file mode 100644 index 0000000..1964b7e Binary files /dev/null and b/static/imgs/mine/order-done-icon.png differ diff --git a/static/imgs/mine/order-icon.png b/static/imgs/mine/order-icon.png new file mode 100644 index 0000000..27b06a6 Binary files /dev/null and b/static/imgs/mine/order-icon.png differ diff --git a/static/imgs/mine/order-ing-icon.png b/static/imgs/mine/order-ing-icon.png new file mode 100644 index 0000000..da800cc Binary files /dev/null and b/static/imgs/mine/order-ing-icon.png differ diff --git a/static/imgs/mine/order-ready-icon.png b/static/imgs/mine/order-ready-icon.png new file mode 100644 index 0000000..7d56a86 Binary files /dev/null and b/static/imgs/mine/order-ready-icon.png differ diff --git a/static/imgs/mine/order-supplier-ready-icon.png b/static/imgs/mine/order-supplier-ready-icon.png new file mode 100644 index 0000000..8612ee1 Binary files /dev/null and b/static/imgs/mine/order-supplier-ready-icon.png differ diff --git a/static/imgs/mine/user-avatar.png b/static/imgs/mine/user-avatar.png new file mode 100644 index 0000000..4df69c8 Binary files /dev/null and b/static/imgs/mine/user-avatar.png differ diff --git a/store/index.js b/store/index.js index d27e794..dfb9d75 100644 --- a/store/index.js +++ b/store/index.js @@ -53,9 +53,24 @@ if (!store) { nextPage: { name: '', data: {} + }, + /** + * 监听cache的type即可,每次取值后都必须调用commit('resetCache') + */ + cache: { + type: 'none', + data: null } }, mutations: { + setCache(state, { type, data }) { + state.cache.type = type + state.cache.data = data + }, + resetCache(state) { + state.cache.type = 'none' + state.cache.data = null + }, setUecToken(state, token) { try { uni.setStorageSync('uecToken', token) diff --git a/utils/hook.js b/utils/hook.js index 7ca9b03..e3a2309 100644 --- a/utils/hook.js +++ b/utils/hook.js @@ -343,3 +343,30 @@ export function saveImageToPhotosAlbum(path) { }) }) } + +/** + * 根据类型获取缓存 + * @param {string} type 缓存类型 + * @returns object 缓存数据 + */ +export function getCache(type) { + let data = null + if (store.state.cache.type === type) { + data = store.state.cache.data + // 防止同一事件循环的数据竞争 + setTimeout(() => { + store.commit('resetCache') + }) + } + return data +} + +/** + * 设置缓存 + * @param {string} type 缓存类型 + * @param {object} data 缓存数据 + * @returns null + */ +export function setCache(type, data) { + store.commit('setCache', { type, data }) +}