From ec7d686245e7c4232e9ddf83f5d6da23dafce162 Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Thu, 23 Jan 2025 00:57:47 +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/common/js/config.js | 3 +- jiuyi2/components/index/indexVideo.vue | 4 +- jiuyi2/components/shop/detail/makeOrder.vue | 131 ++++++++++++- jiuyi2/pages/mine/mine.vue | 4 +- jiuyi2/pages/shop/collect.vue | 177 +++++++++++++++--- .../components/jy-commodity-foot/index.vue | 159 ++-------------- jiuyi2/readme.md | 22 +++ jiuyi2/vite.config.js | 4 +- 8 files changed, 322 insertions(+), 182 deletions(-) diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index 48a4a1f3..958515aa 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -5,7 +5,8 @@ const config = { host: 'http://localhost:5173', // #endif // #ifndef H5 - host: 'http://2h34ni.natappfree.cc', + // host: 'http://91f.xyz:8080', + host: 'http://ugcege.natappfree.cc', // #endif // 支付方式配置 payType: { diff --git a/jiuyi2/components/index/indexVideo.vue b/jiuyi2/components/index/indexVideo.vue index ef4fa7a5..2016c2e5 100644 --- a/jiuyi2/components/index/indexVideo.vue +++ b/jiuyi2/components/index/indexVideo.vue @@ -521,8 +521,8 @@ - - + + diff --git a/jiuyi2/components/shop/detail/makeOrder.vue b/jiuyi2/components/shop/detail/makeOrder.vue index ec6be2bf..eebbaa51 100644 --- a/jiuyi2/components/shop/detail/makeOrder.vue +++ b/jiuyi2/components/shop/detail/makeOrder.vue @@ -1,5 +1,7 @@ - + @@ -119,7 +192,7 @@ - + @@ -130,13 +203,51 @@ - - - 立即下单 ¥{{total}} + + + 立即下单 ¥{{total}} + 确定 - \ No newline at end of file diff --git a/jiuyi2/pages/mine/mine.vue b/jiuyi2/pages/mine/mine.vue index e5d1de08..a1e12a9b 100644 --- a/jiuyi2/pages/mine/mine.vue +++ b/jiuyi2/pages/mine/mine.vue @@ -69,7 +69,7 @@ - + {{ userinfo.userNickname }} @@ -90,7 +90,7 @@ - + 我的钱包 diff --git a/jiuyi2/pages/shop/collect.vue b/jiuyi2/pages/shop/collect.vue index d502feaa..1e65e80a 100644 --- a/jiuyi2/pages/shop/collect.vue +++ b/jiuyi2/pages/shop/collect.vue @@ -4,6 +4,8 @@ import { ref, reactive, + computed, + getCurrentInstance, } from 'vue'; import apex from '@/components/header/apex' import { @@ -17,12 +19,46 @@ import api from '@/api/index.js'; // util import util from '@/common/js/util'; + // 生成订单 + import makeOrder from '@/components/shop/detail/makeOrder.vue' + + const { + proxy + } = getCurrentInstance() // const setting = ref(false) + // 当前操作的收藏下标 + const listCurrent = reactive([0, 0]) // 收藏列表 const list = reactive({ data: [], }) + // 已选的商品列表 + const selectList = computed(() => { + let result = [] + list.data.map(item => { + result.push(...item.shopifyProductInfos.filter(secItem => secItem.selected)) + }) + return result + }) + // 总价 + const totalPrice = computed(() => { + return selectList.value.reduce((last, current) => { + return last + current.price * current.payNum + }, 0) + }) + // 当前商品 + const productCurrent = computed({ + get() { + let result = {} + if (list.data[listCurrent[0]]) result = list.data[listCurrent[0]].shopifyProductInfos[listCurrent[ + 1]] + return result + }, + set(val) { + list.data[listCurrent[0]].shopifyProductInfos[listCurrent[1]] = val + } + }) onLoad(() => { // 获取列表 @@ -32,9 +68,25 @@ // 获取列表 function getList() { api.shop.getCollectList({}).then(res => { - console.log(res) if (res.code == 200) { - list.data = res.data + // 收藏列表的数据 + list.data = res.data.map(item => { + // 收藏列表里面的商品 + item.shopifyProductInfos = item.shopifyProductInfos.map(secItem => { + // 产品图片 + secItem.formatSliderImage = secItem.sliderImage.split(',')[0] + // 产品购买数量 + secItem.payNum = 1 + // 产品规格的索引 + secItem.spaceIndex = 0 + // 产品购买规格 + secItem.spec = secItem.specs[secItem.spaceIndex] || {} + // 是否选择 + secItem.selected = false + return secItem + }) + return item + }) return } util.alert({ @@ -46,10 +98,84 @@ /** * 规格选择 - * @param {Object} secItem + * @param {Object} index + * @param {Object} secIndex */ - function handleSpec(secItem) { - // + function handleSpec(index, secIndex) { + Object.assign(listCurrent, [index, secIndex]) + proxy.$refs.makeOrderRef.open({ + spaceIndex: productCurrent.value.spaceIndex, + payNum: productCurrent.value.payNum, + }) + } + + /** + * 选择规格和数量 + * @param {Object} event + */ + function handleMakeConfirm(event) { + productCurrent.value.payNum = event.payNum + productCurrent.value.spec = event.spec + productCurrent.value.spaceIndex = event.spaceIndex + } + + /** + * 商品的选中 + * @param {Object} index 商家下标 + * @param {Object} secIndex 商品下标 + */ + function handleSelect(index, secIndex) { + const item = list.data[index].shopifyProductInfos[secIndex] + item.selected = !item.selected + } + + // 取消收藏 + function handleCancelCollect() { + console.log('data', selectList.value, list.data) + } + + // 提交 + function handleSubmit() { + console.log('data', selectList.value, list.data) + // 验证必填项 + if (selectList.value.length == 0) { + util.alert('请选择商品') + return + } + + let data = selectList.value.map(item => { + return { + // 产品id + productId: item.id, + // 规格id + attrValueId: item.spec.id, + // 数量 + payNum: item.payNum, + // 0-普通订单,1-视频号订单 + orderType: 0, + } + }) + + console.log('request data', data) + // 产生待付款订单 + api.shop.addOrder({ + data, + }).then(rs => { + if (rs.code === 200) { + // 如果返回了订单 继续支付订单 + if (rs.data && rs.data[0]) uni.navigateTo({ + url: util.setUrl('/pages/shop/commodity/payment', { + orderId: rs.data[0].orderId, + }) + }) + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + } @@ -65,36 +191,36 @@ - + - + {{item.name}} - - - \ No newline at end of file diff --git a/jiuyi2/readme.md b/jiuyi2/readme.md index 1098f23b..e1982a02 100644 --- a/jiuyi2/readme.md +++ b/jiuyi2/readme.md @@ -387,3 +387,25 @@ likeType 9:已取消 +收藏 改成只能查看列表 + +金额显示的状态和商家同步 +买家进行付款之后 卖家显示是待结算 +分润相关的人显示待结算 +买家进行确认收货 这笔钱显示待入账 +分润相关的人显示待入账 +7天无理由结束后 这笔钱进入到了商家可提现的钱包中 分润相关人员入账 + +聊天界面的卡片展示fee + + +1. 会员确认收货、售后、商家进行售后 + 会员发起售后 + 会员没有收货 只能仅退款 + 商家确认收货 完成退货流程 + 已收货之后 只能退货退款 + 商家进行审核 + 会员填写物流信息 商家进行确认 完成退货退款 +2. 收藏分享佣金 +3. 钱包明细 + diff --git a/jiuyi2/vite.config.js b/jiuyi2/vite.config.js index 693b5bfd..15f22a35 100644 --- a/jiuyi2/vite.config.js +++ b/jiuyi2/vite.config.js @@ -4,8 +4,8 @@ import { import uni from '@dcloudio/vite-plugin-uni'; // -// let target = 'http://101.35.80.139:8080' -let target = 'http://8ii5rt.natappfree.cc' +// let target = 'http://91f.xyz:8080' +let target = 'http://ugcege.natappfree.cc' export default defineConfig({ plugins: [uni()],