202505280905
This commit is contained in:
parent
a16acd899b
commit
65c01d1a05
|
|
@ -99,6 +99,20 @@ public class UserAddressController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody UserAddress userAddress)
|
public AjaxResult edit(@RequestBody UserAddress userAddress)
|
||||||
{
|
{
|
||||||
|
if(userAddress.getIsDefault()==1){
|
||||||
|
//如果设为默认就将这个用户下所有数据设置为不默认,然后添加这条默认
|
||||||
|
userAddressService.updateUserAddressDefault(userAddress.getUid());
|
||||||
|
}else{
|
||||||
|
//如果用户没有默认地址,而且只添加了一条地址,那么就强制默认这个地址是默认地址
|
||||||
|
UserAddress userAddressData=new UserAddress();
|
||||||
|
userAddressData.setUid(userAddress.getUid());
|
||||||
|
userAddressData.setIsDefault(Long.valueOf(1));
|
||||||
|
List<UserAddress> list = userAddressService.selectUserAddressList(userAddressData);
|
||||||
|
//判断用户当前是否有默认地址
|
||||||
|
if(list.size()<1){
|
||||||
|
userAddress.setIsDefault(Long.valueOf(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
return toAjax(userAddressService.updateUserAddress(userAddress));
|
return toAjax(userAddressService.updateUserAddress(userAddress));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.system.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.QuoteType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
@ -90,7 +92,27 @@ public class UsersController extends BaseController
|
||||||
{
|
{
|
||||||
return toAjax(usersService.updateUsers(users));
|
return toAjax(usersService.updateUsers(users));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 定时任务状态修改
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:users:changeStatus')")
|
||||||
|
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public AjaxResult changeStatus(@RequestBody Users users)
|
||||||
|
{
|
||||||
|
// 修改或新增时:状态为关闭时,修改用户的type为1和is_work为0
|
||||||
|
//Type:1:普通用户 2:师傅。
|
||||||
|
// is_work:1:师傅。 0普通用户
|
||||||
|
|
||||||
|
Users newUsers = usersService.selectUsersById(users.getId());
|
||||||
|
System.out.println("###############"+newUsers.getType());
|
||||||
|
if (newUsers.getType().equals("2")&&users.getStatus()==0){
|
||||||
|
newUsers.setType("1");
|
||||||
|
newUsers.setIsWork(0);
|
||||||
|
}
|
||||||
|
newUsers.setStatus(users.getStatus());
|
||||||
|
return toAjax(usersService.updateUsers(newUsers));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 删除【请填写功能名称】
|
* 删除【请填写功能名称】
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ public class Users extends BaseEntity
|
||||||
@Excel(name = "1:启用 0:关闭")
|
@Excel(name = "1:启用 0:关闭")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
/**是否为师傅 是否为师傅1是,0否 */
|
||||||
|
@Excel(name = "1:是 ,0:否")
|
||||||
|
private Integer isWork;
|
||||||
|
|
||||||
/** 师傅等级 */
|
/** 师傅等级 */
|
||||||
@Excel(name = "师傅等级")
|
@Excel(name = "师傅等级")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
@ -495,6 +499,14 @@ public class Users extends BaseEntity
|
||||||
this.totalCommMin = totalCommMin;
|
this.totalCommMin = totalCommMin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getIsWork() {
|
||||||
|
return isWork;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsWork(Integer isWork) {
|
||||||
|
this.isWork = isWork;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,16 @@ public interface UserAddressMapper
|
||||||
*/
|
*/
|
||||||
public int insertUserAddress(UserAddress userAddress);
|
public int insertUserAddress(UserAddress userAddress);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改用户默认地址
|
||||||
|
*
|
||||||
|
* @param uid 用户收货地址
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateUserAddressDefault(Long uid);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户收货地址
|
* 修改用户收货地址
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,13 @@ public interface IUserAddressService
|
||||||
* @return 用户收货地址集合
|
* @return 用户收货地址集合
|
||||||
*/
|
*/
|
||||||
public List<UserAddress> selectUserAddressList(UserAddress userAddress);
|
public List<UserAddress> selectUserAddressList(UserAddress userAddress);
|
||||||
|
/**
|
||||||
|
* 修改用户默认地址
|
||||||
|
*
|
||||||
|
* @param uid 用户id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateUserAddressDefault(Long uid);
|
||||||
/**
|
/**
|
||||||
* 新增用户收货地址
|
* 新增用户收货地址
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,16 @@ public class UserAddressServiceImpl implements IUserAddressService
|
||||||
{
|
{
|
||||||
return userAddressMapper.selectUserAddressById(id);
|
return userAddressMapper.selectUserAddressById(id);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 修改用户默认地址
|
||||||
|
*
|
||||||
|
* @param uid 用户id
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateUserAddressDefault(Long uid) {
|
||||||
|
|
||||||
|
return userAddressMapper.updateUserAddressDefault(uid);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 查询用户收货地址列表
|
* 查询用户收货地址列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateUserAddressDefault" parameterType="Long">
|
||||||
|
update user_address
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
is_default =0
|
||||||
|
updated_at=NOW()
|
||||||
|
</trim>
|
||||||
|
where uid = #{uid}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<delete id="deleteUserAddressById" parameterType="Long">
|
<delete id="deleteUserAddressById" parameterType="Long">
|
||||||
delete from user_address where id = #{id}
|
delete from user_address where id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="totalIntegral" column="total_integral" />
|
<result property="totalIntegral" column="total_integral" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
<result property="level" column="level" />
|
<result property="level" column="level" />
|
||||||
|
<result property="isWork" column="is_work" />
|
||||||
<result property="commission" column="commission" />
|
<result property="commission" column="commission" />
|
||||||
<result property="totalComm" column="total_comm" />
|
<result property="totalComm" column="total_comm" />
|
||||||
<result property="margin" column="margin" />
|
<result property="margin" column="margin" />
|
||||||
|
|
@ -115,6 +116,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="totalIntegral != null">total_integral,</if>
|
<if test="totalIntegral != null">total_integral,</if>
|
||||||
<if test="status != null">status,</if>
|
<if test="status != null">status,</if>
|
||||||
<if test="level != null">level,</if>
|
<if test="level != null">level,</if>
|
||||||
|
<if test="isWork != null">is_work,</if>
|
||||||
|
|
||||||
<if test="commission != null">commission,</if>
|
<if test="commission != null">commission,</if>
|
||||||
<if test="totalComm != null">total_comm,</if>
|
<if test="totalComm != null">total_comm,</if>
|
||||||
<if test="margin != null">margin,</if>
|
<if test="margin != null">margin,</if>
|
||||||
|
|
@ -146,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="totalIntegral != null">#{totalIntegral},</if>
|
<if test="totalIntegral != null">#{totalIntegral},</if>
|
||||||
<if test="status != null">#{status},</if>
|
<if test="status != null">#{status},</if>
|
||||||
<if test="level != null">#{level},</if>
|
<if test="level != null">#{level},</if>
|
||||||
|
<if test="isWork != null">#{isWork},</if>
|
||||||
<if test="commission != null">#{commission},</if>
|
<if test="commission != null">#{commission},</if>
|
||||||
<if test="totalComm != null">#{totalComm},</if>
|
<if test="totalComm != null">#{totalComm},</if>
|
||||||
<if test="margin != null">#{margin},</if>
|
<if test="margin != null">#{margin},</if>
|
||||||
|
|
@ -181,6 +185,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="totalIntegral != null">total_integral = #{totalIntegral},</if>
|
<if test="totalIntegral != null">total_integral = #{totalIntegral},</if>
|
||||||
<if test="status != null">status = #{status},</if>
|
<if test="status != null">status = #{status},</if>
|
||||||
<if test="level != null">level = #{level},</if>
|
<if test="level != null">level = #{level},</if>
|
||||||
|
<if test="isWork != null">is_work = #{isWork},</if>
|
||||||
<if test="commission != null">commission = #{commission},</if>
|
<if test="commission != null">commission = #{commission},</if>
|
||||||
<if test="totalComm != null">total_comm = #{totalComm},</if>
|
<if test="totalComm != null">total_comm = #{totalComm},</if>
|
||||||
<if test="margin != null">margin = #{margin},</if>
|
<if test="margin != null">margin = #{margin},</if>
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@
|
||||||
"vue-cropper": "0.5.5",
|
"vue-cropper": "0.5.5",
|
||||||
"vue-meta": "2.4.0",
|
"vue-meta": "2.4.0",
|
||||||
"vue-router": "3.4.9",
|
"vue-router": "3.4.9",
|
||||||
|
"vue-sku-form": "^0.4.1",
|
||||||
"vuedraggable": "2.24.3",
|
"vuedraggable": "2.24.3",
|
||||||
"vuex": "3.6.0"
|
"vuex": "3.6.0"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,18 @@ export function getUsers(id) {
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 任务状态修改
|
||||||
|
export function changetypeStatus(id, status) {
|
||||||
|
const data = {
|
||||||
|
id,
|
||||||
|
status
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url: '/system/users/changeStatus',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
// 新增用户列表
|
// 新增用户列表
|
||||||
export function addUsers(data) {
|
export function addUsers(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import SkuForm from 'vue-sku-form'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
|
|
||||||
import Element from 'element-ui'
|
import Element from 'element-ui'
|
||||||
|
|
@ -40,6 +40,8 @@ import DictData from '@/components/DictData'
|
||||||
// 美化包装组件
|
// 美化包装组件
|
||||||
import BeautyWrapper from '@/components/BeautyWrapper'
|
import BeautyWrapper from '@/components/BeautyWrapper'
|
||||||
|
|
||||||
|
import sku from '@/components/Sku/sku'
|
||||||
|
|
||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
Vue.prototype.getDicts = getDicts
|
Vue.prototype.getDicts = getDicts
|
||||||
Vue.prototype.getConfigKey = getConfigKey
|
Vue.prototype.getConfigKey = getConfigKey
|
||||||
|
|
@ -60,10 +62,12 @@ Vue.component('FileUpload', FileUpload)
|
||||||
Vue.component('ImageUpload', ImageUpload)
|
Vue.component('ImageUpload', ImageUpload)
|
||||||
Vue.component('ImagePreview', ImagePreview)
|
Vue.component('ImagePreview', ImagePreview)
|
||||||
Vue.component('BeautyWrapper', BeautyWrapper)
|
Vue.component('BeautyWrapper', BeautyWrapper)
|
||||||
|
Vue.component('Sku', sku)
|
||||||
|
|
||||||
Vue.use(directive)
|
Vue.use(directive)
|
||||||
Vue.use(plugins)
|
Vue.use(plugins)
|
||||||
Vue.use(VueMeta)
|
Vue.use(VueMeta)
|
||||||
|
Vue.use(SkuForm)
|
||||||
DictData.install()
|
DictData.install()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -203,20 +203,23 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改服务内容对话框 -->
|
<!-- 添加或修改服务内容对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
<el-drawer :title="title" :visible.sync="open" size="60%" append-to-body >
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<div style="padding:0 30px;">
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-tabs v-model="activeTab">
|
||||||
|
<el-tab-pane label="基本信息" name="base">
|
||||||
<el-form-item label="标题" prop="title">
|
<el-form-item label="标题" prop="title">
|
||||||
<el-input v-model="form.title" placeholder="请输入标题" />
|
<el-input v-model="form.title" placeholder="请输入标题" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="副标题" prop="subTitle">
|
||||||
|
<el-input v-model="form.subTitle" placeholder="请输入副标题" />
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="图标" prop="icon">
|
<el-form-item label="图标" prop="icon">
|
||||||
<image-upload v-model="form.icon"/>
|
<image-upload v-model="form.icon"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="轮播图" prop="imgs">
|
<el-form-item label="轮播图" prop="imgs">
|
||||||
<image-upload v-model="form.imgs"/>
|
<image-upload v-model="form.imgs"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="副标题" prop="subTitle">
|
|
||||||
<el-input v-model="form.subTitle" placeholder="请输入副标题" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="简介" prop="info">
|
<el-form-item label="简介" prop="info">
|
||||||
<el-input v-model="form.info" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.info" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
@ -226,50 +229,10 @@
|
||||||
<el-form-item label="列表价格显示" prop="priceZn">
|
<el-form-item label="列表价格显示" prop="priceZn">
|
||||||
<el-input v-model="form.priceZn" placeholder="请输入列表价格显示" />
|
<el-input v-model="form.priceZn" placeholder="请输入列表价格显示" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="销量" prop="sales">
|
|
||||||
<el-input v-model="form.sales" placeholder="请输入销量" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="库存" prop="stock">
|
|
||||||
<el-input v-model="form.stock" placeholder="请输入库存" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="状态" prop="status">
|
|
||||||
<el-radio-group v-model="form.status">
|
|
||||||
<el-radio
|
|
||||||
v-for="dict in dict.type.service_goods_status"
|
|
||||||
:key="dict.value"
|
|
||||||
:label="dict.value"
|
|
||||||
>{{dict.label}}</el-radio>
|
|
||||||
</el-radio-group>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="详情" prop="description">
|
|
||||||
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="规格" prop="sku">
|
|
||||||
<el-input v-model="form.sku" type="textarea" placeholder="请输入内容" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="经度" prop="latitude">
|
|
||||||
<el-input v-model="form.latitude" placeholder="请输入经度" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="纬度" prop="longitude">
|
|
||||||
<el-input v-model="form.longitude" placeholder="请输入纬度" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="分类" prop="cateId">
|
<el-form-item label="分类" prop="cateId">
|
||||||
<el-input v-model="form.cateId" placeholder="请输入分类" />
|
<el-select v-model="form.cateId" placeholder="请选择分类">
|
||||||
</el-form-item>
|
<el-option v-for="cate in serviceCateList" :key="cate.id" :label="cate.title" :value="cate.id" />
|
||||||
<el-form-item label="服务项目" prop="project">
|
</el-select>
|
||||||
<el-input v-model="form.project" type="textarea" placeholder="请输入内容" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="排序" prop="sort">
|
|
||||||
<el-input v-model="form.sort" placeholder="请输入排序" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="物料费用" prop="material">
|
|
||||||
<el-input v-model="form.material" type="textarea" placeholder="请输入内容" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="邮费" prop="postage">
|
|
||||||
<el-input v-model="form.postage" placeholder="请输入邮费" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="基检现象" prop="basic">
|
|
||||||
<el-input v-model="form.basic" type="textarea" placeholder="请输入内容" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="保证金" prop="margin">
|
<el-form-item label="保证金" prop="margin">
|
||||||
<el-input v-model="form.margin" placeholder="请输入保证金" />
|
<el-input v-model="form.margin" placeholder="请输入保证金" />
|
||||||
|
|
@ -277,36 +240,82 @@
|
||||||
<el-form-item label="所需技能" prop="skillIds">
|
<el-form-item label="所需技能" prop="skillIds">
|
||||||
<el-input v-model="form.skillIds" type="textarea" placeholder="请输入内容" />
|
<el-input v-model="form.skillIds" type="textarea" placeholder="请输入内容" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="${comment}" prop="createdAt">
|
</el-tab-pane>
|
||||||
<el-date-picker clearable
|
<el-tab-pane label="营销配置" name="marketing">
|
||||||
v-model="form.createdAt"
|
<el-form-item label="销量" prop="sales" required>
|
||||||
type="date"
|
<el-input-number
|
||||||
value-format="yyyy-MM-dd"
|
v-model="form.sales"
|
||||||
placeholder="请选择${comment}">
|
:min="0"
|
||||||
</el-date-picker>
|
:step="1"
|
||||||
|
controls-position="both"
|
||||||
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="${comment}" prop="updatedAt">
|
<el-form-item label="排序" prop="sort" required>
|
||||||
<el-date-picker clearable
|
<el-input-number
|
||||||
v-model="form.updatedAt"
|
v-model="form.sort"
|
||||||
type="date"
|
:min="0"
|
||||||
value-format="yyyy-MM-dd"
|
:step="1"
|
||||||
placeholder="请选择${comment}">
|
controls-position="both"
|
||||||
</el-date-picker>
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="${comment}" prop="deletedAt">
|
<el-form-item label="库存" prop="stock">
|
||||||
<el-date-picker clearable
|
<el-input-number
|
||||||
v-model="form.deletedAt"
|
v-model="form.stock"
|
||||||
type="date"
|
:min="0"
|
||||||
value-format="yyyy-MM-dd"
|
:step="1"
|
||||||
placeholder="请选择${comment}">
|
controls-position="both"
|
||||||
</el-date-picker>
|
style="width: 200px"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-switch
|
||||||
|
v-model="form.status"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="规格配置" name="spec">
|
||||||
|
<el-form-item label="规格">
|
||||||
|
<el-radio-group v-model="skuType">
|
||||||
|
<el-radio-button label="single">单规格</el-radio-button>
|
||||||
|
<el-radio-button label="multi">多规格</el-radio-button>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<div v-if="skuType === 'single'">
|
||||||
|
<el-form-item label="规格名">
|
||||||
|
<el-input v-model="form.skuName" placeholder="请输入规格名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规格值">
|
||||||
|
<el-input v-model="form.skuValue" placeholder="请输入规格值" />
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<Sku :info="form.sku" ref="skuRef"></Sku>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
|
||||||
|
<el-tab-pane label="详情配置" name="detail">
|
||||||
|
<el-form-item label="详情" prop="description">
|
||||||
|
<editor v-model="form.description" :min-height="200" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="服务项目" prop="project">
|
||||||
|
<editor v-model="form.project" :min-height="200" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物料费用" prop="material">
|
||||||
|
<editor v-model="form.material" :min-height="200" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</div>
|
||||||
|
</el-drawer>
|
||||||
|
|
||||||
<el-dialog :visible.sync="audioDialogVisible" title="录音播放" width="400px">
|
<el-dialog :visible.sync="audioDialogVisible" title="录音播放" width="400px">
|
||||||
<audio v-if="currentAudioUrl" :src="currentAudioUrl" controls style="width:100%"></audio>
|
<audio v-if="currentAudioUrl" :src="currentAudioUrl" controls style="width:100%"></audio>
|
||||||
|
|
@ -330,10 +339,12 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listServiceGoods, getServiceGoods, delServiceGoods, addServiceGoods, updateServiceGoods ,changefenleiStatus,selectServiceCateList} from "@/api/system/ServiceGoods"
|
import { listServiceGoods, getServiceGoods, delServiceGoods, addServiceGoods, updateServiceGoods ,changefenleiStatus,selectServiceCateList} from "@/api/system/ServiceGoods"
|
||||||
|
import Editor from '@/components/Editor'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ServiceGoods",
|
name: "ServiceGoods",
|
||||||
dicts: ['service_goods_status'],
|
dicts: ['service_goods_status'],
|
||||||
|
components: { Editor },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
|
|
@ -402,6 +413,11 @@ export default {
|
||||||
editFieldLabel: '',
|
editFieldLabel: '',
|
||||||
editRow: null,
|
editRow: null,
|
||||||
daterangeCreatedAt: [],
|
daterangeCreatedAt: [],
|
||||||
|
activeTab: 'base',
|
||||||
|
skuType: 'single',
|
||||||
|
skuList: [ { name: '', value: '' } ],
|
||||||
|
specList: [ { name: '', values: [''] } ],
|
||||||
|
skuTable: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
|
@ -514,6 +530,18 @@ export default {
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
|
if( this.$refs.skuRef.submit()){
|
||||||
|
this.form.sku=this.$refs.skuRef.submit();
|
||||||
|
}else{
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if(this.$refs.skuRef.submit()){}
|
||||||
|
|
||||||
|
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
|
|
@ -582,6 +610,47 @@ export default {
|
||||||
this.$message.error('修改失败');
|
this.$message.error('修改失败');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
addSpec() {
|
||||||
|
this.specList.push({ name: '', values: [''] });
|
||||||
|
this.updateSkuTable();
|
||||||
|
},
|
||||||
|
removeSpec(idx) {
|
||||||
|
this.specList.splice(idx, 1);
|
||||||
|
this.updateSkuTable();
|
||||||
|
},
|
||||||
|
addSpecValue(specIdx) {
|
||||||
|
this.specList[specIdx].values.push('');
|
||||||
|
this.updateSkuTable();
|
||||||
|
},
|
||||||
|
removeSpecValue(specIdx, valIdx) {
|
||||||
|
this.specList[specIdx].values.splice(valIdx, 1);
|
||||||
|
this.updateSkuTable();
|
||||||
|
},
|
||||||
|
updateSkuTable() {
|
||||||
|
if (this.specList.length === 0) {
|
||||||
|
this.skuTable = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const valueArr = this.specList.map(spec => spec.values.filter(v => v));
|
||||||
|
if (valueArr.some(arr => arr.length === 0)) {
|
||||||
|
this.skuTable = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cartesian = (arr) => arr.reduce((a, b) => a.flatMap(d => b.map(e => [].concat(d, e))));
|
||||||
|
const combos = cartesian(valueArr);
|
||||||
|
this.skuTable = combos.map(combo => {
|
||||||
|
const row = {};
|
||||||
|
this.specList.forEach((spec, i) => row[spec.name] = combo[i]);
|
||||||
|
return Object.assign(row, { imageUrl: '', price: 0, stock: 0 });
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleImageSuccess(idx, file) {
|
||||||
|
// 这里只做本地预览,实际应上传到服务器后赋值url
|
||||||
|
this.$set(this.skuTable[idx], 'imageUrl', URL.createObjectURL(file.raw));
|
||||||
|
},
|
||||||
|
removeSkuImage(idx) {
|
||||||
|
this.$set(this.skuTable[idx], 'imageUrl', '');
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -185,10 +185,10 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="创建时间" prop="createdAt">
|
<el-form-item label="创建时间" prop="createdAt">
|
||||||
<el-date-picker clearable v-model="form.createdAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择创建时间"></el-date-picker>
|
<el-date-picker clearable v-model="form.createdAt" type="date" value-format="yyyy-MM-dd" placeholder="自动生成" :disabled="true"></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="更新时间" prop="updatedAt">
|
<el-form-item label="更新时间" prop="updatedAt">
|
||||||
<el-date-picker clearable v-model="form.updatedAt" type="date" value-format="yyyy-MM-dd" placeholder="请选择更新时间"></el-date-picker>
|
<el-date-picker clearable v-model="form.updatedAt" type="date" value-format="yyyy-MM-dd" placeholder="自动生成" :disabled="true"></el-date-picker>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue