From 53bc5bb6dfc2f0d4e3a52d81543b7a016d79f98d Mon Sep 17 00:00:00 2001 From: sx <2427911852@qq.com> Date: Thu, 16 Jan 2025 20:18:22 +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 | 15 ++- jiuyi2/common/js/config.js | 4 +- jiuyi2/components/index/indexVideo.vue | 43 +++++-- jiuyi2/components/shop/detail/detail.vue | 12 ++ jiuyi2/pages.json | 26 +--- jiuyi2/pages/index/index.nvue | 19 +-- jiuyi2/pages/index/wallet/topUp.vue | 2 +- jiuyi2/pages/mine/mine.vue | 2 +- jiuyi2/pages/mine/setting/setting.vue | 2 +- jiuyi2/pages/mine/userinfo.vue | 1 + jiuyi2/pages/release/video.vue | 153 ++++++++++++++++++++--- jiuyi2/pages/shop/store/commodities.vue | 86 +++++++++++-- jiuyi2/pages/shop/store/order.vue | 6 +- 13 files changed, 290 insertions(+), 81 deletions(-) create mode 100644 jiuyi2/components/shop/detail/detail.vue diff --git a/jiuyi2/api/shop.js b/jiuyi2/api/shop.js index 0bc6c30c..0f51164b 100644 --- a/jiuyi2/api/shop.js +++ b/jiuyi2/api/shop.js @@ -195,7 +195,7 @@ const shop = { * 查看收藏记录 * @param {Object} param */ - addProductCollect(param) { + collect(param) { return util.request({ url: `/shopify/collect`, method: 'GET', @@ -253,6 +253,19 @@ const shop = { load: true, }) }, + + /** + * 获取发布的商品列表 + * @param {Object} param + */ + getProductionListByUserId(param) { + return util.request({ + url: `/shopify/appProductionApi/getProductionListByUserId`, + data: param.data, + method: 'GET', + 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 2ab926a8..97a8a1c4 100644 --- a/jiuyi2/common/js/config.js +++ b/jiuyi2/common/js/config.js @@ -6,8 +6,8 @@ const config = { // #endif // #ifndef H5 // host: 'http://1641c8e0.r22.cpolar.top', - // host: 'http://192.168.0.189:8080', - host: 'http://192.168.0.102:8080', + host: 'http://192.168.0.189:8080', + // host: 'http://192.168.0.102:8080', // #endif // 上传文件二级路径 uploadFilePath: "/homecommon/file/preview?fileName=", diff --git a/jiuyi2/components/index/indexVideo.vue b/jiuyi2/components/index/indexVideo.vue index 71c46a11..91095cc8 100644 --- a/jiuyi2/components/index/indexVideo.vue +++ b/jiuyi2/components/index/indexVideo.vue @@ -92,6 +92,8 @@ const isLong = ref(false) // 收藏按钮判定 const collectBtnActive = ref(false) + // 是否显示广告 + const showAd = ref(false) // 设置时间 const alarmTime = computed(() => { let result = uni.$store.state.alarmTime @@ -415,6 +417,10 @@ // 播放变化 function handleTimeupdate(ev) { videoTime.value = ev.detail + // 如果有商品id 并且 当前播放时间大于商家设定的广告弹出时间 + if (props.item.productId && (videoTime.value.currentTime > props.item.popupTime)) { + showAd.value = true + } // console.log('videoTime.value', videoTime.value) } @@ -591,18 +597,18 @@ - + - + - - 果农大王霹雳美味榴莲果子 + + {{item.productName}} - 超低价¥6.66 - 已售666+单 - + ¥{{item.productPrice}} + 已售{{item.sales}}单 + @@ -716,16 +722,35 @@ .panelBottom { padding-right: 150rpx; - // + // 图片 + .image { + width: 100rpx; + height: 100rpx; + } + + // 产品 .goods { padding: 10rpx; width: 480rpx; margin-bottom: 20rpx; background-color: rgba(0, 0, 0, .3); + opacity: 0; + transition-duration: .5s; + + // + &.active { + opacity: 1; + } + } + + // 产品图片 + .name .text { + lines: 2; + text-overflow: ellipsis; } } - // + // 视频播放进度条 .videoProgress { position: absolute; left: 0; diff --git a/jiuyi2/components/shop/detail/detail.vue b/jiuyi2/components/shop/detail/detail.vue new file mode 100644 index 00000000..945f75e1 --- /dev/null +++ b/jiuyi2/components/shop/detail/detail.vue @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/jiuyi2/pages.json b/jiuyi2/pages.json index 6ec3ccdd..64ce1450 100644 --- a/jiuyi2/pages.json +++ b/jiuyi2/pages.json @@ -38,27 +38,6 @@ "navigationBarBackgroundColor": "#fff" } }, - { - "path": "pages/merchant/order/index", - "style": { - "navigationBarTitleText": "商家订单", - "onReachBottomDistance": 100, - "navigationStyle": "custom" - } - }, - { - "path": "pages/merchant/commodity-release/index", - "style": { - "navigationBarTitleText": "发布商品" - } - }, - { - "path": "pages/merchant/specifications/index", - "style": { - "navigationBarTitleText": "规格", - "navigationStyle": "custom" - } - }, { "path": "pages/shop/commodity/index", "style": { @@ -81,7 +60,8 @@ "navigationStyle": "custom", "navigationBarTextStyle": "white" } - }, { + }, + { "path": "pages/shop/order/index", "style": { "navigationBarTitleText": "订单", @@ -822,7 +802,7 @@ "current": 0, "list": [{ "name": "test", - "path": "pages/index/wallet/wallet" + "path": "pages/index/index" }] }, diff --git a/jiuyi2/pages/index/index.nvue b/jiuyi2/pages/index/index.nvue index a7360571..adcd877f 100644 --- a/jiuyi2/pages/index/index.nvue +++ b/jiuyi2/pages/index/index.nvue @@ -125,23 +125,15 @@ // 底部菜单高度 const footerMenuHeight = ref(0) // 当前任务 - const task = computed(() => { - return uni.$store.state.task - }) + const task = computed(() => uni.$store.state.task) // 用户信息 const userinfo = computed(() => uni.$store.state.userinfo || {}) // 当前tab选中 - const tabCurrent = computed(() => { - return tab[tabIndex.value] - }) + const tabCurrent = computed(() => tab[tabIndex.value]) // 当前视频元素对象 - const currentVideoRef = computed(() => { - return proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]] - }) + const currentVideoRef = computed(() => proxy.$refs[`videoRef${tabIndex.value}`][current[tabIndex.value]]) // 系统配置 - const config = computed(() => { - return uni.$store.state.config - }) + const config = computed(() => uni.$store.state.config) // 加载完成之后 onLoad(() => { @@ -269,7 +261,6 @@ // 获取更多推荐视频 function getMoreRecList() { - console.log('recList', recList) if (recList.total <= recList.data.length) return recList.pageNum++ getRecList() @@ -284,7 +275,7 @@ pageSize: recList.pageSize, } }).then(rs => { - // console.log('getRecList then rs', rs) + console.log('getRecList then rs', rs) // 设置列表 setList(rs, recList) }).catch(rs => { diff --git a/jiuyi2/pages/index/wallet/topUp.vue b/jiuyi2/pages/index/wallet/topUp.vue index 06648b7f..d098955d 100644 --- a/jiuyi2/pages/index/wallet/topUp.vue +++ b/jiuyi2/pages/index/wallet/topUp.vue @@ -56,7 +56,7 @@ if (rs.code == 200) { uni.requestPayment({ provider: 'alipay', - orderInfo: rs.data, + orderInfo: rs.msg, success: rs => { console.log('requestPayment', rs) util.getPurse() diff --git a/jiuyi2/pages/mine/mine.vue b/jiuyi2/pages/mine/mine.vue index e0a7d019..49f9648a 100644 --- a/jiuyi2/pages/mine/mine.vue +++ b/jiuyi2/pages/mine/mine.vue @@ -175,7 +175,7 @@ 店铺管理 - + 商品管理 diff --git a/jiuyi2/pages/mine/setting/setting.vue b/jiuyi2/pages/mine/setting/setting.vue index 9be8605a..5e06e58a 100644 --- a/jiuyi2/pages/mine/setting/setting.vue +++ b/jiuyi2/pages/mine/setting/setting.vue @@ -118,7 +118,7 @@ - + {{userinfo.userNickname}} diff --git a/jiuyi2/pages/mine/userinfo.vue b/jiuyi2/pages/mine/userinfo.vue index fd8aa564..3150837b 100644 --- a/jiuyi2/pages/mine/userinfo.vue +++ b/jiuyi2/pages/mine/userinfo.vue @@ -54,6 +54,7 @@ user.personalSignature = userinfo.personalSignature user.id = userinfo.id + '' user.birthday = userinfo.birthday + user.avatar = userinfo.avatar // 修改性别下标 genderIndex.value = gender.findIndex(item => item.id == userinfo.sex) } diff --git a/jiuyi2/pages/release/video.vue b/jiuyi2/pages/release/video.vue index dead17cd..18a83349 100644 --- a/jiuyi2/pages/release/video.vue +++ b/jiuyi2/pages/release/video.vue @@ -6,11 +6,15 @@ import { reactive, getCurrentInstance, - ref + ref, + computed, } from 'vue'; import { onLoad, } from '@dcloudio/uni-app' + import { + useStore + } from 'vuex' // 工具库 import util from '@/common/js/util'; // api @@ -19,6 +23,7 @@ const { proxy } = getCurrentInstance() + const store = useStore() class Form { videoId = '' @@ -62,6 +67,14 @@ const userSelect = reactive([]) // 用户关键字 const userKeyword = ref('') + // 产品列表 + const product = reactive({ + pageNum: 1, + pageSize: 10, + list: [], + }) + // 用户信息 + const userinfo = computed(() => store.state.userinfo) // onLoad((option) => { @@ -104,6 +117,9 @@ // 获取标签 getLabel() } + + // 获取我发布的产品 + getProductList() }) // 获取视频详情 @@ -176,7 +192,7 @@ data: { pageNum: label.pageNum, pageSize: label.pageSize, - name: labelKeyword.value, + tagName: labelKeyword.value, } }).then(rs => { if (rs.code == 200) { @@ -213,7 +229,7 @@ function addLabel() { api.video.setLabel({ data: { - name: labelKeyword.value, + tagName: labelKeyword.value, } }).then(rs => { if (rs.code == 200) { @@ -238,7 +254,7 @@ */ function handleSelectLabel(ev, index) { // 是否包含 - const findIndex = labelSelect.findIndex(item => item.id == ev.id) + const findIndex = labelSelect.findIndex(item => item.tagId == ev.tagId) // if (findIndex < 0) { if (labelSelect.length >= 5) util.alert('最多上传5个') @@ -313,12 +329,6 @@ const data = { ...form } - // let fnName = 'saveVideo' - - // // 如果是编辑 - // if (form.videoId) { - // fnName = 'updateVideo' - // } //视频状态 0草稿 1待审核 2审核失败 3已发布 4已下架 data.status = status ? status : 0 @@ -351,7 +361,7 @@ } // 如果有选择的标签 if (labelSelect[0]) { - data.tags = labelSelect.map(item => item.id).join(',') + data.tags = labelSelect.map(item => item.tagId).join(',') } // if (userSelect[0]) { // data.subscriberId = userSelect.map(item => item.userId).join(',') @@ -378,6 +388,48 @@ }) }) } + + // 获取更多商品 + function getMoreProductList() { + if (product.list.length >= product.total) return + product.pageNum++ + getProductList() + } + + // 获取已发布的商品列表 + function getProductList() { + api.shop.getProductionListByUserId({ + data: { + pageNum: product.pageNum, + pageSize: product.pageSize, + } + }).then(rs => { + if (rs.code == 200) { + if (product.pageNum == 1) product.list.length = 0 + product.list.push(...rs.rows) + product.total = rs.total + return + } + util.alert({ + content: rs.msg, + showCancel: false, + }) + }) + } + + /** + * 选择商品 + * @param {Object} item + */ + function handleProduct(item) { + if (form.productId == item.id) return + form.productId = item.id + form.productName = item.name + form.productPrice = item.price + form.productImage = item.sliderImage.split(',')[0] + form.commission = item.commission + proxy.$refs.productRef.close() + } @@ -600,4 +699,26 @@ background-color: #F4F4F4; } } + + // 产品 + .productAlt { + .scroll { + height: 800rpx; + + .item+.item { + border-top: 2rpx solid #eee; + } + } + } + + // 商家视频展示的秒数 + .second { + + .input { + width: 80rpx; + text-align: center; + flex: none; + border-bottom: 2rpx solid #111; + } + } \ No newline at end of file diff --git a/jiuyi2/pages/shop/store/commodities.vue b/jiuyi2/pages/shop/store/commodities.vue index 1fe265c5..34f8db81 100644 --- a/jiuyi2/pages/shop/store/commodities.vue +++ b/jiuyi2/pages/shop/store/commodities.vue @@ -1,16 +1,79 @@ - \ No newline at end of file diff --git a/jiuyi2/pages/shop/store/order.vue b/jiuyi2/pages/shop/store/order.vue index 0757d2e1..1f3ff53f 100644 --- a/jiuyi2/pages/shop/store/order.vue +++ b/jiuyi2/pages/shop/store/order.vue @@ -127,7 +127,8 @@ 不想要了 @@ -153,6 +154,9 @@ + + +