绿满眶商城微信小程序-uniapp
xiangpei
2025-06-24 2955ce47c5c5990081d877ec752ab28d616a766a
视频商品购买
3个文件已修改
41 ■■■■■ 已修改文件
pages/tabbar/video/video.vue 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/video/video-edit.vue 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/video/video-goods-detail.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/tabbar/video/video.vue
@@ -132,7 +132,7 @@
                    <view class="goods-price" style="flex: 1;">¥{{ goods.price }}</view>
                    <view @click.stop="() => {}" style="flex: 1;display: flex;justify-content: center;align-items: center;">
                        <view style="width: 90rpx">数量:</view>
                        <uni-number-box v-model="goods.goodsNum" :min="0"/>
                        <uni-number-box v-model="goods.goodsNum" :min="1"/>
                    </view>
                </view>
              </view>
@@ -249,7 +249,6 @@
        videoFileKey: '',
        videoDuration: 0,
        videoFit: 'cover',
        goodsId: '',
        videoContentType: 'video',
        videoImgs: [],
        tags: [],
@@ -543,10 +542,9 @@
    // 选择商品
    chooseGoods() {
      if(this.selectedGoodsList.length > 0) {
                const selectedGoodsIds = new Set(this.selectedGoodsList.map(i => i.goodsId));
                    console.log(selectedGoodsIds, "mimade");
                const selectedGoodsSkuIds = new Set(this.selectedGoodsList.map(i => i.id));
                this.goodsList?.forEach(goods => {
                    this.$set(goods, 'selected', selectedGoodsIds.has(goods.goodsId));
                    this.$set(goods, 'selected', selectedGoodsSkuIds.has(goods.id));
                  });
      }
      this.showGoodsPicker = true;
@@ -638,7 +636,7 @@
        if (valid && this.canPublish) {
          this.loading = true;
          this.formData.fileInfo = this.videoInfo;
          this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsNum: item.goodsNum}});
          this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsSkuId: item.id, goodsNum: item.goodsNum}});
          publish(this.formData).then(res => {
              uni.showToast({
                title: '视频已提交审核~',
@@ -683,7 +681,6 @@
          cover: '',
          videoFit: 'cover',
          videoDuration: 0,
          goodsId: '',
          videoContentType: 'video',
          videoImgs: [],
          tags: [],
pages/video/video-edit.vue
@@ -132,7 +132,7 @@
                    <view class="goods-price" style="flex: 1;">¥{{ goods.price }}</view>
                    <view @click.stop="() => {}" style="flex: 1;display: flex;justify-content: center;align-items: center;">
                        <view style="width: 90rpx">数量:</view>
                        <uni-number-box v-model="goods.goodsNum" :min="0"/>
                        <uni-number-box v-model="goods.goodsNum" :min="1"/>
                    </view>
                </view>
              </view>
@@ -250,7 +250,6 @@
        videoFileKey: '',
        videoDuration: 0,
        videoFit: 'cover',
        goodsId: '',
        videoContentType: 'video',
        videoImgs: [],
        tags: [],
@@ -306,7 +305,7 @@
                getVideoDetail(id).then(res => {
                    this.videoInfo.cover = res.data.data.coverUrl
                    this.videoInfo.url = res.data.data.videoUrl
                  this.formData.videoImgs = res.data.data.imgs
                  this.formData.videoImgs = res.data.data.videoImgs
                  this.formData.videoContentType = res.data.data.videoContentType
                    this.formData.cover = res.data.data.coverFileKey
                    this.formData.id = res.data.data.id
@@ -316,6 +315,9 @@
                    this.formData.videoDuration = res.data.data.videoDuration
                    this.selectedGoodsList = res.data.data.goodsList
                    this.formData.tags = res.data.data.tags
                  if (this.formData.videoContentType === 'img') {
                      this.videoPreviewImgs = res.data.data.imgs
                  }
                  this.showUploadProgress = false
                    console.log("视频详情", this.formData);
                })
@@ -565,10 +567,9 @@
    // 选择商品
    chooseGoods() {
      if(this.selectedGoodsList.length > 0) {
                const selectedGoodsIds = new Set(this.selectedGoodsList.map(i => i.goodsId));
              console.log(selectedGoodsIds, "mimade");
                const selectedGoodsSkuIds = new Set(this.selectedGoodsList.map(i => i.id));
                this.goodsList?.forEach(goods => {
                    this.$set(goods, 'selected', selectedGoodsIds.has(goods.goodsId));
                    this.$set(goods, 'selected', selectedGoodsSkuIds.has(goods.id));
                  });
      }
      this.showGoodsPicker = true;
@@ -660,7 +661,7 @@
        if (valid && this.canPublish) {
          this.loading = true;
          this.formData.fileInfo = this.videoInfo;
          this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsNum: item.goodsNum}});
          this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsSkuId: item.id, goodsNum: item.goodsNum}});
          updateVideo(this.formData).then(res => {
              uni.showToast({
                title: '视频已提交审核~',
@@ -705,7 +706,6 @@
          cover: '',
          videoFit: 'cover',
          videoDuration: 0,
          goodsId: '',
          videoContentType: 'video',
          videoImgs: [],
          tags: [],
pages/video/video-goods-detail.vue
@@ -29,7 +29,7 @@
<script>
    import {getGoodsDetail} from "@/api/video.js"
    import { buyBack } from "@/api/trade.js";
    import '@/components/uview-components/uview-ui';
    export default {
        computed: {
@@ -61,7 +61,17 @@
            },
            // 生成订单-支付
            toPay() {
                const buyList = this.goodsList.map(goods => {
                    return {
                        skuId: goods.id,
                        num: goods.goodsNum
                    }
                })
                buyBack(buyList).then(res => {
                    uni.navigateTo({
                        url: "/pages/order/fillorder?way=CART"
                    })
                })
            }
        }
    }