2024-04-17 18:02:49 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class='content'>
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u--form :model="formData" :rules="rules" ref="formData" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
|
2024-04-19 18:08:04 +08:00
|
|
|
|
labelWidth='auto'>
|
|
|
|
|
<view class="good-baseInfo card">
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u-form-item label="商品标题" prop="store_name" ref="item1" required>
|
2024-04-25 18:09:35 +08:00
|
|
|
|
<text slot='right'
|
|
|
|
|
style="font-size:28rpx ; color:#989898 ;">{{stroeNameLength}}/{{maxLength}}</text>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="" prop="userInfo.name" ref="item1">
|
2024-04-20 14:51:26 +08:00
|
|
|
|
<u--textarea v-model="formData.store_name" placeholder="建议描述产品品牌、名称、规格、口味"
|
2024-04-23 18:01:32 +08:00
|
|
|
|
style="background-color: #F9F9F9;height: 166rpx;" :maxlength='maxLength'></u--textarea>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
</u-form-item>
|
2024-04-17 18:02:49 +08:00
|
|
|
|
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u-form-item label="商品主图" prop="formData.imageList" ref="item1" required>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性、清晰度</text>
|
2024-04-17 18:02:49 +08:00
|
|
|
|
</u-form-item>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view class="card" style="min-height: 150rpx;margin-bottom: 0;padding: 0;">
|
|
|
|
|
<view class="" style="display: flex;flex-wrap: wrap;">
|
2024-04-24 18:11:06 +08:00
|
|
|
|
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view v-for="(item,index) in formData.imageList"
|
|
|
|
|
style="margin-right: 20rpx;margin-bottom: 20rpx;">
|
2024-04-25 18:09:35 +08:00
|
|
|
|
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view class="video_list" v-if='vidioTypeList.includes(getSuffix(item))'>
|
|
|
|
|
<view class="video_list_item photo" style="position: relative;">
|
2024-04-24 18:11:06 +08:00
|
|
|
|
<view class="jiao">
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<!-- video标签在app端层级过高 -->
|
|
|
|
|
<!--#ifndef APP-PLUS-->
|
|
|
|
|
<video :src="item"></video>
|
|
|
|
|
<!--#endif-->
|
|
|
|
|
<!--#ifdef APP-PLUS-->
|
2024-04-25 18:09:35 +08:00
|
|
|
|
<view class="" style="position: relative;">
|
|
|
|
|
<img :src="item+coverUrl" style=" width:140rpx;height: 140rpx;"></img>
|
|
|
|
|
<view class="image-play-icon">
|
|
|
|
|
<u-icon name="play-right-fill" size="30" color="white"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<!--#endif-->
|
2024-04-24 18:11:06 +08:00
|
|
|
|
<image @click="formData.imageList.splice(index,1)"
|
|
|
|
|
src="@/static/images/gban.png" mode="widthFix"></image>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view style="position: absolute;top: 20rpx;z-index: 99;width: 140rpx;height: 100%;"
|
|
|
|
|
@click="videoshow(index)">
|
|
|
|
|
<view class="videoHover">
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-04-25 18:09:35 +08:00
|
|
|
|
|
|
|
|
|
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view class="" style="position: relative;" v-else>
|
|
|
|
|
<view class="jiao" @click="formData.imageList.splice(index,1)">
|
|
|
|
|
<image src="@/static/images/gban.png" mode="widthFix"></image>
|
|
|
|
|
</view>
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u--image @click="preViewImg(item)" :src="item" :fade="true" duration="450"
|
|
|
|
|
width='140rpx' height='140rpx'></u--image>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-04-24 18:11:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<view class='uploadimg' @click="show=true,isDetail=false">
|
2024-04-24 18:11:06 +08:00
|
|
|
|
<!-- <view class='uploadimg'> -->
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<u-icon name="plus" color="#777777"></u-icon>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view class="" style="color: #777777;font-size: 20rpx;">
|
|
|
|
|
上传图片/视频
|
2024-04-19 18:08:04 +08:00
|
|
|
|
</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u-form-item label="商品详情" prop="formData.content.image" required>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<text style="color: #E18C34;font-size: 24rpx">上传时应注重真实性、清晰度</text>
|
|
|
|
|
</u-form-item>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view class="card" style="min-height: 150rpx;margin-bottom: 0;padding: 0;">
|
|
|
|
|
<view class="" style="display: flex;flex-wrap: wrap;">
|
|
|
|
|
<view v-for="(item,index) in formData.content.image"
|
|
|
|
|
style="margin-right: 20rpx;margin-bottom: 20rpx;">
|
|
|
|
|
<view class="video_list" v-if='vidioTypeList.includes(getSuffix(item))'>
|
|
|
|
|
<view class="video_list_item photo" style="position: relative;">
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<view class="jiao" @click="formData.content.image.splice(index,1)">
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<!-- video标签在app端层级过高 -->
|
|
|
|
|
<!--#ifndef APP-PLUS-->
|
|
|
|
|
<video :src="item"></video>
|
|
|
|
|
<!--#endif-->
|
|
|
|
|
<!--#ifdef APP-PLUS-->
|
2024-04-25 18:09:35 +08:00
|
|
|
|
<view class="" style="position: relative;">
|
|
|
|
|
<img :src="item+coverUrl" style=" width:140rpx;height: 140rpx;"></img>
|
|
|
|
|
<view class="image-play-icon">
|
|
|
|
|
<u-icon name="play-right-fill" size="30" color="white"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<!--#endif-->
|
|
|
|
|
<image src="@/static/images/gban.png" mode="widthFix"></image>
|
|
|
|
|
</view>
|
|
|
|
|
<view style="position: absolute;top: 20rpx;z-index: 99;width: 140rpx;height: 100%;"
|
|
|
|
|
@click="videoshow(index)">
|
|
|
|
|
<view class="videoHover">
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="" style="position: relative;" v-else>
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<view class="jiao" @click="formData.content.image.splice(index,1)">
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<image src="@/static/images/gban.png" mode="widthFix"></image>
|
|
|
|
|
</view>
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u--image @click="preViewImg(item)" :src="item" :fade="true" duration="450"
|
|
|
|
|
width='140rpx' height='140rpx'></u--image>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class='uploadimg' @click="show=true,isDetail=true">
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<u-icon name="plus" color="#777777"></u-icon>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view class="" style="color: #777777;font-size: 20rpx;">
|
|
|
|
|
上传图片/视频
|
2024-04-19 18:08:04 +08:00
|
|
|
|
</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
|
|
|
|
</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class='tips'>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
商品类目属性
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</view>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<view class="card" style="padding: 14rpx 30rpx;">
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u-form-item label="商品分类" prop="cate_name" ref="item1" labelPosition="left" required>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
|
2024-04-20 18:02:16 +08:00
|
|
|
|
@click="navgo(`/pages/product/addGoodDetail/goodsType?mer_id=${mer_id}&&formData=${JSON.stringify(formData)}`)">
|
2024-04-20 08:40:27 +08:00
|
|
|
|
<view style="margin-right: 10rpx;line-height: 25rpx;">{{ formData.cate_name|| '请选择'}}</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
<u-icon name="arrow-right"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="商品属性" prop="userInfo.name" ref="item1" labelPosition="left">
|
|
|
|
|
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
|
2024-04-22 18:05:44 +08:00
|
|
|
|
@click="navgo(`/pages/product/addGoodDetail/goodsAttr?mer_id=${mer_id}&&formData=${JSON.stringify(formData)}`)">
|
2024-04-20 14:51:26 +08:00
|
|
|
|
<view style="margin-right: 10rpx;line-height: 25rpx;">
|
2024-04-22 08:38:39 +08:00
|
|
|
|
{{isSet(formData.product_attribute)?'已设置':'未设置' }}
|
2024-04-20 14:51:26 +08:00
|
|
|
|
</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
<u-icon name="arrow-right"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</u-form-item>
|
|
|
|
|
</view>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<view class='tips'>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
规格与价格
|
|
|
|
|
</view>
|
2024-04-20 14:51:26 +08:00
|
|
|
|
<view class="card" style="min-height: 100rpx;padding: 14rpx 30rpx;">
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u-form-item label="规格与价格" prop="formData.attrValue" ref="item1" labelPosition="left" required>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
<view style="display: flex;align-items: center;font-size: 28rpx;color:#777777 ;" slot="right"
|
2024-04-20 18:02:16 +08:00
|
|
|
|
@click="navgo(`/pages/product/addGoodDetail/goodsPrice?formData=${JSON.stringify(formData)}&&mer_id=${mer_id}`)">
|
2024-04-22 18:05:44 +08:00
|
|
|
|
<view style="margin-right: 10rpx;line-height: 25rpx;">{{sets?"已设置":""}}
|
|
|
|
|
</view>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
<u-icon name="arrow-right"></u-icon>
|
|
|
|
|
</view>
|
|
|
|
|
</u-form-item>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
|
|
|
|
<view class="" v-if="showSet">
|
2024-04-23 08:45:17 +08:00
|
|
|
|
<view class="" v-for="(item,index) in formData.attrValue.filter(item=> item.is_use==0)">
|
|
|
|
|
<view class="" v-if='formData.attrValue.filter(item=> item.is_use==0).length==1'>
|
2024-04-24 18:11:06 +08:00
|
|
|
|
<u-form-item label="零售价格" label-width="auto" labelPosition="left" border-bottom>
|
|
|
|
|
<view style="font-size: 28rpx;color:#777777 ;width: 100%;text-align: right;">
|
|
|
|
|
{{item.price}}元/{{item.unit_name}}
|
2024-04-23 18:01:32 +08:00
|
|
|
|
</view>
|
2024-04-24 18:11:06 +08:00
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item v-if='isWholeSale' label="批发价格" label-width="auto" labelPosition="left"
|
|
|
|
|
border-bottom>
|
|
|
|
|
<view style="font-size: 28rpx;color:#777777 ;width: 100%;text-align: right;">
|
|
|
|
|
{{item.wholesale_price}}元/{{item.wholesale_unit_name}}
|
2024-04-23 18:01:32 +08:00
|
|
|
|
</view>
|
2024-04-24 18:11:06 +08:00
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label="商品库存" label-width="auto" labelPosition="left" border-bottom>
|
|
|
|
|
<view style="font-size: 28rpx;color:#777777 ;width: 100%;text-align: right;">
|
|
|
|
|
{{item.stock}}
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
2024-04-24 18:11:06 +08:00
|
|
|
|
</u-form-item>
|
2024-04-23 08:45:17 +08:00
|
|
|
|
</view>
|
|
|
|
|
<view class="" v-else>
|
2024-04-25 08:40:17 +08:00
|
|
|
|
<u-form-item :label="item.sku" label-width="350rpx" prop="userInfo.name" ref="item1"
|
|
|
|
|
labelPosition="left" border-bottom>
|
2024-04-23 08:45:17 +08:00
|
|
|
|
<view class="" style="display: flex;justify-content: space-between;width: 100%">
|
|
|
|
|
<view style="font-size: 28rpx;color:#777777 ;">
|
|
|
|
|
零售价
|
|
|
|
|
</view>
|
|
|
|
|
<view style="font-size: 28rpx;color:#777777 ;">
|
|
|
|
|
{{item.price}}元/{{item.unit_name}}
|
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
2024-04-23 08:45:17 +08:00
|
|
|
|
</u-form-item>
|
|
|
|
|
<u-form-item label=" " label-width="350rpx" prop="userInfo.name" ref="item1"
|
|
|
|
|
labelPosition="left" border-bottom v-if='isWholeSale'>
|
|
|
|
|
<view class="" style="display: flex;justify-content: space-between;width: 100%">
|
|
|
|
|
<view style="font-size: 28rpx;color:#777777 ;">
|
|
|
|
|
批发价
|
|
|
|
|
</view>
|
|
|
|
|
<view style="font-size: 28rpx;color:#777777 ;">
|
|
|
|
|
{{item.wholesale_price}}元/{{item.wholesale_unit_name}}
|
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
2024-04-23 08:45:17 +08:00
|
|
|
|
</u-form-item>
|
|
|
|
|
</view>
|
|
|
|
|
|
2024-04-22 18:05:44 +08:00
|
|
|
|
</view>
|
2024-04-20 14:51:26 +08:00
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
|
|
|
|
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</view>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<view class='tips'>
|
2024-04-25 18:09:35 +08:00
|
|
|
|
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</view>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
<view class="card" style="padding: 14rpx 30rpx;">
|
|
|
|
|
<u-form-item label="商品详细描述" prop="userInfo.name" ref="item1" labelPosition="left">
|
2024-04-25 18:09:35 +08:00
|
|
|
|
<text slot='right' style="font-size:28rpx ; color:#989898 ;">{{storeInfoLength}}/{{300}}</text>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</u-form-item>
|
2024-04-20 14:59:16 +08:00
|
|
|
|
<u--textarea v-model="formData.store_info" placeholder="货品描述请严格遵循《广告法》规定,避免出现虚假宣传和误导消费者的词语"
|
2024-04-23 18:01:32 +08:00
|
|
|
|
style="background-color: #F9F9F9;height: 166rpx;" :maxlength='300'></u--textarea>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
|
|
|
|
|
<u-line color="#F3F3F3" style="margin: 30rpx 0;"></u-line>
|
2024-04-23 18:01:32 +08:00
|
|
|
|
<u-form-item label="送货方式" labelPosition="left" prop='delivery_way' required>
|
|
|
|
|
<u-checkbox-group v-model="formData.delivery_way" placement="row" slot="right">
|
2024-04-18 18:02:57 +08:00
|
|
|
|
<u-checkbox shape="circle" v-for="(item, index) in checkboxList1" :key="index"
|
2024-04-20 14:51:26 +08:00
|
|
|
|
:label="item.name" :name="item.value" activeColor="#20B128"
|
2024-04-18 18:02:57 +08:00
|
|
|
|
:customStyle="{marginRight: '8px'}"
|
|
|
|
|
:labelColor="checkboxValue1.includes(item.name)?'#20B128':'#777777'">
|
|
|
|
|
</u-checkbox>
|
|
|
|
|
</u-checkbox-group>
|
2024-04-17 18:02:49 +08:00
|
|
|
|
</u-form-item>
|
|
|
|
|
</view>
|
|
|
|
|
</u--form>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
<view class="submit-btn">
|
2024-04-20 08:40:27 +08:00
|
|
|
|
<u-button text="确认发布" @click="submit" color="#33BB3C" class="custom-style"></u-button>
|
2024-04-19 18:08:04 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="overlay">
|
|
|
|
|
<u-overlay :show="showlay">
|
|
|
|
|
<view class="overlay-content">
|
|
|
|
|
<view class="">
|
|
|
|
|
温馨提示
|
|
|
|
|
</view>
|
|
|
|
|
<view class="" style="font-family: PingFangFamily;font-size: 36rpx;">
|
|
|
|
|
发布中断可能导致商机流失
|
|
|
|
|
</view>
|
|
|
|
|
<view class="" style="font-size: 26rpx;color: #777777;">
|
|
|
|
|
<view class="">
|
|
|
|
|
您的商品信息已经填写了大半,
|
|
|
|
|
</view>
|
|
|
|
|
<view class="">
|
|
|
|
|
只差最后几步就能上架销售了!
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view class=""
|
|
|
|
|
style="font-size: 28rpx;color: #444444;background-color: #EDF8ED;padding: 20rpx 44rpx;border-radius: 12rpx;">
|
|
|
|
|
<view class="">
|
|
|
|
|
越早发布产品<text style='color: #21B129;'>曝光量越高</text>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="">
|
|
|
|
|
越早发布产品可提前 <text style='color: #21B129;'>抢占商机</text>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<view style="display: flex;">
|
|
|
|
|
<view style="width: 236rpx;height: 84rpx;margin-right: 30rpx;">
|
|
|
|
|
<u-button text="确定返回" @click='back'></u-button>
|
|
|
|
|
</view>
|
|
|
|
|
<view style="width: 236rpx;height: 84rpx;">
|
|
|
|
|
<u-button type='primary' text="继续编辑" @click='showlay=false'></u-button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</u-overlay>
|
2024-04-18 18:02:57 +08:00
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
|
|
|
|
<u-picker :show="show" :columns="columns" confirmColor='#33BB3C' @close='show=false' @confirm='choseMedia'
|
|
|
|
|
@cancel='show=false'></u-picker>
|
|
|
|
|
|
|
|
|
|
<view v-if="showVideo" class="video-count">
|
|
|
|
|
<video id="myVideo" class="videoLink" autoplay loop muted
|
|
|
|
|
:src=" isDetail?formData.content.image[videoIndex]: formData.imageList[videoIndex]"></video>
|
|
|
|
|
</view>
|
|
|
|
|
<view class='mask' catchtouchmove="true" :hidden='showVideo==false' @tap="showVideo=false"></view>
|
2024-04-17 18:02:49 +08:00
|
|
|
|
</view>
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
2024-04-17 18:02:49 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-04-20 18:02:16 +08:00
|
|
|
|
import {
|
|
|
|
|
Toast,
|
|
|
|
|
Modal
|
|
|
|
|
} from "@/libs/uniApi.js";
|
2024-04-19 18:08:04 +08:00
|
|
|
|
import {
|
2024-04-22 18:05:44 +08:00
|
|
|
|
HTTP_REQUEST_URL,
|
|
|
|
|
TOKENNAME
|
2024-04-19 18:08:04 +08:00
|
|
|
|
} from '@/config/app.js';
|
2024-04-22 18:05:44 +08:00
|
|
|
|
import store from 'store';
|
2024-04-20 08:40:27 +08:00
|
|
|
|
import {
|
2024-04-20 18:02:16 +08:00
|
|
|
|
productCreate,
|
2024-04-22 18:05:44 +08:00
|
|
|
|
productUpdate,
|
|
|
|
|
productDetail
|
|
|
|
|
|
2024-04-20 18:02:16 +08:00
|
|
|
|
} from '@/api/product.js';
|
2024-04-17 18:02:49 +08:00
|
|
|
|
import uploadImgVideo from "../addGood/components/uploadImgVideo.vue"
|
2024-04-22 18:05:44 +08:00
|
|
|
|
import form from "../../../uni_modules/uview-ui/libs/config/props/form";
|
2024-04-17 18:02:49 +08:00
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
uploadImgVideo,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2024-04-25 18:09:35 +08:00
|
|
|
|
coverUrl: '?spm=a2c4e.11153940.blogcont573781.6.c1032027sQ46VG&x-oss-process=video/snapshot,t_1000,m_fast',
|
2024-04-22 18:05:44 +08:00
|
|
|
|
mode: 'add',
|
|
|
|
|
isDetail: false,
|
|
|
|
|
columns: [
|
|
|
|
|
['图片', '视频', ]
|
|
|
|
|
],
|
|
|
|
|
sets: false,
|
|
|
|
|
showVideo: false,
|
|
|
|
|
vidioTypeList: ['mp4', 'avi', 'mov', 'wmv', 'mkv', 'flv', 'mpeg', '3gp', 'webm'],
|
|
|
|
|
videoIndex: 0,
|
|
|
|
|
upload_max: 100,
|
|
|
|
|
uploadUrl: `${HTTP_REQUEST_URL}/api/upload/video`,
|
|
|
|
|
show: false, //选择图片还是视屏
|
|
|
|
|
showSet: false,
|
|
|
|
|
delivery_way: [],
|
|
|
|
|
isWholeSale: false,
|
2024-04-19 18:08:04 +08:00
|
|
|
|
formData: {
|
2024-04-25 18:09:35 +08:00
|
|
|
|
store_info: "",
|
2024-04-22 18:05:44 +08:00
|
|
|
|
product_id: "",
|
|
|
|
|
"store_name": "",
|
2024-04-19 18:08:04 +08:00
|
|
|
|
"imageList": [
|
2024-04-20 08:40:27 +08:00
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
],
|
2024-04-23 18:01:32 +08:00
|
|
|
|
attr: [{
|
2024-04-25 08:40:17 +08:00
|
|
|
|
detail: [{
|
|
|
|
|
attr: 'name'
|
|
|
|
|
}],
|
|
|
|
|
value: " "
|
2024-04-23 18:01:32 +08:00
|
|
|
|
}, ],
|
2024-04-22 18:05:44 +08:00
|
|
|
|
"attrValue": [{
|
2024-04-23 18:01:32 +08:00
|
|
|
|
detail: {
|
2024-04-25 08:40:17 +08:00
|
|
|
|
|
2024-04-23 18:01:32 +08:00
|
|
|
|
},
|
2024-04-22 18:05:44 +08:00
|
|
|
|
"price": "",
|
|
|
|
|
"unit_name": "",
|
|
|
|
|
"wholesale_unit_name": "",
|
2024-04-23 18:01:32 +08:00
|
|
|
|
"wholesale_price": '',
|
2024-04-22 18:05:44 +08:00
|
|
|
|
"cost": "",
|
|
|
|
|
"stock": "",
|
2024-04-24 18:11:06 +08:00
|
|
|
|
sku: '',
|
2024-04-22 18:05:44 +08:00
|
|
|
|
"ot_price": "",
|
|
|
|
|
"procure_price": "",
|
|
|
|
|
"bar_code": "",
|
|
|
|
|
"weight": "",
|
|
|
|
|
"extension_one": "",
|
|
|
|
|
"extension_two": "",
|
2024-04-23 18:01:32 +08:00
|
|
|
|
uuid: "",
|
|
|
|
|
volume: "",
|
2024-04-23 08:45:17 +08:00
|
|
|
|
"is_use": 0,
|
2024-04-22 18:05:44 +08:00
|
|
|
|
}],
|
2024-04-20 14:59:16 +08:00
|
|
|
|
"cate_name": "",
|
|
|
|
|
"unit_name": "",
|
2024-04-23 18:01:32 +08:00
|
|
|
|
"cate_id": '',
|
|
|
|
|
"mer_cate_id": [
|
|
|
|
|
|
|
|
|
|
],
|
2024-04-22 18:05:44 +08:00
|
|
|
|
"mer_cate_name": "",
|
2024-04-23 18:01:32 +08:00
|
|
|
|
"spec_type": "",
|
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
"specifica": "",
|
2024-04-23 18:01:32 +08:00
|
|
|
|
"delivery_way": [
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
"delivery_free": "1",
|
2024-04-19 18:08:04 +08:00
|
|
|
|
"temp_id": "",
|
|
|
|
|
"tempName": "",
|
|
|
|
|
"once_min_count": "",
|
2024-04-22 18:05:44 +08:00
|
|
|
|
"image": "",
|
2024-04-19 18:08:04 +08:00
|
|
|
|
"slider_image": [
|
2024-04-22 18:05:44 +08:00
|
|
|
|
""
|
2024-04-19 18:08:04 +08:00
|
|
|
|
],
|
|
|
|
|
"is_good": 0,
|
|
|
|
|
"is_gift_bag": 0,
|
|
|
|
|
"sort": "",
|
|
|
|
|
"once_count": "",
|
|
|
|
|
"video_link": "",
|
|
|
|
|
"content": {
|
|
|
|
|
"title": "",
|
2024-04-20 08:40:27 +08:00
|
|
|
|
"image": []
|
2024-04-19 18:08:04 +08:00
|
|
|
|
},
|
2024-04-22 18:05:44 +08:00
|
|
|
|
"stock": "",
|
2024-04-20 18:02:16 +08:00
|
|
|
|
product_attribute: {
|
|
|
|
|
address: "",
|
|
|
|
|
leval: "",
|
|
|
|
|
pack: "",
|
|
|
|
|
attr: [{
|
|
|
|
|
label: "",
|
|
|
|
|
value: ''
|
|
|
|
|
}]
|
|
|
|
|
}
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
},
|
|
|
|
|
mer_id: "",
|
|
|
|
|
maxLength: 30,
|
|
|
|
|
fileList6: [],
|
2024-04-17 18:02:49 +08:00
|
|
|
|
showSex: false,
|
2024-04-19 18:08:04 +08:00
|
|
|
|
showlay: false,
|
|
|
|
|
go: true,
|
2024-04-17 18:02:49 +08:00
|
|
|
|
model1: {
|
|
|
|
|
userInfo: {
|
|
|
|
|
name: '',
|
|
|
|
|
sex: '',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
range: [{
|
|
|
|
|
value: 0,
|
|
|
|
|
text: "篮球"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 1,
|
|
|
|
|
text: "足球"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
value: 2,
|
|
|
|
|
text: "游泳"
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
text: "",
|
2024-04-18 18:02:57 +08:00
|
|
|
|
text1: "",
|
|
|
|
|
value1: "",
|
|
|
|
|
checkboxValue1: [],
|
|
|
|
|
checkboxList1: [{
|
|
|
|
|
name: '到店核销',
|
2024-04-22 18:05:44 +08:00
|
|
|
|
value: '1',
|
2024-04-18 18:02:57 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: '快递配送',
|
2024-04-22 18:05:44 +08:00
|
|
|
|
value: '2',
|
2024-04-18 18:02:57 +08:00
|
|
|
|
},
|
2024-04-17 18:02:49 +08:00
|
|
|
|
|
2024-04-18 18:02:57 +08:00
|
|
|
|
],
|
2024-04-23 18:01:32 +08:00
|
|
|
|
attrRules: {
|
|
|
|
|
price: '单价不能为空',
|
|
|
|
|
unit_name: '计量单位不能为空',
|
|
|
|
|
wholesale_price: '批发价格不能为空',
|
|
|
|
|
wholesale_unit_name: '批发单位不能为空',
|
|
|
|
|
stock: '库存不能为空'
|
|
|
|
|
},
|
2024-04-17 18:02:49 +08:00
|
|
|
|
rules: {
|
2024-04-23 18:01:32 +08:00
|
|
|
|
"formData.imageList": [{
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
return this.formData.imageList.length >= 2
|
|
|
|
|
},
|
|
|
|
|
message: '请至少上传2张图片',
|
|
|
|
|
trigger: ['change', 'blur'],
|
|
|
|
|
}],
|
|
|
|
|
"formData.attrValue": [{
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
if (!this.isWholeSale) {
|
|
|
|
|
delete this.attrRules.wholesale_unit_name
|
|
|
|
|
delete this.attrRules.wholesale_price
|
|
|
|
|
}
|
|
|
|
|
let errList = []
|
|
|
|
|
this.formData.attrValue.forEach(item => {
|
|
|
|
|
for (let key in this.attrRules) {
|
|
|
|
|
if (!item[key]) {
|
|
|
|
|
errList.push(this.rules[key])
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
return errList.length == 0
|
|
|
|
|
},
|
|
|
|
|
message: '请填写完整商品规格',
|
|
|
|
|
trigger: ['change', 'blur'],
|
|
|
|
|
}],
|
|
|
|
|
|
|
|
|
|
'store_name': {
|
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请填写商品标题',
|
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
|
},
|
|
|
|
|
'cate_name': {
|
|
|
|
|
type: 'string',
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请填写商品分类',
|
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
|
},
|
|
|
|
|
'delivery_way': {
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
return this.formData.delivery_way.length > 0
|
|
|
|
|
},
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请选择送货方式',
|
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
|
},
|
|
|
|
|
'formData.content.image': {
|
|
|
|
|
validator: (rule, value, callback) => {
|
|
|
|
|
return this.formData.content.image.length > 0
|
|
|
|
|
},
|
|
|
|
|
required: true,
|
|
|
|
|
message: '请上传商品详情图',
|
|
|
|
|
trigger: ['blur', 'change']
|
|
|
|
|
},
|
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
|
2024-04-17 18:02:49 +08:00
|
|
|
|
},
|
|
|
|
|
radio: '',
|
|
|
|
|
switchVal: false
|
|
|
|
|
};
|
|
|
|
|
},
|
2024-04-25 18:09:35 +08:00
|
|
|
|
|
|
|
|
|
computed: {
|
|
|
|
|
stroeNameLength() {
|
|
|
|
|
return this.formData.store_name?.length || 0
|
|
|
|
|
},
|
|
|
|
|
storeInfoLength() {
|
|
|
|
|
return this.formData.store_info?.length || 0
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
|
2024-04-17 18:02:49 +08:00
|
|
|
|
methods: {
|
2024-04-24 18:11:06 +08:00
|
|
|
|
test(index) {
|
|
|
|
|
// this.formData.imageList.splice(index, 1)
|
|
|
|
|
console.log(this.formData, index)
|
|
|
|
|
},
|
2024-04-23 18:01:32 +08:00
|
|
|
|
preViewImg(url) {
|
|
|
|
|
let that = this
|
|
|
|
|
uni.previewImage({
|
|
|
|
|
urls: [url],
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
2024-04-22 18:05:44 +08:00
|
|
|
|
deleteImage(index) {
|
|
|
|
|
// this.addGoodsSecoundData.video_link = '';
|
2024-04-20 08:40:27 +08:00
|
|
|
|
},
|
2024-04-22 18:05:44 +08:00
|
|
|
|
videoshow(index) {
|
|
|
|
|
this.videoIndex = index
|
|
|
|
|
this.showVideo = true
|
|
|
|
|
this.videoContext = uni.createVideoContext('myVideo', this);
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.videoContext.play();
|
2024-04-20 08:40:27 +08:00
|
|
|
|
})
|
2024-04-22 18:05:44 +08:00
|
|
|
|
},
|
|
|
|
|
getSuffix(url) {
|
|
|
|
|
const str = url;
|
|
|
|
|
const lastIndex = str.lastIndexOf(".");
|
|
|
|
|
if (lastIndex !== -1) {
|
|
|
|
|
const extension = str.substring(lastIndex + 1);
|
|
|
|
|
return extension
|
|
|
|
|
} else {
|
2024-04-25 08:40:17 +08:00
|
|
|
|
return 'asdasdsadsd'
|
2024-04-20 08:40:27 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2024-04-22 18:05:44 +08:00
|
|
|
|
choseMedia(e) {
|
|
|
|
|
console.log(e.value)
|
|
|
|
|
this.show = false
|
|
|
|
|
if (e.value[0] == '图片') {
|
|
|
|
|
this.handleChooseImage()
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.uploadVideo()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-20 08:40:27 +08:00
|
|
|
|
},
|
2024-04-23 08:45:17 +08:00
|
|
|
|
|
2024-04-22 18:05:44 +08:00
|
|
|
|
// 选择图片
|
|
|
|
|
handleChooseImage() {
|
|
|
|
|
let that = this;
|
2024-04-23 08:45:17 +08:00
|
|
|
|
that.$util.uploadImages({
|
|
|
|
|
count: 6,
|
|
|
|
|
url: 'upload/image'
|
|
|
|
|
}, function(res) {
|
2024-04-23 18:01:32 +08:00
|
|
|
|
if (that.isDetail) {
|
|
|
|
|
that.formData.content.image.push(res.data.path.replace(
|
|
|
|
|
/\\/g, ""));
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
that.$set(that.formData.imageList, that.formData.imageList.length, res.data.path.replace(
|
|
|
|
|
/\\/g,
|
|
|
|
|
""));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// that.formData.imageList.push(res.data.path);
|
2024-04-22 18:05:44 +08:00
|
|
|
|
});
|
2024-04-19 18:08:04 +08:00
|
|
|
|
},
|
2024-04-22 18:05:44 +08:00
|
|
|
|
// 上传视频
|
|
|
|
|
uploadVideo() {
|
|
|
|
|
let that = this
|
|
|
|
|
uni.chooseVideo({
|
|
|
|
|
sourceType: ['camera', 'album'],
|
|
|
|
|
success: res => {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '正在上传中。。。'
|
|
|
|
|
});
|
|
|
|
|
if (Math.ceil(res.size / 1024) < this.upload_max * 1024) {
|
|
|
|
|
uni.uploadFile({
|
|
|
|
|
url: this.uploadUrl, //仅为示例,非真实的接口地址
|
|
|
|
|
filePath: res.tempFilePath,
|
|
|
|
|
name: 'file',
|
|
|
|
|
header: {
|
|
|
|
|
// #ifdef MP
|
|
|
|
|
'Content-Type': 'multipart/form-data',
|
|
|
|
|
// #endif
|
|
|
|
|
[TOKENNAME]: 'Bearer ' + store.state.app.token
|
|
|
|
|
},
|
|
|
|
|
success: uploadFileRes => {
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
let data = JSON.parse(uploadFileRes.data);
|
|
|
|
|
if (that.isDetail) {
|
|
|
|
|
that.formData.content.image.push(data.data.src.replace(
|
|
|
|
|
/\\/g, ""));
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
that.formData.imageList.push(data.data.src.replace(/\\/g,
|
|
|
|
|
""))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
complete: a => {
|
|
|
|
|
// console.log(a);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: `视频超出限制${this.upload_max}MB,已过滤`
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: err => {
|
|
|
|
|
console.log(err)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
isSet(obj) {
|
|
|
|
|
for (let key in obj) {
|
|
|
|
|
if (typeof obj[key] == 'object') this.isSet(obj[key])
|
|
|
|
|
else {
|
|
|
|
|
if (Boolean(obj[key])) return 'true12';
|
|
|
|
|
}
|
2024-04-19 18:08:04 +08:00
|
|
|
|
}
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
},
|
2024-04-22 18:05:44 +08:00
|
|
|
|
isSet2(obj) {
|
|
|
|
|
let lists = ['unit_name', 'price', 'wholesale_price', 'stock']
|
|
|
|
|
lists.forEach(item => {
|
|
|
|
|
if (Boolean(this.formData.attrValue[0][item])) {
|
|
|
|
|
this.sets = true
|
|
|
|
|
}
|
2024-04-19 18:08:04 +08:00
|
|
|
|
})
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
},
|
|
|
|
|
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
2024-04-17 18:02:49 +08:00
|
|
|
|
sexSelect(e) {
|
|
|
|
|
this.model1.userInfo.sex = e.name
|
|
|
|
|
this.$refs.uForm.validateField('userInfo.sex')
|
|
|
|
|
},
|
2024-04-18 18:02:57 +08:00
|
|
|
|
navgo(url) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url
|
|
|
|
|
})
|
2024-04-19 18:08:04 +08:00
|
|
|
|
},
|
|
|
|
|
back() {
|
|
|
|
|
// console.log('show')
|
|
|
|
|
this.go = false
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
},
|
|
|
|
|
showlayFn() {
|
|
|
|
|
uni.navigateBack()
|
2024-04-20 08:40:27 +08:00
|
|
|
|
},
|
2024-04-20 18:02:16 +08:00
|
|
|
|
// submit() {
|
|
|
|
|
// console.log(this.formData)
|
|
|
|
|
// },
|
2024-04-20 14:51:26 +08:00
|
|
|
|
getAttr(object) {
|
2024-04-20 18:02:16 +08:00
|
|
|
|
this.formData.product_attribute = object
|
2024-04-20 14:51:26 +08:00
|
|
|
|
},
|
|
|
|
|
getAttrValue(object) {
|
|
|
|
|
this.formData.attrValue = object
|
|
|
|
|
},
|
2024-04-23 18:01:32 +08:00
|
|
|
|
async handAdd() {
|
2024-04-22 18:05:44 +08:00
|
|
|
|
let that = this
|
2024-04-20 18:02:16 +08:00
|
|
|
|
let data = uni.$u.deepClone(this.formData)
|
2024-04-24 18:11:06 +08:00
|
|
|
|
data.image = data.imageList.find(item => {
|
|
|
|
|
return !this.vidioTypeList.includes(this.getSuffix(item))
|
|
|
|
|
})
|
|
|
|
|
data.slider_image = this.formData.imageList.filter((item, index) => index != 0)
|
2024-04-22 18:05:44 +08:00
|
|
|
|
that.formData.product_id ?
|
|
|
|
|
productUpdate(that.mer_id, that.formData.product_id, data)
|
2024-04-20 18:02:16 +08:00
|
|
|
|
.then(res => {
|
|
|
|
|
Modal('提交成功', '点击确定,前往商品列表页面').then(() => {
|
|
|
|
|
if (this.import == 1) {
|
|
|
|
|
uni.$emit('importAttrValueOK', this.setFormData.import_id);
|
|
|
|
|
uni.navigateBack();
|
|
|
|
|
} else uni.redirectTo({
|
2024-04-24 18:11:06 +08:00
|
|
|
|
url: `/pages/product/list/index?mer_id=${that.mer_id}&type=6`
|
2024-04-20 18:02:16 +08:00
|
|
|
|
})
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(rej => {
|
|
|
|
|
// Toast(rej);
|
2024-04-22 18:05:44 +08:00
|
|
|
|
}) :
|
|
|
|
|
productCreate(that.mer_id, data)
|
|
|
|
|
.then(res => {
|
|
|
|
|
Modal('提交成功', '点击确定,前往商品列表页面').then(() => {
|
|
|
|
|
if (this.import == 1) {
|
|
|
|
|
uni.$emit('importAttrValueOK', this.setFormData.import_id);
|
2024-04-23 18:01:32 +08:00
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6`
|
|
|
|
|
})
|
2024-04-22 18:05:44 +08:00
|
|
|
|
} else uni.redirectTo({
|
2024-04-23 18:01:32 +08:00
|
|
|
|
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6`
|
2024-04-22 18:05:44 +08:00
|
|
|
|
})
|
|
|
|
|
}).catch(() => {
|
2024-04-24 18:11:06 +08:00
|
|
|
|
uni.redirectTo({
|
|
|
|
|
url: `/pages/product/list/index?mer_id=${this.mer_id}&type=6`
|
|
|
|
|
})
|
2024-04-22 18:05:44 +08:00
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.catch(rej => {
|
|
|
|
|
// Toast(rej);
|
|
|
|
|
})
|
2024-04-23 08:45:17 +08:00
|
|
|
|
},
|
2024-04-23 18:01:32 +08:00
|
|
|
|
submit() {
|
2024-04-24 18:11:06 +08:00
|
|
|
|
// console.log(this.formData)
|
2024-04-23 18:01:32 +08:00
|
|
|
|
this.$refs.formData.validate().then(res => {
|
|
|
|
|
this.handAdd()
|
|
|
|
|
}).catch(errors => {
|
2024-04-24 18:11:06 +08:00
|
|
|
|
// console.log(errors)
|
2024-04-23 18:01:32 +08:00
|
|
|
|
uni.$u.toast(errors[0].message)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
2024-04-25 18:09:35 +08:00
|
|
|
|
oldToNew(formData) {
|
|
|
|
|
if (formData.attr.length <= 1) return
|
|
|
|
|
formData.attr.splice(1, 999)
|
|
|
|
|
formData.attr[0].value = ' '
|
|
|
|
|
formData.attr[0].detail = formData.attrValue.map(item => item.sku)
|
|
|
|
|
formData.attrValue.forEach(item => {
|
|
|
|
|
item.detail = {}
|
|
|
|
|
item.detail[' '] = item.sku
|
|
|
|
|
})
|
|
|
|
|
this.formData = formData
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
2024-04-23 08:45:17 +08:00
|
|
|
|
initFormData(option) {
|
|
|
|
|
this.isWholeSale = this.$store.state.app.userInfo?.mer_info?.wholesale == 2;
|
|
|
|
|
this.mer_id = option.mer_id
|
|
|
|
|
if (option.formData) {
|
|
|
|
|
this.formData = JSON.parse(option.formData)
|
|
|
|
|
}
|
2024-04-25 08:40:17 +08:00
|
|
|
|
if (option.goodsInfo) {
|
|
|
|
|
let goods = JSON.parse(option.goodsInfo)
|
|
|
|
|
console.log(goods)
|
|
|
|
|
this.formData.store_name = goods.store_name
|
2024-04-25 18:09:35 +08:00
|
|
|
|
this.formData.imageList = [goods.image, ...goods.slider_image]
|
|
|
|
|
console.log(this.formData)
|
2024-04-25 08:40:17 +08:00
|
|
|
|
}
|
2024-04-20 18:02:16 +08:00
|
|
|
|
}
|
2024-04-17 18:02:49 +08:00
|
|
|
|
},
|
2024-04-20 14:51:26 +08:00
|
|
|
|
|
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
onLoad(option) {
|
2024-04-24 18:11:06 +08:00
|
|
|
|
// let that = this
|
2024-04-23 08:45:17 +08:00
|
|
|
|
this.initFormData(option)
|
2024-04-22 18:05:44 +08:00
|
|
|
|
this.showSet = option.showSet ? JSON.parse(option.showSet) : this.showSet
|
|
|
|
|
this.isSet2()
|
2024-04-24 18:11:06 +08:00
|
|
|
|
this.formData.delivery_way = this.$store.state.app.userInfo?.mer_info.delivery_way.split(',')
|
2024-04-24 08:47:26 +08:00
|
|
|
|
if (option.product_id) {
|
2024-04-24 18:11:06 +08:00
|
|
|
|
this.formData.product_id = option.product_id
|
2024-04-24 08:47:26 +08:00
|
|
|
|
this.mode = 'edit'
|
|
|
|
|
this.showSet = true
|
|
|
|
|
productDetail(option.mer_id, option.product_id).then(res => {
|
2024-04-24 18:11:06 +08:00
|
|
|
|
Object.assign(this.formData, res.data)
|
|
|
|
|
this.$set(this.formData, "imageList", res.data.image_list)
|
2024-04-24 08:47:26 +08:00
|
|
|
|
this.formData.product_attribute = JSON.parse(this.formData.product_attribute)
|
|
|
|
|
this.formData.cate_name = this.formData.storeCategory.cate_name
|
|
|
|
|
this.formData.cate_id = this.formData.storeCategory.store_category_id
|
2024-04-24 18:11:06 +08:00
|
|
|
|
delete this.formData.image_list
|
|
|
|
|
if (!this.formData.imageList) this.formData.imageList = []
|
2024-04-25 18:09:35 +08:00
|
|
|
|
this.oldToNew(this.formData)
|
|
|
|
|
console.log(this.formData, 'formDATA')
|
2024-04-24 08:47:26 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
2024-04-19 18:08:04 +08:00
|
|
|
|
},
|
|
|
|
|
onBackPress: function(e) {
|
|
|
|
|
this.showlay = true
|
|
|
|
|
return this.go;
|
|
|
|
|
}
|
2024-04-17 18:02:49 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang='scss'>
|
|
|
|
|
.content {
|
|
|
|
|
width: 100vw;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
background-color: #F1F1F1;
|
|
|
|
|
box-sizing: border-box;
|
2024-04-18 18:02:57 +08:00
|
|
|
|
padding-bottom: 280rpx;
|
2024-04-19 18:08:04 +08:00
|
|
|
|
font-family: PingFangRegular;
|
|
|
|
|
padding: 20rpx 20rpx 200rpx 20rpx;
|
2024-04-17 18:02:49 +08:00
|
|
|
|
|
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
.card {
|
2024-04-17 18:02:49 +08:00
|
|
|
|
background-color: white;
|
2024-04-19 18:08:04 +08:00
|
|
|
|
padding: 28rpx 30rpx;
|
|
|
|
|
border-radius: 12rpx;
|
2024-04-18 18:02:57 +08:00
|
|
|
|
margin-bottom: 30rpx;
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
.uploadimg {
|
|
|
|
|
width: 140rpx;
|
|
|
|
|
height: 140rpx;
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
border: 2rpx solid #F1F1F1;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
align-items: center;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding: 20rpx 0;
|
2024-04-22 18:05:44 +08:00
|
|
|
|
/* margin-left: 20rpx; */
|
|
|
|
|
overflow: hidden;
|
2024-04-19 18:08:04 +08:00
|
|
|
|
|
2024-04-17 18:02:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.tips {
|
2024-04-18 18:02:57 +08:00
|
|
|
|
color: #777777;
|
2024-04-19 18:08:04 +08:00
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
margin: 30rpx 0;
|
2024-04-18 18:02:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.submit-btn {
|
|
|
|
|
position: fixed;
|
2024-04-19 18:08:04 +08:00
|
|
|
|
bottom: 50rpx;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translate(-50%, 0);
|
|
|
|
|
width: 670rpx;
|
|
|
|
|
border-radius: 40rpx;
|
|
|
|
|
overflow: hidden;
|
2024-04-18 18:02:57 +08:00
|
|
|
|
}
|
2024-04-19 18:08:04 +08:00
|
|
|
|
}
|
2024-04-17 18:02:49 +08:00
|
|
|
|
|
2024-04-19 18:08:04 +08:00
|
|
|
|
.overlay-content {
|
|
|
|
|
width: 570rpx;
|
|
|
|
|
height: 640rpx;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
border-radius: 16rpx;
|
|
|
|
|
background-image: url('/static/images/addGodd/addGoodBg.png');
|
|
|
|
|
background-size: 100% 100%;
|
|
|
|
|
background-repeat: no-repeat;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 70rpx 0 40rpx 0;
|
2024-04-17 18:02:49 +08:00
|
|
|
|
}
|
2024-04-22 18:05:44 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.jiao {
|
|
|
|
|
image {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: -14rpx;
|
|
|
|
|
right: -14rpx;
|
|
|
|
|
width: 50rpx;
|
|
|
|
|
height: 50rpx;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
padding: 8rpx;
|
|
|
|
|
z-index: 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
video {
|
|
|
|
|
width: 140rpx;
|
|
|
|
|
height: 140rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.preview_video {
|
|
|
|
|
position: absolute;
|
|
|
|
|
background-color: red;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.content_list_video {
|
|
|
|
|
min-height: 154rpx;
|
|
|
|
|
padding: 23rpx 10rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.content_list_video_title {
|
|
|
|
|
/* padding-top: 10rpx; */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.video-count {
|
|
|
|
|
position: fixed;
|
|
|
|
|
width: 600rpx;
|
|
|
|
|
height: 500rpx;
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 50%;
|
|
|
|
|
margin-left: -300rpx;
|
|
|
|
|
margin-top: -250rpx;
|
|
|
|
|
z-index: 100;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
.videoLink {
|
|
|
|
|
width: 600rpx;
|
|
|
|
|
height: 500rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.video-text {
|
|
|
|
|
color: red;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
text-align: center;
|
|
|
|
|
/* position: absolute; */
|
|
|
|
|
|
|
|
|
|
}
|
2024-04-25 18:09:35 +08:00
|
|
|
|
|
|
|
|
|
.image-play-icon {
|
|
|
|
|
background-color: rgba(0, 0, 0, 0.3);
|
|
|
|
|
width: 140rpx;
|
|
|
|
|
height: 140rpx;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 50%;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
}
|
2024-04-17 18:02:49 +08:00
|
|
|
|
</style>
|