绿满眶商城微信小程序-uniapp
zxl
4 天以前 c9928dd4f6d25e2339ea1400f59ec58674a927a7
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.selectNum"/>
                  <uni-number-box v-model="goods.goodsNum" :min="0"/>
               </view>
            </view>
              </view>
@@ -205,13 +205,7 @@
</template>
<script>
import UIcon from '@/uview-components/uview-ui/components/u-icon/u-icon.vue';
import UButton from '@/uview-components/uview-ui/components/u-button/u-button.vue';
import UForm from '@/uview-components/uview-ui/components/u-form/u-form.vue';
import UFormItem from '@/uview-components/uview-ui/components/u-form-item/u-form-item.vue';
import UInput from '@/uview-components/uview-ui/components/u-input/u-input.vue';
import USearch from '@/uview-components/uview-ui/components/u-search/u-search.vue';
import UPopup from '@/uview-components/uview-ui/components/u-popup/u-popup.vue';
import '@/components/uview-components/uview-ui';
import MyTag from '@/components/my-tag.vue'
import { getSTSToken, getFilePreviewUrl } from "@/api/common.js";
@@ -221,7 +215,7 @@
import { getVideoGoodsList } from "@/api/goods.js";
export default {
  components: {MyTag,UIcon,UButton,UForm,UFormItem,UInput,USearch,UPopup},
  components: {MyTag},
  data() {
    return {
     fileTypeShow: false,
@@ -457,7 +451,22 @@
    },
    // 重新上传
    reUpload() {
      this.resetData()
      this.videoInfo = {
           url: '',
           fileKey: '',
           fileType: '',
           fileSize: 0,
           originalFileName: '',
           cover: ''
      };
      this.formData.videoFileKey = ''
      this.formData.cover = ''
      this.formData.videoFit = 'cover'
      this.formData.videoDuration = 0
      this.formData.videoImgs = []
      this.formData.fileInfo = {}
      this.formData.videoContentType = 'video'
      this.videoPreviewImgs = []
     this.fileTypeShow = true
    },
    // 选择视频图集
@@ -533,13 +542,20 @@
    // 选择商品
    chooseGoods() {
     if(this.selectedGoodsList.length > 0) {
             const selectedGoodsIds = new Set(this.selectedGoodsList.map(i => i.goodsId));
                console.log(selectedGoodsIds, "mimade");
             this.goodsList?.forEach(goods => {
                 this.$set(goods, 'selected', selectedGoodsIds.has(goods.goodsId));
               });
     }
      this.showGoodsPicker = true;
    },
    // 选择具体商品
    selectGoods(goods, index) {
     if(! this.selectedGoodsList.some(item => item.id === goods.id)) {
      goods["selectNum"] = 1
      goods["goodsNum"] = 1
      this.selectedGoodsList.push(goods)
      this.goodsList[index].selected = true
     } else {
@@ -622,7 +638,7 @@
        if (valid && this.canPublish) {
          this.loading = true;
          this.formData.fileInfo = this.videoInfo;
        this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.id, goodsNum: item.selectNum}});
        this.formData["goodsList"] = this.selectedGoodsList.map(item => {return {goodsId: item.goodsId, goodsNum: item.goodsNum}});
          publish(this.formData).then(res => {
           uni.showToast({
             title: '视频已提交审核~',