提交 914cea70 authored 作者: huaxinzhu's avatar huaxinzhu

添加商品接口0.5

上级 bda5cd9a
...@@ -18,9 +18,16 @@ export function GetCategory(query) { ...@@ -18,9 +18,16 @@ export function GetCategory(query) {
}) })
} }
// 查询运费模板 // 查询运费模板
// export function GetFreight(query) {
// return request({
// url: '/system/goods/getFreight',
// method: 'get',
// params: query
// })
// }
export function GetFreight(query) { export function GetFreight(query) {
return request({ return request({
url: '/system/goods/getFreight', url: '/system/freightNew/getFreight',
method: 'get', method: 'get',
params: query params: query
}) })
...@@ -70,7 +77,7 @@ export function delGoods(ids) { ...@@ -70,7 +77,7 @@ export function delGoods(ids) {
//上传图片 //上传图片
export function UploadImg(data) { export function UploadImg(data) {
return request({ return request({
url: '/system/goods/uploadImg', url: '/system/goodsNew/uploadImage',
method: 'post', method: 'post',
data: data data: data
}) })
......
...@@ -7,24 +7,23 @@ import { getToken } from '@/utils/auth' ...@@ -7,24 +7,23 @@ import { getToken } from '@/utils/auth'
NProgress.configure({ showSpinner: false }) NProgress.configure({ showSpinner: false })
const whiteList = ['/login','/platformlogin', '/auth-redirect', '/bind', '/register'] const whiteList = ['/login','/platformlogin', '/auth-redirect', '/bind', '/register','/newyuncang']
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
//debugger
NProgress.start() NProgress.start()
// console.log("getToken()",getToken()) // console.log("getToken()",getToken())
if (getToken()) { if (getToken()) {
//
/* has token*/ /* has token*/
if (to.path === '/login') { if (to.path === '/login') {
return false return false
next({ path: '/' }) next({ path: '/' })
NProgress.done() NProgress.done()
} else { } else {
// console.log(3333)
if (store.getters.roles.length === 0) { if (store.getters.roles.length === 0) {
// console.log(4444)
// 判断当前用户是否已拉取完user_info信息 // 判断当前用户是否已拉取完user_info信息
store.dispatch('GetInfo').then(res => { store.dispatch('GetInfo').then(res => {
// console.log("res",res.data.Role)
// return false // return false
// 拉取user_info // 拉取user_info
const roles = res.data.Role const roles = res.data.Role
...@@ -53,15 +52,15 @@ router.beforeEach((to, from, next) => { ...@@ -53,15 +52,15 @@ router.beforeEach((to, from, next) => {
} }
} }
} else { } else {
//debugger
// 没有token // 没有token
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
console.log("在免登录白名单,直接进入") console.log("在免登录白名单,直接进入")
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next() next()
} else { } else {
// console.log(999999) //next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 next(`/newyuncang?redirect=${to.path}`) // 否则全部重定向到登录页
NProgress.done() NProgress.done()
} }
} }
......
import Vue from 'vue' import Vue from 'vue'
import Router from 'vue-router' import Router from 'vue-router'
Vue.use(Router) Vue.use(Router)
/* Layout */ /* Layout */
...@@ -40,11 +41,22 @@ export const constantRoutes = [ ...@@ -40,11 +41,22 @@ export const constantRoutes = [
} }
] ]
}, },
{ // {
path: '/setpsd', // path: '/redirect',
component: (resolve) => require(['@/views/system/settings/setpsd'], resolve), // component: Layout,
hidden: true // hidden: true,
}, // children: [
// {
// path: '/redirect/:path(.*)',
// component: (resolve) => require(['@/views/redirect'], resolve)
// }
// ]
// },
// {
// path: '/setpsd',
// component: (resolve) => require(['@/views/system/settings/setpsd'], resolve),
// hidden: true
// },
{ {
path: '/platformlogin', path: '/platformlogin',
component: (resolve) => require(['@/views/platformlogin'], resolve), component: (resolve) => require(['@/views/platformlogin'], resolve),
...@@ -65,6 +77,11 @@ export const constantRoutes = [ ...@@ -65,6 +77,11 @@ export const constantRoutes = [
component: (resolve) => require(['@/views/error/401'], resolve), component: (resolve) => require(['@/views/error/401'], resolve),
hidden: true hidden: true
}, },
{
path: '/newyuncang',
component: (resolve) => require(['@/views/entry/newyuncang'], resolve),
hidden: true
},
// 总体流程 // 总体流程
{ {
path: '/process', path: '/process',
......
...@@ -20,6 +20,9 @@ const permission = { ...@@ -20,6 +20,9 @@ const permission = {
return new Promise(resolve => { return new Promise(resolve => {
// 向后端请求路由数据 // 向后端请求路由数据
getRouters().then(res => { getRouters().then(res => {
if(!res.data) {
res.data = [];
}
const accessedRoutes = filterAsyncRouter(res.data) const accessedRoutes = filterAsyncRouter(res.data)
accessedRoutes.push({ path: '*', redirect: '/404', hidden: true }) accessedRoutes.push({ path: '*', redirect: '/404', hidden: true })
commit('SET_ROUTES', accessedRoutes) commit('SET_ROUTES', accessedRoutes)
......
...@@ -181,16 +181,16 @@ ...@@ -181,16 +181,16 @@
<div class="brand-carousel"> <div class="brand-carousel">
<el-carousel ref="cardShow" @change="brandCarChange()" :autoplay="false" arrow="never" indicator-position="none" type="card" class="card-show" height="400px" style="margin: 20px auto;"> <el-carousel ref="cardShow" @change="brandCarChange()" :autoplay="false" arrow="never" indicator-position="none" type="card" class="card-show" height="400px" style="margin: 20px auto;">
<el-carousel-item name="1" class="pre-el-carousel-item"> <el-carousel-item name="1" class="pre-el-carousel-item">
<img src="../../assets/image/website/服饰.png" alt=""> <img src="../../assets/image/website/clothesImgs.png" alt="">
</el-carousel-item> </el-carousel-item>
<el-carousel-item name="2" class="pre-el-carousel-item"> <el-carousel-item name="2" class="pre-el-carousel-item">
<img src="../../assets/image/website/电器.png" alt=""> <img src="../../assets/image/website/electricalImgs.png" alt="">
</el-carousel-item> </el-carousel-item>
<el-carousel-item name="3" class="pre-el-carousel-item"> <el-carousel-item name="3" class="pre-el-carousel-item">
<img src="../../assets/image/website/食品.png" alt=""> <img src="../../assets/image/website/foodImgs.png" alt="">
</el-carousel-item> </el-carousel-item>
<el-carousel-item name="4" class="pre-el-carousel-item"> <el-carousel-item name="4" class="pre-el-carousel-item">
<img src="../../assets/image/website/母婴.png" alt=""> <img src="../../assets/image/website/maternalImgs.png" alt="">
</el-carousel-item> </el-carousel-item>
</el-carousel> </el-carousel>
</div> </div>
...@@ -280,12 +280,13 @@ ...@@ -280,12 +280,13 @@
toRegister() { toRegister() {
store.dispatch('LogOut').then(() => { store.dispatch('LogOut').then(() => {
var ssa = window.location.host; var ssa = window.location.host;
window.location.href = 'http://sso.jxhh.com/logout?redirect=http://' + ssa // window.location.href = 'http://sso.jxhh.com/logout?redirect=http://' + ssa
window.location.href = 'http://sso.jxhh.com/logout?redirect=http://' + window.location.host + '/platformlogin'
}) })
}, },
// 去登录 // 去登录
toLogin() { toLogin() {
window.location.href = 'http://sso.jxhh.com/logout?redirect=http://' + window.location.host + '/platformlogin' //window.location.href = 'http://sso.jxhh.com/logout?redirect=http://' + window.location.host + '/platformlogin'
} }
} // methods end } // methods end
...@@ -707,6 +708,7 @@ ...@@ -707,6 +708,7 @@
} }
.el-carousel__item:nth-child(2n) { .el-carousel__item:nth-child(2n) {
background-color: #fff; background-color: #fff;
transform : scaleY(1.8);
} }
// //
.el-carousel__item:nth-child(2n+1) { .el-carousel__item:nth-child(2n+1) {
......
...@@ -24,13 +24,9 @@ ...@@ -24,13 +24,9 @@
@selection-change="handleSelectionChange"> @selection-change="handleSelectionChange">
<el-table-column label="商户ID" align="center" prop="id"/> <el-table-column label="商户ID" align="center" prop="id"/>
<el-table-column label="开户名" align="center" prop="bank_account_name"/> <el-table-column label="开户名" align="center" prop="bank_account_name"/>
<!-- <el-table-column label="城市名" align="center" prop="ProvinceCity"/>-->
<el-table-column label="银行名称" align="center" prop="bank_name"/> <el-table-column label="银行名称" align="center" prop="bank_name"/>
<el-table-column label="开户行" align="center" prop="bank_branch_name"/> <el-table-column label="开户行" align="center" prop="bank_branch_name"/>
<el-table-column label="账号" align="center" prop="bank_account_sn"/> <el-table-column label="账号" align="center" prop="bank_account_sn"/>
<!-- <el-table-column label="支付宝账户名称" align="center" prop="ZfbAccountName" />-->
<!-- <el-table-column label="支付宝账户" align="center" prop="ZfbAccount" />-->
<!-- <el-table-column label="类型" :formatter="btypa" align="center" prop="State"/>-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -49,36 +45,12 @@ ...@@ -49,36 +45,12 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改商户银行卡对话框 -->
<!-- <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>-->
<!-- <el-form ref="form" :model="form" :rules="rules" label-width="80px">-->
<!-- <el-form-item label="类型">-->
<!-- <el-select @change="selectChanged" v-model="form.txType" placeholder="类型">-->
<!-- <el-option v-for="item in state" :key="item.value" :label="item.label"-->
<!-- :value="item.value"></el-option>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <div slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="submitForm">确 定</el-button>-->
<!-- <el-button @click="cancel">取 消</el-button>-->
<!-- </div>-->
<!-- </el-dialog>-->
<el-dialog :visible.sync="bank" :title="banktitle"> <el-dialog :visible.sync="bank" :title="banktitle">
<el-form ref="form" :model="form" :rules="rules" label-width="90px" size="small"> <el-form ref="form" :model="form" :rules="rules" label-width="90px" size="small">
<!-- <el-row>-->
<!-- <el-col :span="16" :offset="3">-->
<!-- <el-form-item label="开户城市" prop="ProvinceCity">-->
<!-- <el-input v-model="form.ProvinceCity" placeholder="请输入城市名和商户提交时一致"/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- </el-row>-->
<el-row> <el-row>
<el-col :span="16" :offset="3"> <el-col :span="16" :offset="3">
<el-form-item label="银行名称"> <el-form-item label="银行名称" prop="bankName">
<el-select v-model="form.bankName" placeholder="状态" style="width: 100%"> <el-select v-model="form.bankName" placeholder="请选择银行名称" style="width: 100%">
<el-option v-for="item in bankList" :key="item.value" :label="item.value" <el-option v-for="item in bankList" :key="item.value" :label="item.value"
:value="item.value"></el-option> :value="item.value"></el-option>
</el-select> </el-select>
...@@ -117,21 +89,6 @@ ...@@ -117,21 +89,6 @@
</div> </div>
</el-dialog> </el-dialog>
<!-- <el-dialog :visible.sync="zfb" :title="banktitle">-->
<!-- <el-form ref="form" :model="form" :rules="rules2" label-width="80px">-->
<!-- <el-form-item label="支付宝账户名称" prop="ZfbAccountName">-->
<!-- <el-input v-model="form.ZfbAccountName" placeholder="请输入支付宝账户名称"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="支付宝账户" prop="ZfbAccount">-->
<!-- <el-input v-model="form.ZfbAccount" placeholder="请输入支付宝账户"/>-->
<!-- </el-form-item>-->
<!-- </el-form>-->
<!-- <div slot="footer" class="dialog-footer">-->
<!-- <el-button type="primary" @click="submitForm">确 定</el-button>-->
<!-- <el-button @click="cancel">取 消</el-button>-->
<!-- </div>-->
<!-- </el-dialog>-->
</el-card> </el-card>
</div> </div>
</template> </template>
...@@ -183,18 +140,20 @@ ...@@ -183,18 +140,20 @@
}, },
// 表单校验 // 表单校验
rules: {}, rules: {
rules2: { bankName: [
ZfbAccountName: [ {required: true, message: "银行名称不能为空", trigger: "change"}
{required: true, message: "支付宝账户名称不能为空", trigger: "blur"}
], ],
ZfbAccount: [ bank_branch_name: [
{required: true, message: "支付宝账号不能为空", trigger: "blur"} {required: true, message: "开户行不能为空", trigger: "blur"}
], ],
// zfb_account_name: [ bankAccountName: [
// { required: true, message: "支付宝账户名称不能为空", trigger: "blur" } {required: true, message: "户名不能为空", trigger: "blur"}
// ], ],
} BankAccountSn: [
{required: true, message: "账号不能为空", trigger: "blur"}
],
},
}; };
}, },
created() { created() {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<el-form-item label="银行卡" prop="bank_id"> <el-form-item label="银行卡" prop="bank_id">
<el-select v-model="form.bank_id" placeholder="选择到账银行卡" style="width:260px;"> <el-select v-model="form.bank_id" placeholder="选择到账银行卡" style="width:260px;">
<el-option v-for="item in banklist" :key="item.Id" <el-option v-for="item in banklist" :key="item.Id"
:label="item.bank_name ? item.bank_name : bank_account_name" :label="item.bank_name ? item.bank_name : item.bank_account_name"
:value="item.id ? item.id : item.Id"></el-option> :value="item.id ? item.id : item.Id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
......
...@@ -2,28 +2,28 @@ ...@@ -2,28 +2,28 @@
<div class="goods-after-sale"> <div class="goods-after-sale">
<el-form ref="goodsAfterSaleForm" :model="goodsAfterSaleForm" :rules="goodsAfterSaleRules" label-width="150px" size="small"> <el-form ref="goodsAfterSaleForm" :model="goodsAfterSaleForm" :rules="goodsAfterSaleRules" label-width="150px" size="small">
<el-form-item label="服务标签:" prop="fwbq"> <el-form-item label="服务标签:" prop="stags">
<el-checkbox-group v-model="goodsAfterSaleForm.fwbq"> <el-checkbox-group v-model="goodsAfterSaleForm.stags">
<el-checkbox v-for="item in tagOptions" :label="item.id" true-label :key="item.id">{{item.tag}}</el-checkbox> <el-checkbox v-for="item in tagOptions" :label="item.id" true-label :key="item.id" @change="serviceTagsChange(item.id)">{{item.tag}}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
<el-form-item label="邮费模板:" prop="freightId"> <el-form-item label="邮费模板:" prop="freight_id">
<el-select v-model="goodsAfterSaleForm.freightId" placeholder="请选择邮费模板" style="width:400px;"> <el-select v-model="goodsAfterSaleForm.freight_id" placeholder="请选择邮费模板" style="width:400px;">
<el-option v-for="item in freightOptions" :key="item.Id" :label="item.Name" :value="item.Id"></el-option> <el-option v-for="item in freightOptions" :key="item.Id" :label="item.Name" :value="item.Id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="发货时效:" prop="Delayompensate"> <el-form-item label="发货时效:" prop="delay_compensate">
<el-select v-model="goodsAfterSaleForm.Delayompensate" style="width:400px;" placeholder="请选择发货时效"> <el-select v-model="goodsAfterSaleForm.delay_compensate" style="width:400px;" placeholder="请选择发货时效">
<el-option label="24小时" :value="24"></el-option> <el-option label="24小时" :value="24"></el-option>
<el-option label="48小时" :value="48"></el-option> <el-option label="48小时" :value="48"></el-option>
<el-option label="72小时" :value="72"></el-option> <el-option label="72小时" :value="72"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="售后时长:" prop="aftersaleTime"> <el-form-item label="售后时长:" prop="aftersale_time">
<el-select v-model="goodsAfterSaleForm.aftersaleTime" style="width:400px;" placeholder="请选择售后时长"> <el-select v-model="goodsAfterSaleForm.aftersale_time" style="width:400px;" placeholder="请选择售后时长">
<el-option label="7天" :value="7"></el-option> <el-option label="7天" :value="7"></el-option>
<el-option label="15天" :value="15"></el-option> <el-option label="15天" :value="15"></el-option>
<el-option label="30天" :value="30"></el-option> <el-option label="30天" :value="30"></el-option>
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
} }
}, },
data() { data() {
let checkFwbq = (rule, value, callback) => { let checkStags = (rule, value, callback) => {
if (this.goodsAfterSaleForm.fwbq.length === 0) { if (this.goodsAfterSaleForm.stags.length === 0) {
callback(new Error("请选择服务类型")); callback(new Error("请选择服务类型"));
} else { } else {
callback(); callback();
...@@ -56,21 +56,23 @@ ...@@ -56,21 +56,23 @@
}; };
return { return {
goodsAfterSaleForm: { goodsAfterSaleForm: {
fwbq: [], stags: [],
freightId: 310, freight_id: 310,
Delayompensate: 24, delay_compensate: 24,
aftersaleTime: 7 aftersale_time: 7
}, },
goodsAfterSaleRules: { goodsAfterSaleRules: {
fwbq: [{required: true, validator: checkFwbq}], stags: [{required: true, validator: checkStags}],
freightId: [{required: true, message: '请选择邮费模板', trigger: 'change'}], freight_id: [{required: true, message: '请选择邮费模板', trigger: 'change'}],
Delayompensate: [{required: true, message: '请选择发货时效', trigger: 'change'}], delay_compensate: [{required: true, message: '请选择发货时效', trigger: 'change'}],
aftersaleTime: [{required: true, message: '请选择售后时长', trigger: 'change'}] aftersale_time: [{required: true, message: '请选择售后时长', trigger: 'change'}]
}, },
tagOptions: [ tagOptions: [
{id: 2, tag: "假一赔十"}, {id: 2, tag: "假一赔十"},
{id: 3, tag: "7天退换"},
{id: 4, tag: "不可退还"}, {id: 4, tag: "不可退还"},
{id: 5, tag: "厂家直供"} {id: 5, tag: "厂家直供"},
{id: 6, tag: "售后无忧"}
], ],
freightOptions: [] freightOptions: []
} // return end } // return end
...@@ -81,14 +83,30 @@ ...@@ -81,14 +83,30 @@
methods: { methods: {
// 运费模板 // 运费模板
getFreightData() { getFreightData() {
// let query = { page: 1, limit: 50 };
GetFreight().then(res => { GetFreight().then(res => {
if(res.data) { if(res.data) {
this.freightOptions = res.data this.freightOptions = res.data.list;
}else { }else {
this.freightOptions = '' this.freightOptions = ''
} }
}); });
}, },
// 服务标签,7天退换、不可退换互斥
serviceTagsChange(id) {
let index4 = this.goodsAfterSaleForm.stags.indexOf(4);
let index3 = this.goodsAfterSaleForm.stags.indexOf(3);
if(id == 3) {
if( index4 > -1) {
this.goodsAfterSaleForm.stags.splice(index4,1)
}
}
if(id == 4) {
if( index3 > -1) {
this.goodsAfterSaleForm.stags.splice(index3,1)
}
}
},
// 商品信息 子组件 form表单校验, 在父组件中被调用 // 商品信息 子组件 form表单校验, 在父组件中被调用
validateGoodsAfterSaleForm () { validateGoodsAfterSaleForm () {
let flag = null let flag = null
......
<template> <template>
<div class="goods-img" v-loading="loading"> <div class="goods-img">
<el-form ref="goodsDeForm" :model="goodsDeForm" :rules="goodsDeRules" label-width="150px" size="small"> <el-form ref="goodsDeForm" :model="goodsDeForm" label-width="150px" size="small">
<el-form-item label="商品详情:" prop="spxq"> <el-form-item label="商品详情:" prop="spxq">
<span class="tip-span" style="display: block;line-height: 34px;">上传图片详情,用于商品详情页展示,建议尺寸宽度为750px或790px</span> <span class="tip-span up-img-tip" style="display: block;line-height: 34px;">上传图片详情,用于商品详情页展示</span>
<el-upload <el-upload
class="upload-img" class="avatar-uploader2"
list-type="picture-card"
action="#" action="#"
:limit="10" name="file"
:on-exceed="limitImg10" auto-upload
:http-request="uploadGoodsDetailsImg" :show-file-list="false"
:on-preview="handlePicPreview" multiple
:on-remove="handleRemove"
:file-list="goodsDetailsImgFileList" :file-list="goodsDetailsImgFileList"
><i class="el-icon-plus" /> ><i class="el-icon-plus" />
</el-upload> </el-upload>
<el-dialog :visible.sync="goodsDeImgVisible"> <input class="uploadImg" style="display: none;" type="file" ref="file" accept="image/*" @change="fileChange($event)" name="file" multiple id="file">
<img width="100%" :src="goodsDeImgUrlDialog" alt=""> <quill-editor class="quill-editor-class" ref="myTextEditor" v-model="description" :options="editorOption" @change="onEditorChange" style="height:500px;margin-bottom:20px;"></quill-editor>
</el-dialog>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -25,7 +22,8 @@ ...@@ -25,7 +22,8 @@
<script> <script>
import {UploadImg} from '@/api/module/goods' import {UploadImg} from '@/api/module/goods'
// 工具栏配置
const toolbarOptions = [ ['image'] ];
export default { export default {
name: "Goodsimg", name: "Goodsimg",
props: { props: {
...@@ -35,24 +33,44 @@ ...@@ -35,24 +33,44 @@
} }
}, },
data() { data() {
let checkImg = (rule, value, callback) => { // let checkImg = (rule, value, callback) => {
if (this.goodsDetailsImgFileList.length < 1) { // if (this.goodsDetailsImgFileList.length < 1) {
callback(new Error("请上传商品详情的图片")); // callback(new Error("请上传商品详情的图片"));
} else { // } else {
callback(); // callback();
} // }
}; // };
return { return {
loading: false, loading: false,
goodsDeForm: { goodsDeForm: {
spxq: '' spxq: ''
}, },
goodsDeRules: { // goodsDeRules: {
spxq:[{required: true, message: '请上传商品详情图片', validator: checkImg}] // spxq:[{required: true, message: '请上传商品详情图片', validator: checkImg}]
}, // },
goodsDeImgVisible: false, description: '',
goodsDeImgUrlDialog: '',
goodsDetailsImgFileList: [], goodsDetailsImgFileList: [],
editorOption: {
placeholder: '',
theme: 'snow', // or 'bubble'
modules: {
toolbar: {
container: toolbarOptions, // 工具栏
handlers: {
'image': function (value) {
if (value) {
// 触发input框选择图片文件
document.querySelector('#file').click()
} else {
this.quill.format('image', false);
}
}
}
}
}
},
index: 0,
indexall: 0,
}; };
}, },
components: {}, components: {},
...@@ -60,61 +78,66 @@ ...@@ -60,61 +78,66 @@
}, },
watch: {}, watch: {},
methods: { methods: {
// 通过原生 input上传 图片
// 上传 详情 图片 fileChange() {
uploadGoodsDetailsImg(param) { const list = this.$refs.file.files;
this.getBase64(param.file).then( res => { this.indexall = list.length
this.uploadImgs()
},
// 向后台 传输 base64的图片数据
uploadImgs() {
this.getBase64(this.$refs.file.files[this.index]).then((res) => {
let result = res.split(","); let result = res.split(",");
this.Base64img = result[1]; this.Base64img = result[1];
let data = {"image":this.Base64img}; let data = {"img_data": this.Base64img}
UploadImg(data).then( res=> { debugger
let urlObj = {'url': ''}; // this.loading = true;
if(res.data) { UploadImg(data).then(res => {
urlObj.url = res.data.data.imageUrl; debugger
this.goodsDetailsImgFileList.push(urlObj); if (res && res.code === 1) {
this.$message({type:'success',message:'图片上传成功'}); this.index++;
// // 只清除一次,不浪费哦 this.goodsDetailsImgFileList.push({'url': res.data.image_url});
if(this.goodsDetailsImgFileList.length === 1) { this.$message({ message:'上传成功',type:'success'});
this.$refs.goodsDeForm.clearValidate('spxq'); // 获取富文本组件实例
let quill = this.$refs.myTextEditor.quill;
let length = quill.getSelection().index;
// 插入图片 res.data.url为服务器返回的图片地址
quill.insertEmbed(length, 'image', res.data.image_url)
// 调整光标到最后
quill.setSelection(length + 1)
if(this.index < this.indexall){
this.uploadImgs()
}else{
this.index = 0
} }
}else {
this.$message({ message:'上传失败,请重新上传',type:'error'});
} }
this.loading = false;
})
}); });
});
},
// 详情图片,限制 20 张
limitImg10() {
this.$message({ message: '最多上传10张图片', type: 'warning' })
}, },
// 详情图片 预览 //
handlePicPreview(file) { onEditorChange({editor, html, text}) {
this.goodsDeImgUrlDialog = file.url; this.description = html;
this.goodsDeImgVisible = true;
}, },
// 删除 详情图片
handleRemove(file) { onEditorBlur(){//失去焦点事件
for (let i = 0; i < this.goodsDetailsImgFileList.length; i++) {
if (file.uid === this.goodsDetailsImgFileList[i].uid) {
this.goodsDetailsImgFileList.splice(i, 1)
}
}
if(this.goodsDetailsImgFileList.length === 0) {
this.$refs.goodsDeForm.validateField('spxq')
}else {
this.$refs.goodsDeForm.clearValidate('spxq');
}
}, },
// 商品详情 子组件 form表单校验, 在父组件中被调用 // 商品详情 子组件 form表单校验, 在父组件中被调用
validateGoodsDeImgForm() { // validateGoodsDeImgForm() {
let flag = null // let flag = null
this.$refs['goodsDeForm'].validate(valid => { // this.$refs['goodsDeForm'].validate(valid => {
if (valid) { // if (valid) {
flag = true // flag = true
} else { // } else {
flag = false // flag = false
} // }
}) // })
return flag // return flag
}, // },
// -------------------------通用 // -------------------------通用
// 图片转换为 base64 // 图片转换为 base64
getBase64(file) { getBase64(file) {
...@@ -141,6 +164,37 @@ ...@@ -141,6 +164,37 @@
padding: 15px 0px; padding: 15px 0px;
margin-top: 18px; margin-top: 18px;
} }
.avatar-uploader2 {
display : none;
}
.quill-editor-class {
position: relative;
}
.up-img-tip {
position: absolute;
top: 0;
left: 60px;
}
/deep/.ql-toolbar.ql-snow {
border: none;
border-bottom: 1px solid #ccc;
padding: 5px 8px;
}
/deep/.ql-toolbar.ql-snow .ql-formats {
vertical-align : baseline;
margin: 0;
padding: 0 8px;
border: 1px solid #ccc;
border-radius: 3px;
}
/deep/.ql-toolbar.ql-snow .ql-formats:hover {
background-color : #00afff;
border-color: #00afff;
}
/* 一般提示性文字 */ /* 一般提示性文字 */
.tip-span { .tip-span {
......
...@@ -4,11 +4,58 @@ ...@@ -4,11 +4,58 @@
<el-link class="edit-type-span el-icon-search" type="primary" :underline="false">查看各类价格说明</el-link> <el-link class="edit-type-span el-icon-search" type="primary" :underline="false">查看各类价格说明</el-link>
<span class="tip-span">所有商品价格均为含税价,必须开具发票</span> <span class="tip-span">所有商品价格均为含税价,必须开具发票</span>
</p> </p>
<!-- <div v-if="(!orgGoodsPam.pamTableList || orgGoodsPam.pamTableList.length === 0)">-->
<!-- <el-table-->
<!-- border-->
<!-- size="small"-->
<!-- :data="noSpecTable"-->
<!-- style="width: 80%"-->
<!-- >-->
<!-- <el-table-column align="center" prop="hh1" label="协议价">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input size="mini" style="width:90%" v-model="scope.row.hh1" placeholder="请输入协议价"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="hh2" label="结算价">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input size="mini" style="width:90%" v-model="scope.row.hh2" :disabled="true" placeholder="根据结算价自动计算"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="hh3" label="指导价">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input size="mini" style="width:90%" v-model="scope.row.hh3" placeholder="请输入指导价"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="hh4" label="市场价">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input size="mini" style="width:90%" v-model="scope.row.hh4" placeholder="请输入市场价"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="hh5" label="库存量">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input size="mini" style="width:90%" v-model="scope.row.hh5" placeholder="请输入库存量"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="hh6" label="库存预警">-->
<!-- <template slot-scope="scope">-->
<!-- <el-input size="mini" style="width:90%" v-model="scope.row.hh6" placeholder="请输入预警值"></el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" prop="hh7" label="图片">-->
<!-- <template slot-scope="scope">-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- </el-table>-->
<!-- </div>-->
<div v-for="(item,index) in orgGoodsPam.pamTableList" :key="index" class="single-spe-con"> <div v-for="(item,index) in orgGoodsPam.pamTableList" :key="index" class="single-spe-con">
<p style="margin: 10px 0;color: #333;font-size: 14px;font-weight: 400;"> <p style="margin: 10px 0;color: #333;font-size: 14px;font-weight: 400;">
<!-- <span v-html="preTableTitle[index]">--> <!-- <span v-html="preTableTitle[index]">-->
<!-- {{ preTableTitle[index] }}--> <!-- {{ preTableTitle[index] }}-->
<!-- </span>--> <!-- </span>-->
<span v-for="(itemv,indexv) in orgGoodsPam.pamDataList[index]" style="margin-right:20px;"> <span v-for="(itemv,indexv) in orgGoodsPam.pamDataList[index]" style="margin-right:20px;">
{{orgGoodsPam.pamNameList[indexv]['specName']}} {{orgGoodsPam.pamNameList[indexv]['specName']}}
<span></span> <span></span>
...@@ -16,7 +63,6 @@ ...@@ -16,7 +63,6 @@
</span> </span>
</p> </p>
<el-table <el-table
border border
size="small" size="small"
...@@ -59,8 +105,9 @@ ...@@ -59,8 +105,9 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
</template> </template>
...@@ -77,6 +124,17 @@ export default { ...@@ -77,6 +124,17 @@ export default {
return { return {
orgGoodsPam: {}, orgGoodsPam: {},
preTableTitle: [], preTableTitle: [],
noSpecTable: [
{
hh1: '',
hh2: '',
hh3: '',
hh4: '',
hh5: '',
hh6: '',
hh7: '',
}
],
// 规格名称数组 // 规格名称数组
// goodsSpecNameList: [], // goodsSpecNameList: [],
// // 每一个规格,都是一张表格 // // 每一个规格,都是一张表格
...@@ -113,7 +171,9 @@ export default { ...@@ -113,7 +171,9 @@ export default {
}, },
watch:{ watch:{
'parameterdata': function(val) { 'parameterdata': function(val) {
//debugger
this.orgGoodsPam = val; this.orgGoodsPam = val;
//console.log(175,this.orgGoodsPam);
//this.preTableTitle = []; //this.preTableTitle = [];
// this.orgGoodsPam.pamDataList.forEach((item)=> { // this.orgGoodsPam.pamDataList.forEach((item)=> {
// let preTitle = ''; // let preTitle = '';
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
<el-option <el-option
v-for="(itemSN,indexSN) in speOptions" v-for="(itemSN,indexSN) in speOptions"
:key="itemSN.id" :key="itemSN.id"
:label="itemSN.title" :label="itemSN.name"
:value="itemSN.title" :value="itemSN.id"
> >
<span style="float: left" class="span-style">{{ itemSN.title }}</span> <span style="float: left" class="span-style">{{ itemSN.name }}</span>
<div class="flag"> <div class="flag">
<svg-icon icon="edit" iconClass="template_edit_style" @click="addSpeName(index)"/> <svg-icon icon="edit" iconClass="template_edit_style" @click="addSpeName(index)"/>
</div> </div>
...@@ -48,7 +48,29 @@ ...@@ -48,7 +48,29 @@
</div> </div>
<el-button @click="addSpe" class="el-icon-plus" size="mini">添加规格</el-button> <el-button @click="addSpe" class="el-icon-plus" size="mini">添加规格</el-button>
<!-- <el-button type="primary" plain class="el-icon-plus" size="mini" @click="hhxx()">生成数据</el-button>-->
<!-- 添加 规格名称 -->
<el-dialog
title="添加规格名称"
:visible.sync="addSpecNameDialog"
:destroy-on-close="true"
:before-close="cancelSpec"
width="500px"
center
>
<div>
<p class="add-spec-dialog-con">
<span style="margin-right:30px;">输入规格名称:</span>
<span>
<el-input v-model="specName_sm" placeholder="请输入规格名称" size="small" style="width: 280px;"></el-input>
</span>
</p>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="cancelSpec" size="mini">取 消</el-button>
<el-button type="primary" @click="saveSpecName" size="mini">确 定</el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
...@@ -77,13 +99,16 @@ export default { ...@@ -77,13 +99,16 @@ export default {
}, },
speOptions: [{ speOptions: [{
id: '1', id: '1',
title: '颜色' name: '颜色'
}, { }, {
id: '2', id: '2',
title: '尺码' name: '尺码'
}], }],
localSpeOptions: [],
// 规格名称,value组成的数组 // 规格名称,value组成的数组
speNameList: [] speNameList: [],
addSpecNameDialog: false,
specName_sm: '',
}; };
}, },
created() { created() {
...@@ -92,7 +117,10 @@ export default { ...@@ -92,7 +117,10 @@ export default {
this.$set(this.speData,this.speData.length,this.specsGroup); this.$set(this.speData,this.speData.length,this.specsGroup);
//console.log(71,this.specsGroup.specValue); //console.log(71,this.specsGroup.specValue);
}, },
mounted() {}, mounted() {
/** 先获取 本地存储的localStorage **/
this.getLocalSpecNameOption();
},
watch:{}, watch:{},
methods: { methods: {
/** 添加规格*/ /** 添加规格*/
...@@ -122,10 +150,20 @@ export default { ...@@ -122,10 +150,20 @@ export default {
speNameChange() { speNameChange() {
this.speNameListChange(); this.speNameListChange();
}, },
// selectedCag(vId){
// console.log(vId)
//
// },
// 规格名称,有变化时 // 规格名称,有变化时
speNameListChange() { speNameListChange() {
// 将select 的value值,在
debugger
this.speNameList = []; this.speNameList = [];
this.speData.forEach((item,)=> { this.speData.forEach((item)=> {
let obj = {specName: ''}; let obj = {specName: ''};
if(item.specName) { if(item.specName) {
obj.specName = item.specName; obj.specName = item.specName;
...@@ -175,7 +213,7 @@ export default { ...@@ -175,7 +213,7 @@ export default {
// 底部按钮的点击事件 // 底部按钮的点击事件
_this.addSpeName(index); _this.addSpeName(index);
// // localSttorage 存储 下拉数据
if(speNameDom.toggleDropDownVisible) { if(speNameDom.toggleDropDownVisible) {
speNameDom.toggleDropDownVisible(false); speNameDom.toggleDropDownVisible(false);
} else { } else {
...@@ -186,9 +224,57 @@ export default { ...@@ -186,9 +224,57 @@ export default {
} }
} }
}, },
getLocalSpecNameOption() {
//console.log("先获取:",window.localStorage.getItem('localSpeOptions'));
if(!window.localStorage.getItem('localSpeOptions')) {
this.speOptions = [];
}else {
let options = JSON.parse(window.localStorage.getItem('localSpeOptions'));
this.speOptions = options;
}
},
/* 增加 规格名称 */ /* 增加 规格名称 */
addSpeName(index) { addSpeName(index) {
//console.log(index); this.addSpecNameDialog = true;
// console.log(index);
},
// 添加规格名称,对话框的退出
cancelSpec() {
this.specName_sm = '';
this.addSpecNameDialog = false;
},
// 规格名称,保存
saveSpecName() {
let localObj = {
id: 0,
name: ''
};
let localArr = [];
let localJSON = '';
if(this.speOptions.length === 0) {
let localObj = {
id: 0,
name: this.specName_sm
};
localArr.push(localObj);
localJSON = JSON.stringify(localArr);
}else {
let localObj = {
id: this.speOptions.length,
name: this.specName_sm
};
this.speOptions.push(localObj);
localJSON = JSON.stringify(this.speOptions)
}
window.localStorage.setItem('localSpeOptions',localJSON)
this.addSpecNameDialog = false;
this.$message({type:'success',message:'新增成功'});
this.getLocalSpecNameOption();
}, },
/** 规格参数 失焦时,进行笛卡尔积算法,并渲染 商品售价 */ /** 规格参数 失焦时,进行笛卡尔积算法,并渲染 商品售价 */
...@@ -221,39 +307,18 @@ export default { ...@@ -221,39 +307,18 @@ export default {
]; ];
goodsPam.pamTableList.push(prePamTable) goodsPam.pamTableList.push(prePamTable)
}); });
//console.log("最终结果",goodsPam); //console.log("最终结果",goodsPam);
this.$emit('calcSpeTable',goodsPam); this.$emit('calcSpeTable',goodsPam);
// goodsParametersList.forEach((item)=> {
// let goodsPrePam = {
// pamTitleList: [],
// pamTabList: []
// };
// let tableSingle = [{hh1: '', hh2: '', hh3: '', hh4: '', hh5: '', hh6: '', hh7: ''}];
// // let preTitle = '';
// // if (!Array.isArray(item)) {
// // preTitle = this.speNameList[0].specName + ':' + item;
// // }else {
// // item.forEach((itemI,indexI)=> {
// // preTitle += (this.speNameList[indexI].specName + itemI);
// // });
// // }
// // goodsPrePam.pamTitleList.push(preTitle);
// goodsPrePam.pamTabList.push(tableSingle);
//
// goodsPamList.push(goodsPrePam);
// });
//this.$emit('calcSpeTable',goodsPamList);
// console.log("规格名称:",goodsPamList);
} }
// else {
// let goodsPam = {
// pamNameList: [],
// pamDataList: [],
// pamTableList: [],
// };
// this.$emit('calcSpeTable',goodsPam);
// }
} }
}, },
...@@ -376,4 +441,11 @@ export default { ...@@ -376,4 +441,11 @@ export default {
color: #ff4949; color: #ff4949;
cursor: pointer; cursor: pointer;
} }
.add-spec-dialog-con {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
</style> </style>
...@@ -58,9 +58,9 @@ ...@@ -58,9 +58,9 @@
<p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>售后及服务</p> <p class="card-header-title floor-item-box-title"><span class="blue-block-goods blue-block-goods-title"></span>售后及服务</p>
<Goodsaftersale ref="goodsaftersale" :goodsaftersale="goodsaftersale" /> <Goodsaftersale ref="goodsaftersale" :goodsaftersale="goodsaftersale" />
<div class="submit-type-con"> <div class="submit-type-con">
<el-radio-group v-model="submitType" size="small"> <el-radio-group v-model="submit" size="small">
<el-radio :label="1" border>放入仓库</el-radio> <el-radio :label="0" border>放入仓库</el-radio>
<el-radio :label="2" border>立即上架</el-radio> <el-radio :label="1" border>立即上架</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
</div> </div>
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
leaf: 'leaf' leaf: 'leaf'
}, },
isNextStep: true, isNextStep: true,
isShowGoodsDetails: true, isShowGoodsDetails: false,
isFIActive: 0, isFIActive: 0,
/**/ /**/
floorNav: [ floorNav: [
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
], ],
/* 商品信息 */ /* 商品信息 */
goodsinfodata: { goodsinfodata: {
orgGoodsInfoForm: {},
categoryList: [], categoryList: [],
categoryStr: '' categoryStr: ''
}, },
...@@ -131,8 +132,7 @@ ...@@ -131,8 +132,7 @@
goodsaftersale: { goodsaftersale: {
}, },
submitType: 1, submit: 0,
TIMER: null, TIMER: null,
} // return end } // return end
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
// 规格子组件,传给父组件的数据 // 规格子组件,传给父组件的数据
calcSpeTable(data) { calcSpeTable(data) {
this.parameterdata = data; this.parameterdata = data;
//console.log(153,this.parameterdata); console.log(153,this.parameterdata);
}, },
// 只有点击完最后一级,才会有值 // 只有点击完最后一级,才会有值
SSQChange() { SSQChange() {
...@@ -229,6 +229,8 @@ ...@@ -229,6 +229,8 @@
this.goodsinfodata.categoryList = this.SSQList; this.goodsinfodata.categoryList = this.SSQList;
this.goodsinfodata.categoryStr = ssqLabelList[0] + '/' + ssqLabelList[1] + '/' + ssqLabelList[2]; this.goodsinfodata.categoryStr = ssqLabelList[0] + '/' + ssqLabelList[1] + '/' + ssqLabelList[2];
this.isShowGoodsDetails = true; this.isShowGoodsDetails = true;
// console.log(232,this.goodsinfodata.categoryStr,this.goodsinfodata.categoryList);
}, },
// //
...@@ -239,22 +241,25 @@ ...@@ -239,22 +241,25 @@
save() { save() {
// 此处变量 有顺序 校验时,电梯至某处 // 此处变量 有顺序 校验时,电梯至某处
// // 商品信息 是否填写完整 // 商品信息 是否填写完整
// let isGoodsInfoMsg = this.$refs['goodsInfo'].validateGoodsInfoForm(); //let isGoodsInfoMsg = this.$refs['goodsInfo'].validateGoodsInfoForm();
// // 商品详情 // // 商品详情
// let isGoodsDetailsImgMsg = this.$refs['goodsdetailsimg'].validateGoodsDeImgForm(); //let isGoodsDetailsImgMsg = this.$refs.goodsdetailsimg.description ? true : false;
// // 售后服务 是否填写完整 // // 售后服务 是否填写完整
// let isGoodsAfterSaleMsg = this.$refs['goodsaftersale'].validateGoodsAfterSaleForm(); // let isGoodsAfterSaleMsg = this.$refs['goodsaftersale'].validateGoodsAfterSaleForm();
// //
// //console.log(212,this.$refs.goodsaftersale.goodsAfterSaleForm) // 主动获取子组件数据 // //console.log(212,this.$refs.goodsaftersale.goodsAfterSaleForm) // 主动获取子组件数据
// //
// if(!isGoodsInfoMsg) { // if(!isGoodsInfoMsg) {
// this.$message({type:'error',message:'商品信息未填写完整'}); // this.$message({type:'error',message:'商品信息未填写完整'});
// this.setFloorNavMountClick(0); // this.setFloorNavMountClick(0);
// return // return
// } // }
// if(!isGoodsDetailsImgMsg) { // if(!isGoodsDetailsImgMsg) {
// this.$message({type:'error',message:'商品详情未填写完整'}); // this.$message({type:'error',message:'请先上传描述商品详情的图片'});
// this.setFloorNavMountClick(3); // this.setFloorNavMountClick(3);
// return // return
// } // }
...@@ -265,10 +270,17 @@ ...@@ -265,10 +270,17 @@
// } // }
// 所有校验通过,整理数据 // 所有校验通过,整理数据
this.specificationsdata = this.$refs.goodsspecifications.speData // 获取 商品信息数据
// goodsInfo goodsInfoForm
let spxxData = this.$refs.goodsInfo.goodsInfoForm;
// 售后服务 数据
let ssffData = this.$refs.goodsaftersale.goodsAfterSaleForm;
// 商品详情 数据
let spxqData = this.$refs.goodsdetailsimg.description;
console.log("商品规格数据:",this.specificationsdata); console.log("商品规格数据:",spxqData);
}, },
/*-----------------------*/ /*-----------------------*/
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论