绿满眶商城微信小程序-uniapp
zxl
2025-07-31 f654d570332e2c16379e08ad1e3bb8a24d92656e
pages/video/video-goods-detail.vue
@@ -29,10 +29,9 @@
<script>
   import {getGoodsDetail} from "@/api/video.js"
   import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue';
   import { buyBack } from "@/api/trade.js";
   import '@/components/uview-components/uview-ui';
   export default {
      components: {UButton},
      computed: {
         totalMoney() {
            return this.goodsList.reduce((total, goods) => {
@@ -54,6 +53,11 @@
         this.getGoodsList();
      },
      methods: {
         selectGoods(goods,id){
            uni.navigateTo({
               url: `/pages/product/goods?id=${goods.id}&goodsId=${goods.goodsId}`
            })
         },
         // 获取商品列表
         async getGoodsList() {
            getGoodsDetail(this.videoId).then(res => {
@@ -62,7 +66,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"
               })
            })
         }
      }
   }