From 5f802e60acf345330ee01c1d6b5b6b0e26cbba62 Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Sun, 19 Jan 2025 22:56:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jiuyi2/api/shop.js | 40 ++++ jiuyi2/common/js/config.js | 21 +- jiuyi2/common/js/order.js | 34 +++ .../public/jy-commodity-address/index.vue | 10 +- jiuyi2/components/shop/order/item.vue | 20 +- jiuyi2/components/shop/order/order.js | 113 --------- jiuyi2/pages/shop/commodity/payment.vue | 217 +++++++++++++----- jiuyi2/pages/shop/order/index.vue | 151 +++++++++--- jiuyi2/readme.md | 15 ++ 9 files changed, 386 insertions(+), 235 deletions(-) create mode 100644 jiuyi2/common/js/order.js delete mode 100644 jiuyi2/components/shop/order/order.js diff --git a/jiuyi2/api/shop.js b/jiuyi2/api/shop.js index 7614a2b7..f8763317 100644 --- a/jiuyi2/api/shop.js +++ b/jiuyi2/api/shop.js @@ -292,6 +292,19 @@ const shop = { }) }, + /** + * 获取用户订单列表 + * @param {Object} param + */ + getOrderList(param) { + return util.request({ + url: `/shopify/appOrder/getOrderList`, + query: param.query, + method: 'GET', + load: true, + }) + }, + /** * 获取订单详情 * @param {Object} param @@ -304,6 +317,33 @@ const shop = { load: true, }) }, + + /** + * 订单支付 + * @param {Object} param + */ + orderPay(param) { + return util.request({ + url: `/shopify/appOrder/payOrder`, + query: param.query, + data: param.data, + method: 'POST', + load: true, + }) + }, + + /** + * 订单取消 + * @param {Object} param + */ + orderCancel(param) { + return util.request({ + url: `/shopify/appOrder/cancelOrder`, + query: param.query, + method: 'PUT', + load: true, + }) + }, } export default shop \ No newline at end of file diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index cf8cf25e..e6cd4728 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -8,16 +8,17 @@ const config = { host: 'https://539c1514.r24.cpolar.top', // host: 'http://gfjds5.natappfree.cc', // #endif - // 上传文件二级路径 - uploadFilePath: "/homecommon/file/preview?fileName=", - // 上传视频二级路径 - uploadVideoPath: '/homecommon/file/play?fileName=', - // 图片大小 单位m - img_size: 5, - // 视频限制大小 单位m - video_size: 300, - // h5路径 - h5: '', + // 支付方式配置 + payType: { + score: { + name: '积分', + img: '/static/images/pay/wechat.png', + }, + balance: { + name: '余额', + img: '/static/images/pay/wechat.png', + }, + }, // 腾讯im聊天 TChat: { // appid diff --git a/jiuyi2/common/js/order.js b/jiuyi2/common/js/order.js new file mode 100644 index 00000000..9c18c29d --- /dev/null +++ b/jiuyi2/common/js/order.js @@ -0,0 +1,34 @@ +// 工具库 +import util from '@/common/js/util.js' +// api +import api from '@/api/index.js' + +const order = { + /** + * 订单支付 + * @param {Object} event 事件对象 + */ + orderPay: (event) => { + return new Promise((resolve, reject) => { + api.shop.orderPay({ + query: { + ...event.query, + }, + data: [ + event.orderId, + ], + }).then(rs => { + if (res.code == 200) { + resolve(res.data) + return + } + util.alert({ + content: res.msg, + showCancel: false, + }) + }) + }) + } +} + +export default order \ No newline at end of file diff --git a/jiuyi2/components/public/jy-commodity-address/index.vue b/jiuyi2/components/public/jy-commodity-address/index.vue index c783b8bc..5b4d1448 100644 --- a/jiuyi2/components/public/jy-commodity-address/index.vue +++ b/jiuyi2/components/public/jy-commodity-address/index.vue @@ -8,7 +8,8 @@ computed, watch, onMounted, - onUnmounted + onUnmounted, + defineEmits, } from 'vue' const props = defineProps({ @@ -21,6 +22,8 @@ default: () => ({}) } }) + // + const emit = defineEmits(['update:address']) onMounted(() => { // 开启监听 @@ -36,7 +39,8 @@ function addListener() { // 选择收货地址 uni.$on('selectAddress', (event) => { - emit('update:value', event.target.value); + console.log('selectAddress', event) + emit('update:address', event); }) } @@ -74,7 +78,7 @@ - + 选择地址 diff --git a/jiuyi2/components/shop/order/item.vue b/jiuyi2/components/shop/order/item.vue index 7cf4d847..17d72fa9 100644 --- a/jiuyi2/components/shop/order/item.vue +++ b/jiuyi2/components/shop/order/item.vue @@ -33,10 +33,8 @@ - - 家纺专营店 + + {{item.merName}} @@ -53,24 +51,22 @@ - + - 靠枕 纯棉靠枕 车载居家 纯棉100% 卡通靠枕 人体工学 - 款式:普通款 小熊 + {{item.productName}} + 款式:{{item.sku}} - 89 + {{item.productPrice}} - x 1 + x {{item.totalNum}} @@ -80,7 +76,7 @@ 应付: 实收: - 89 + {{item.totalPrice}} diff --git a/jiuyi2/components/shop/order/order.js b/jiuyi2/components/shop/order/order.js deleted file mode 100644 index d3f8bae0..00000000 --- a/jiuyi2/components/shop/order/order.js +++ /dev/null @@ -1,113 +0,0 @@ -const menu = { - // '1 待付款' - // '2 待发货' - // '3 待收货' - // '4 待评价' - // '5 售后/退款' - // '6 已完成' - // '7 已取消' - - // - user: [{ - name: '取消订单', - type: 'black', - value: 'cancel_order', - status: [2] - }, - { - name: '继续付款', - type: 'orange', - value: 'continue_paying', - status: [2] - }, - { - name: '申请退款', - type: 'black', - value: 'refund', - status: [3, 4, 5] - }, - { - name: '崔发货', - type: 'orange', - status: [3] - }, - { - name: '查看物流', - type: 'black', - status: [4] - }, { - name: '确认收货', - type: 'orange', - status: [4] - }, { - name: '评价', - type: 'orange', - status: [5] - }, { - name: '删除记录', - type: 'black', - status: [6] - }, { - name: '售后详情', - type: 'black', - - status: [6] - }, { - name: '钱款去向', - type: 'black', - value: 'money_whereabouts', - status: [6] - }, { - name: '平台介入', - type: 'orange', - status: [6] - } - ], - shop: [{ - name: '改价', - type: 'orange', - value: 'change_price', - status: [2] - }, { - name: '发货', - type: 'orange', - value: 'delivery', - status: [3] - }, { - name: '拒绝退款', - type: 'black', - value: 'refund_refund', - status: [5] - }, { - name: '同意退款', - type: 'black', - value: 'agree_refund', - status: [5] - }, { - name: '联系用户', - type: 'orange', - value: 'contact_users', - status: [5] - }], - manage: [{ - name: '上架', - type: 'black', - value: 'grounding', - status: [1] - }, { - name: '下架', - type: 'black', - value: 'discontinue', - status: [1] - }, { - name: '编辑', - type: 'orange', - value: 'edit', - status: [1] - }] -} - -export default { - // 功能菜单 - menu, -} \ No newline at end of file diff --git a/jiuyi2/pages/shop/commodity/payment.vue b/jiuyi2/pages/shop/commodity/payment.vue index 23533308..7033ad91 100644 --- a/jiuyi2/pages/shop/commodity/payment.vue +++ b/jiuyi2/pages/shop/commodity/payment.vue @@ -1,6 +1,8 @@ @@ -77,94 +172,90 @@ - + - - 店铺名称 + + {{detail.merName}} - + - + - - 靠枕 纯棉靠枕 车载居家 纯棉100% 卡通靠枕 人体工学 - 升级款 小熊 + + {{item.productName}} + 升级款 {{item.sku}} - + - 5.48 + {{item.price}} - x1 + x{{item.payNum}} - - - 积分抵扣: - -¥ - 5.00 - 应付: - 5.00 + {{detail.totalPrice}} - - + 订单备注 - + - + 应付: - 5.48 + {{detail.totalPrice}} - - 继续付款 - - 剩余: - + + + + +