diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js index 33b5e2b4..aa30024d 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -7,7 +7,7 @@ const config = { // #endif // #ifndef H5 // host: 'http://91f.xyz:8080', - host: 'http://8vtja7.natappfree.cc', + host: 'http://d5si5v.natappfree.cc', // #endif // 支付方式配置 payType: { diff --git a/jiuyi2/common/js/util.js b/jiuyi2/common/js/util.js index 6f8e03a1..7be2bd8a 100644 --- a/jiuyi2/common/js/util.js +++ b/jiuyi2/common/js/util.js @@ -134,7 +134,7 @@ const util = { reject(res) }, complete(rs) { - console.log('upload complete',rs) + console.log('upload complete', rs) } }) }) diff --git a/jiuyi2/components/index/indexVideo.vue b/jiuyi2/components/index/indexVideo.vue index 7e93a6b8..51652a8d 100644 --- a/jiuyi2/components/index/indexVideo.vue +++ b/jiuyi2/components/index/indexVideo.vue @@ -72,7 +72,7 @@ // const emit = defineEmits(['showTime', 'showComment', 'showCollect', 'showFastCollect', 'showShareFirend', 'onPlay', - 'onPause', 'like', 'detailMenu', 'onEnd', 'longtap', 'dataCenter', 'showProduct' + 'onPause', 'like', 'detailMenu', 'onEnd', 'longtap', 'dataCenter', 'showProduct', 'proBuy' ]) // 视频上下文对象 @@ -466,10 +466,14 @@ // 点击商品广告 function handleShowProduct() { - console.log('handleShowProduct') emit('showProduct', props.item) } + // 点击商品广告购买 + function handleProBuy() { + emit('proBuy', props.item) + } + // defineExpose({ play, @@ -643,7 +647,7 @@ - 立即购买 + 立即购买 diff --git a/jiuyi2/components/index/proDetailAlt.vue b/jiuyi2/components/index/proDetailAlt.vue index fced38ba..0ec9256f 100644 --- a/jiuyi2/components/index/proDetailAlt.vue +++ b/jiuyi2/components/index/proDetailAlt.vue @@ -8,6 +8,7 @@ computed, onBeforeUnmount, defineProps, + defineEmits, } from 'vue'; // 工具库 import util from '@/common/js/util.js' @@ -25,6 +26,8 @@ const props = defineProps({ // }) + // + const emit = defineEmits(['buy']) // 商品id const proId = ref('42') // 详情 @@ -37,7 +40,7 @@ * @param {Object} productId 产品id */ function init(productId) { - if(productId) proId.value = productId + if (productId) proId.value = productId // 打开 open() @@ -83,6 +86,11 @@ }) } + // 购买 + function handleBuy() { + emit('buy', detail) + } + /** * 详情 * @param {Object} ev 修改的详情 @@ -111,15 +119,23 @@ @@ -127,10 +143,34 @@ \ 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 5b4d1448..8b548e75 100644 --- a/jiuyi2/components/public/jy-commodity-address/index.vue +++ b/jiuyi2/components/public/jy-commodity-address/index.vue @@ -59,7 +59,7 @@ \ No newline at end of file diff --git a/jiuyi2/components/shop/detail/detail.vue b/jiuyi2/components/shop/detail/detail.vue index 052819b3..c133ffd9 100644 --- a/jiuyi2/components/shop/detail/detail.vue +++ b/jiuyi2/components/shop/detail/detail.vue @@ -183,42 +183,6 @@ }) } - // 商品收藏 - function handleCollect() { - util.isLogin().then(rs => { - // - api.shop.addProductCollect({ - data: { - productId: id.value, - status: { - 0: 1, - 1: 0, - } [props.detail.isCollect] - } - }).then(rs => { - if (rs.code == 200) { - // 关注状态 - props.detail.isCollect = { - 0: 1, - 1: 0, - } [props.detail.isCollect] - // 关注数量 - props.detail.collectNumber = rs.data - return - } - util.alert({ - content: rs.msg, - showCancel: false, - }) - }) - }).catch(() => { - // 登录 - uni.navigateTo({ - url: '/pages/login/loginPhone' - }) - }) - } - // 获取店铺信息 function getShop() { api.shop.shopDetail({ @@ -236,252 +200,180 @@ }) }) } - - /** - * 立即下单 - */ - function handlePay(event) { - // 产生待付款订单 - api.shop.addOrder({ - data: [{ - // 地址id - addressId: event.address.id, - // 产品id - productId: props.detail.id, - // 规格id - attrValueId: event.spec.id, - // 数量 - payNum: event.payNum, - // 0-普通订单,1-视频号订单 - orderType: 0, - // 分享人id - // shareId: userinfo.id, - }], - }).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, - }) - }) - } \ No newline at end of file diff --git a/jiuyi2/components/shop/detail/footerMenu.vue b/jiuyi2/components/shop/detail/footerMenu.vue index c09622ea..6be46c0e 100644 --- a/jiuyi2/components/shop/detail/footerMenu.vue +++ b/jiuyi2/components/shop/detail/footerMenu.vue @@ -16,8 +16,6 @@ import { useStore } from 'vuex' - // 生成订单 - import makeOrder from '@/components/shop/detail/makeOrder.vue' const { proxy @@ -33,10 +31,46 @@ }, }) // - const emit = defineEmits(['update']) + const emit = defineEmits(['update', 'buy']) // 用户信息 const userinfo = computed(() => store.state.userinfo) + // 商品收藏 + function handleCollect() { + util.isLogin().then(rs => { + // + api.shop.addProductCollect({ + query: { + productId: props.detail.id, + type: { + 0: 1, + 1: 0, + } [props.detail.isCollect] + } + }).then(rs => { + if (rs.code == 200) { + // 关注状态 + props.detail.isCollect = { + 0: 1, + 1: 0, + } [props.detail.isCollect] + // 关注数量 + props.detail.collectNumber = rs.data + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + }).catch(() => { + // 登录 + uni.navigateTo({ + url: '/pages/login/loginPhone' + }) + }) + } + /** * 跳转 * @param {Object} url 跳转路径 @@ -46,12 +80,58 @@ url, }) } + + // 商品购买 + function handleBuy() { + emit('buy') + } \ No newline at end of file diff --git a/jiuyi2/components/shop/detail/makeOrder.vue b/jiuyi2/components/shop/detail/makeOrder.vue index 127098fd..8e6fa99c 100644 --- a/jiuyi2/components/shop/detail/makeOrder.vue +++ b/jiuyi2/components/shop/detail/makeOrder.vue @@ -168,21 +168,22 @@ - + + - - 他人推广 + 推广总数 {{detail.othersPromotionCount}} diff --git a/jiuyi2/pages/index/dataCenter/push.vue b/jiuyi2/pages/index/dataCenter/push.vue index 187e4cf2..96916d57 100644 --- a/jiuyi2/pages/index/dataCenter/push.vue +++ b/jiuyi2/pages/index/dataCenter/push.vue @@ -34,10 +34,7 @@ } = getCurrentInstance() const store = useStore() - const userinfo = computed(() => { - let result = store.state.userinfo - return result - }) + const userinfo = computed(() => store.state.userinfo) // 列表数据 const list = reactive({ @@ -128,10 +125,9 @@ // 获取列表 function getList() { // - api.video.myVideoList({ + api.video.myWorks({ query: { - isDraft: 0, - userId: form.userId, + userId: userinfo.value.id, pageSize: list.pageSize, pageNum: list.pageNum, } diff --git a/jiuyi2/pages/index/durian.vue b/jiuyi2/pages/index/durian.vue index a0adf211..280eb088 100644 --- a/jiuyi2/pages/index/durian.vue +++ b/jiuyi2/pages/index/durian.vue @@ -271,7 +271,7 @@ - 置换流量 + 置换流量 diff --git a/jiuyi2/pages/index/index.nvue b/jiuyi2/pages/index/index.nvue index 5581a503..ce16ab87 100644 --- a/jiuyi2/pages/index/index.nvue +++ b/jiuyi2/pages/index/index.nvue @@ -47,6 +47,8 @@ import teen from '@/components/index/teen.vue' // 产品详情弹窗 import productAlt from '@/components/index/proDetailAlt.vue' + // 产品规格弹窗 + import productSpecAlt from '@/components/shop/detail/makeOrder.vue' const { proxy @@ -126,6 +128,8 @@ const completeKey = ref('') // 底部菜单高度 const footerMenuHeight = ref(0) + // 当前产品详情 + const productDetail = reactive({}) // 当前任务 const task = computed(() => uni.$store.state.task) // 用户信息 @@ -211,7 +215,10 @@ }) }, 50) // - proxy.$refs.productAltRef.init() + // proxy.$refs.productAltRef.init() + handleProBuy({ + productId: 42, + }) }) onShow(() => { @@ -277,7 +284,6 @@ // 获取推荐视频 function getRecList() { console.log('getRecList') - return // 获取首页分页视频 api.video.homeVideo({ query: { @@ -683,6 +689,77 @@ // 打开产品详情弹窗 proxy.$refs.productAltRef.init(item.productId) } + + /** + * 商品弹窗购买 + * @param {Object} product + */ + function handleProductBuy(product) { + Object.assign(productDetail, {}, product) + // + proxy.$refs.productSpecAltRef.open() + } + + /** + * 商品购买 + * @param {Object} video 视频列表 + */ + function handleProBuy(video) { + // 获取商品详情 + api.shop.productDetail({ + query: { + // 产品id + productionId: video.productId, + }, + }).then(rs => { + if (rs.code == 200) { + // + handleProductBuy(rs.data) + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + } + + /** + * 立即下单 + */ + function handlePay(event) { + // 产生待付款订单 + api.shop.addOrder({ + data: [{ + // 地址id + addressId: event.address.id, + // 产品id + productId: productDetail.id, + // 规格id + attrValueId: event.spec.id, + // 数量 + payNum: event.payNum, + // 0-普通订单,1-视频号订单 + orderType: 1, + // 分享人id + // shareId: userinfo.id, + }], + }).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, + }) + }) + } diff --git a/jiuyi2/pages/release/commodity.vue b/jiuyi2/pages/release/commodity.vue index 7137774e..3fe367e1 100644 --- a/jiuyi2/pages/release/commodity.vue +++ b/jiuyi2/pages/release/commodity.vue @@ -17,7 +17,7 @@ id: '', categoryId: '', sliderImage: [], - spec: [], + specs: [], }) // 分类 const category = reactive([]) @@ -49,7 +49,7 @@ // 商品佣金 form.commission = detail.commission // 规格 - form.spec = detail.specs.map(item => { + form.specs = detail.specs.map(item => { return { image: item.image, sku: item.sku, @@ -109,7 +109,7 @@ // 添加商品规格 function handlePushSpec() { - form.spec.push({ + form.specs.push({ // 图片 image: '', // 名称 @@ -134,7 +134,7 @@ * @param {Object} index 下标 */ function handleRemoveSpec(index) { - form.spec.splice(index, 1) + form.specs.splice(index, 1) } // 上传轮播图 @@ -241,7 +241,7 @@ - + 规格{{index + 1}} diff --git a/jiuyi2/pages/shop/commodity/index.vue b/jiuyi2/pages/shop/commodity/index.vue index 8c72c7cf..358d1b40 100644 --- a/jiuyi2/pages/shop/commodity/index.vue +++ b/jiuyi2/pages/shop/commodity/index.vue @@ -28,6 +28,8 @@ import proDetail from '@/components/shop/detail/detail' //底部 import footerMenu from '@/components/shop/detail/footerMenu'; + // 生成订单 + import makeOrder from '@/components/shop/detail/makeOrder.vue' const { proxy @@ -123,6 +125,48 @@ function handleDetail(ev) { Object.assign(detail, {}, ev) } + + // 拉起订单 + function showMakeOrder() { + proxy.$refs.makeOrderRef.open() + } + + /** + * 立即下单 + */ + function handlePay(event) { + // 产生待付款订单 + api.shop.addOrder({ + data: [{ + // 地址id + addressId: event.address.id, + // 产品id + productId: detail.id, + // 规格id + attrValueId: event.spec.id, + // 数量 + payNum: event.payNum, + // 0-普通订单,1-视频号订单 + orderType: 0, + // 分享人id + // shareId: userinfo.id, + }], + }).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, + }) + }) + } \ No newline at end of file diff --git a/jiuyi2/vite.config.js b/jiuyi2/vite.config.js index 82f957a3..1c0ce84c 100644 --- a/jiuyi2/vite.config.js +++ b/jiuyi2/vite.config.js @@ -4,7 +4,7 @@ import { import uni from '@dcloudio/vite-plugin-uni'; // let target = 'http://91f.xyz:8080' -let target = 'http://8vtja7.natappfree.cc' +let target = 'http://d5si5v.natappfree.cc' export default defineConfig({ plugins: [uni()],