diff --git a/jiuyi2/common/js/config.js b/jiuyi2/common/js/config.js
index 000f8b79..33b5e2b4 100644
--- a/jiuyi2/common/js/config.js
+++ b/jiuyi2/common/js/config.js
@@ -6,8 +6,8 @@ const config = {
// host: 'h5api',
// #endif
// #ifndef H5
- host: 'http://91f.xyz:8080',
- // host: 'http://25f49356.r24.cpolar.top',
+ // host: 'http://91f.xyz:8080',
+ host: 'http://8vtja7.natappfree.cc',
// #endif
// 支付方式配置
payType: {
diff --git a/jiuyi2/components/index/indexVideo.vue b/jiuyi2/components/index/indexVideo.vue
index d6cbc10d..7e93a6b8 100644
--- a/jiuyi2/components/index/indexVideo.vue
+++ b/jiuyi2/components/index/indexVideo.vue
@@ -69,9 +69,10 @@
default: 0,
},
})
+
//
const emit = defineEmits(['showTime', 'showComment', 'showCollect', 'showFastCollect', 'showShareFirend', 'onPlay',
- 'onPause', 'like', 'detailMenu', 'onEnd', 'longtap', 'dataCenter'
+ 'onPause', 'like', 'detailMenu', 'onEnd', 'longtap', 'dataCenter', 'showProduct'
])
// 视频上下文对象
@@ -458,11 +459,17 @@
videoCtx.value.playbackRate(2)
}
- //
+ // 前往数据中心
function handleData() {
emit('dataCenter', props.item)
}
+ // 点击商品广告
+ function handleShowProduct() {
+ console.log('handleShowProduct')
+ emit('showProduct', props.item)
+ }
+
//
defineExpose({
play,
@@ -620,7 +627,8 @@
-
+
diff --git a/jiuyi2/components/index/proDetailAlt.vue b/jiuyi2/components/index/proDetailAlt.vue
new file mode 100644
index 00000000..fced38ba
--- /dev/null
+++ b/jiuyi2/components/index/proDetailAlt.vue
@@ -0,0 +1,136 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jiuyi2/components/shop/detail/detail.vue b/jiuyi2/components/shop/detail/detail.vue
index 945f75e1..052819b3 100644
--- a/jiuyi2/components/shop/detail/detail.vue
+++ b/jiuyi2/components/shop/detail/detail.vue
@@ -2,11 +2,604 @@
/**
* 商品详情
*/
+
+ import {
+ ref,
+ reactive,
+ nextTick,
+ getCurrentInstance,
+ computed,
+ onMounted,
+ onUnmounted,
+ defineProps,
+ } from 'vue'
+ import {
+ useStore
+ } from 'vuex'
+ // 接口地址
+ import api from '@/api/index.js'
+ //
+ import util from '@/common/js/util.js'
+
+ // 传参
+ const props = defineProps({
+ id: {
+ type: [Number, String],
+ default: ''
+ },
+ detail: {
+ type: Object,
+ default: {}
+ },
+ })
+
+ const {
+ proxy
+ } = getCurrentInstance()
+ // 在这里设置swiper高度补足多端差异
+ const bannerHeight = ref('800rpx')
+ // 轮播图详情
+ const bannerIndex = ref(0)
+ // 商品评论
+ const comment = reactive({
+ list: [],
+ total: 0,
+ })
+ // 最近购买订单列表
+ const recentOrderList = ref([])
+ //
+ const menuFn = {
+ // 店铺
+ store() {
+ link('/pages/shop/store/index')
+ },
+ // 客服
+ customerService() {
+ link('/pages/news/question-answer/index')
+ },
+ // 收藏
+ heibianStar() {
+ //
+ }
+ }
+ // 已选择的规格下标
+ const spaceIndex = ref(0)
+ // 数量
+ const payNum = ref(1)
+ // 当前选择的规格
+ const currentSpec = computed(() => {
+ let spec = props.detail.specs || []
+ return spec[spaceIndex.value] || {}
+ })
+ // 应付总价
+ const total = computed(() => {
+ let price = parseFloat(props.detail.price) * 100
+ let result = parseInt(price * payNum.value) / 100
+ return result
+ })
+ // 详情
+ const banner = computed(() => {
+ let result = []
+ if (props.detail.sliderImage) result = props.detail.sliderImage.split(',')
+ return result
+ })
+ // 当前登录的用户信息
+ const userinfo = computed(() => {
+ return uni.$store.state.userinfo
+ })
+
+ onMounted(() => {
+ // 获取商品评论
+ getProComment()
+ // 获取最近购买
+ getRecentOrder()
+ })
+
+
+ // 获取最近购买
+ function getRecentOrder() {
+ api.shop.recentOrder({
+ query: {
+ // 产品id
+ productId: props.id,
+ }
+ }).then(rs => {
+ if (rs.code == 200) {
+ // 结果
+ const result = rs.data
+ let list = []
+ //
+ for (let i = 0; i < result.length / 2; i++) {
+ if (!result[i * 2 + 1]) break
+ list.push([result[i * 2], result[i * 2 + 1]])
+ }
+ recentOrderList.value = list
+ return
+ }
+ util.alert({
+ content: rs.msg,
+ showCancel: false,
+ })
+ })
+ }
+
+ // 获取商品评论
+ function getProComment() {
+ api.shop.getProComment({
+ query: {
+ // 产品id
+ productId: props.id,
+ pageNum: 1,
+ pageSize: 2,
+ }
+ }).then(rs => {
+ if (rs.code == 200) {
+ comment.list = rs.rows
+ comment.total = rs.total
+ return
+ }
+ util.alert({
+ content: rs.msg,
+ showCancel: false,
+ })
+ })
+ }
+
+ /**
+ * 跳转路径
+ * @param {Object} url
+ */
+ function link(url) {
+ uni.navigateTo({
+ url,
+ })
+ }
+
+ // 收藏店铺
+ function handleCollectStore() {
+ api.shop.followShop({
+ data: {
+ shopId: props.detail.merId,
+ status: {
+ 0: 1,
+ 1: 0,
+ } [props.detail.isFollow]
+ }
+ }).then(rs => {
+ if (rs.code == 200) {
+ // 关注状态
+ props.detail.isFollow = {
+ 0: 1,
+ 1: 0,
+ } [props.detail.isFollow]
+ // 关注数量
+ props.detail.merFollowNumber = rs.data
+ return
+ }
+ util.alert({
+ content: rs.msg,
+ showCancel: false,
+ })
+ })
+ }
+
+ // 商品收藏
+ 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({
+ query: {
+ shopId: props.detail.merId
+ }
+ }).then(rs => {
+ if (rs.code == 200) {
+ Object.assign(props.detail, {}, rs.data)
+ return
+ }
+ util.alert({
+ content: rs.msg,
+ showCancel: false,
+ })
+ })
+ }
+
+ /**
+ * 立即下单
+ */
+ 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,
+ })
+ })
+ }
-
+
+
+
+
+ bannerIndex = $event.detail.current">
+
+
+
+
+
+
+
+ {{ bannerIndex + 1 }} / {{ banner.length }}
+
+
+
+
+
+
+
+ ¥
+ {{detail.price}}
+
+
+
+
+ 已售 {{detail.sales}}
+
+
+
+
+
+
+ 限时直降0.5元
+
+
+ 平台立减1元
+
+
+ 关注店铺1元优惠券
+
+
+
+
+
+ {{detail.name}}
+
+
+
+ 商品修改历史
+
+
+
+
+
+
+ 假一赔十
+
+
+ 7天无理由退货
+
+
+ 全场包邮
+
+
+ 48h内发货
+
+
+ 支持先用后付
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{secItem.nickname}}
+
+
+
+
+ {{secItem.time}}
+
+
+
+ 立即购买
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.nickname}}
+
+
+
+ {{item.content}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 已
+ 关注
+
+
+
+
+
+
+ 宝贝详情
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 立即购买
+
+
+
-
\ No newline at end of file
diff --git a/jiuyi2/components/shop/detail/footerMenu.vue b/jiuyi2/components/shop/detail/footerMenu.vue
new file mode 100644
index 00000000..c09622ea
--- /dev/null
+++ b/jiuyi2/components/shop/detail/footerMenu.vue
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jiuyi2/pages/index/index.nvue b/jiuyi2/pages/index/index.nvue
index 8ab5db7c..5581a503 100644
--- a/jiuyi2/pages/index/index.nvue
+++ b/jiuyi2/pages/index/index.nvue
@@ -45,6 +45,8 @@
import fastCollect from '@/components/index/fastCollect.vue';
// 青少年模式
import teen from '@/components/index/teen.vue'
+ // 产品详情弹窗
+ import productAlt from '@/components/index/proDetailAlt.vue'
const {
proxy
@@ -208,6 +210,8 @@
viewSize.width = option.size.width
})
}, 50)
+ //
+ proxy.$refs.productAltRef.init()
})
onShow(() => {
@@ -273,6 +277,7 @@
// 获取推荐视频
function getRecList() {
console.log('getRecList')
+ return
// 获取首页分页视频
api.video.homeVideo({
query: {
@@ -669,6 +674,15 @@
function showAlarm() {
proxy.$refs.timeRef.open()
}
+
+ /**
+ * 打开产品弹窗
+ * @param {Object} item 视频列表项
+ */
+ function handleShowProduct(item) {
+ // 打开产品详情弹窗
+ proxy.$refs.productAltRef.init(item.productId)
+ }
@@ -731,7 +745,8 @@
@showTime="handleShowTime" @showComment="handleShowCommentAlt"
@showCollect="handleShowCollectAlt" @showShareFirend="handleShowShareFirend"
@onPlay="handleVideoOnPlay" @onPause="handleVideoOnPause" @like="videoLike"
- @longtap="$refs.moreMenuRef.open(secItem)" @showFastCollect="handleShowFastCollect" />
+ @longtap="$refs.moreMenuRef.open(secItem)" @showFastCollect="handleShowFastCollect"
+ @showProduct="handleShowProduct" />
@@ -763,6 +778,8 @@
+
+
diff --git a/jiuyi2/pages/release/commodity.vue b/jiuyi2/pages/release/commodity.vue
index 9ca842cb..7137774e 100644
--- a/jiuyi2/pages/release/commodity.vue
+++ b/jiuyi2/pages/release/commodity.vue
@@ -319,11 +319,16 @@
添加链接到视频
+
再第几秒展示
+
+
+
+
diff --git a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue b/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
deleted file mode 100644
index 1ec72dc0..00000000
--- a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
+++ /dev/null
@@ -1,195 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
- 立即购买
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/jiuyi2/pages/shop/commodity/index.vue b/jiuyi2/pages/shop/commodity/index.vue
index e21f1cc7..8c72c7cf 100644
--- a/jiuyi2/pages/shop/commodity/index.vue
+++ b/jiuyi2/pages/shop/commodity/index.vue
@@ -24,31 +24,19 @@
import apex from './components/jy-commodity-head';
// 商品列表
import productList from '@/components/shop/productList/productList'
+ // 产品详情
+ import proDetail from '@/components/shop/detail/detail'
//底部
- import JyCommodityFoot from './components/jy-commodity-foot';
+ import footerMenu from '@/components/shop/detail/footerMenu';
+
const {
proxy
} = getCurrentInstance()
const store = useStore()
- // 产品详情
- const detail = reactive({})
// 产品id
const id = ref('')
- // 轮播图详情
- const bannerIndex = ref(0)
- // 商品评论
- const comment = reactive({
- list: [],
- total: 0,
- })
- // 最近购买订单列表
- const recentOrderList = ref([])
- // 详情
- const banner = computed(() => {
- let result = []
- if (detail.sliderImage) result = detail.sliderImage.split(',')
- return result
- })
+ // 产品详情
+ const detail = reactive({})
// 当前登录的用户信息
const userinfo = computed(() => {
return store.state.userinfo
@@ -60,10 +48,6 @@
getDetail()
// 添加商品浏览记录
addBrowsing()
- // 获取商品评论
- getProComment()
- // 获取最近购买
- getRecentOrder()
// 开启监听
addListener()
})
@@ -96,75 +80,6 @@
uni.$off('commodityDetail')
}
- // 获取最近购买
- function getRecentOrder() {
- api.shop.recentOrder({
- query: {
- // 产品id
- productId: id.value,
- }
- }).then(rs => {
- if (rs.code == 200) {
- // 结果
- const result = rs.data
- let list = []
- //
- for (let i = 0; i < result.length / 2; i++) {
- if (!result[i * 2 + 1]) break
- list.push([result[i * 2], result[i * 2 + 1]])
- }
- recentOrderList.value = list
- return
- }
- util.alert({
- content: rs.msg,
- showCancel: false,
- })
- })
- }
-
- // 获取商品评论
- function getProComment() {
- api.shop.getProComment({
- query: {
- // 产品id
- productId: id.value,
- pageNum: 1,
- pageSize: 2,
- }
- }).then(rs => {
- if (rs.code == 200) {
- comment.list = rs.rows
- comment.total = rs.total
- return
- }
- util.alert({
- content: rs.msg,
- showCancel: false,
- })
- })
- }
-
- // 添加商品浏览记录
- function addBrowsing() {
- // 验证登录
- util.isLogin(() => {
- try {
- // 添加浏览记录
- api.shop.addBrowsing({
- data: {
- userId: userinfo.value.id,
- goodsId: id.value
- },
- }).then(rs => {
- if (rs.code != 200) console.log('addbrows err', rs.msg)
- })
- } catch (ev) {
- console.log('addBrowsing', ev)
- }
- })
- }
-
// 获取详情
function getDetail() {
api.shop.productDetail({
@@ -185,94 +100,18 @@
})
}
- /**
- * 跳转路径
- * @param {Object} url
- */
- function link(url) {
- uni.navigateTo({
- url,
- })
- }
-
- // 收藏店铺
- function handleCollectStore() {
- api.shop.followShop({
- data: {
- shopId: detail.merId,
- status: {
- 0: 1,
- 1: 0,
- } [detail.isFollow]
- }
- }).then(rs => {
- if (rs.code == 200) {
- // 关注状态
- detail.isFollow = {
- 0: 1,
- 1: 0,
- } [detail.isFollow]
- // 关注数量
- detail.merFollowNumber = rs.data
- return
- }
- util.alert({
- content: rs.msg,
- showCancel: false,
- })
- })
- }
-
- // 商品收藏
- function handleCollect() {
- util.isLogin().then(rs => {
- //
- api.shop.addProductCollect({
+ // 添加商品浏览记录
+ function addBrowsing() {
+ // 验证登录
+ util.isLogin(() => {
+ // 添加浏览记录
+ api.shop.addBrowsing({
data: {
- productId: id.value,
- status: {
- 0: 1,
- 1: 0,
- } [detail.isCollect]
- }
+ userId: userinfo.value.id,
+ goodsId: id.value
+ },
}).then(rs => {
- if (rs.code == 200) {
- // 关注状态
- detail.isCollect = {
- 0: 1,
- 1: 0,
- } [detail.isCollect]
- // 关注数量
- detail.collectNumber = rs.data
- return
- }
- util.alert({
- content: rs.msg,
- showCancel: false,
- })
- })
- }).catch(() => {
- // 登录
- uni.navigateTo({
- url: '/pages/login/loginPhone'
- })
- })
- }
-
- // 获取店铺信息
- function getShop() {
- api.shop.shopDetail({
- query: {
- shopId: detail.merId
- }
- }).then(rs => {
- if (rs.code == 200) {
- Object.assign(detail, {}, rs.data)
- return
- }
- util.alert({
- content: rs.msg,
- showCancel: false,
+ if (rs.code != 200) console.log('addbrows err', rs.msg)
})
})
}
@@ -289,160 +128,10 @@
-
+
-
-
- bannerIndex = $event.detail.current">
-
-
-
-
-
-
- {{ bannerIndex + 1 }} / {{ banner.length }}
-
-
-
-
-
-
- ¥
- {{detail.price}}
-
-
-
-
- 已售 {{detail.sales}}
-
-
-
-
-
-
- 限时直降0.5元
-
-
- 平台立减1元
-
-
- 关注店铺1元优惠券
-
-
-
-
- {{detail.name}}
-
-
- 商品修改历史
-
-
-
-
-
-
- 假一赔十
-
-
- 7天无理由退货
-
-
- 全场包邮
-
-
- 48h内发货
-
-
- 支持先用后付
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{secItem.nickname}}
-
-
- {{secItem.time}}
-
- 立即购买
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{item.nickname}}
-
- {{item.content}}
-
-
-
-
-
-
-
-
-
-
-
- 已
- 关注
-
-
-
-
-
-
- 宝贝详情
-
-
-
-
-
-
+
+
@@ -450,136 +139,10 @@
-
+
\ No newline at end of file
diff --git a/jiuyi2/vite.config.js b/jiuyi2/vite.config.js
index 91f94ecf..82f957a3 100644
--- a/jiuyi2/vite.config.js
+++ b/jiuyi2/vite.config.js
@@ -3,9 +3,8 @@ import {
} from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
-let target = 'http://91f.xyz:8080'
-// let target = 'http://25f49356.r24.cpolar.top'
-// let target = 'http://25f49356.r24.cpolar.top'
+// let target = 'http://91f.xyz:8080'
+let target = 'http://8vtja7.natappfree.cc'
export default defineConfig({
plugins: [uni()],