完善订单功能

This commit is contained in:
huangdeliang 2020-09-26 22:28:17 +08:00
parent 58f276922f
commit 41fb244499
11 changed files with 462 additions and 297 deletions

View File

@ -1,6 +1,14 @@
package com.ruoyi.web.controller.custom; package com.ruoyi.web.controller.custom;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.custom.UserPostOption;
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysUserService;
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;
@ -28,31 +36,36 @@ import com.ruoyi.common.core.page.TableDataInfo;
*/ */
@RestController @RestController
@RequestMapping("/custom/order") @RequestMapping("/custom/order")
public class SysOrderController extends BaseController public class SysOrderController extends BaseController {
{
@Autowired @Autowired
private ISysOrderService sysOrderService; private ISysOrderService sysOrderService;
@Autowired
private ISysPostService postService;
@Autowired
private ISysUserService userService;
/** /**
* 查询销售订单列表 * 查询销售订单列表
*/ */
@PreAuthorize("@ss.hasPermi('custom:order:list')") @PreAuthorize("@ss.hasPermi('custom:order:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(SysOrder sysOrder) public TableDataInfo list(SysOrder sysOrder) {
{
startPage(); startPage();
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder); List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
return getDataTable(list); return getDataTable(list);
} }
/** /**
* 导出销售订单列表 * 导出销售订单列表
*/ */
@PreAuthorize("@ss.hasPermi('custom:order:export')") @PreAuthorize("@ss.hasPermi('custom:order:export')")
@Log(title = "销售订单", businessType = BusinessType.EXPORT) @Log(title = "销售订单", businessType = BusinessType.EXPORT)
@GetMapping("/export") @GetMapping("/export")
public AjaxResult export(SysOrder sysOrder) public AjaxResult export(SysOrder sysOrder) {
{
List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder); List<SysOrder> list = sysOrderService.selectSysOrderList(sysOrder);
ExcelUtil<SysOrder> util = new ExcelUtil<SysOrder>(SysOrder.class); ExcelUtil<SysOrder> util = new ExcelUtil<SysOrder>(SysOrder.class);
return util.exportExcel(list, "order"); return util.exportExcel(list, "order");
@ -63,8 +76,7 @@ public class SysOrderController extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('custom:order:query')") @PreAuthorize("@ss.hasPermi('custom:order:query')")
@GetMapping(value = "/{orderId}") @GetMapping(value = "/{orderId}")
public AjaxResult getInfo(@PathVariable("orderId") Long orderId) public AjaxResult getInfo(@PathVariable("orderId") Long orderId) {
{
return AjaxResult.success(sysOrderService.selectSysOrderById(orderId)); return AjaxResult.success(sysOrderService.selectSysOrderById(orderId));
} }
@ -74,8 +86,7 @@ public class SysOrderController extends BaseController
@PreAuthorize("@ss.hasPermi('custom:order:add')") @PreAuthorize("@ss.hasPermi('custom:order:add')")
@Log(title = "销售订单", businessType = BusinessType.INSERT) @Log(title = "销售订单", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody SysOrder sysOrder) public AjaxResult add(@RequestBody SysOrder sysOrder) {
{
return toAjax(sysOrderService.insertSysOrder(sysOrder)); return toAjax(sysOrderService.insertSysOrder(sysOrder));
} }
@ -85,8 +96,7 @@ public class SysOrderController extends BaseController
@PreAuthorize("@ss.hasPermi('custom:order:edit')") @PreAuthorize("@ss.hasPermi('custom:order:edit')")
@Log(title = "销售订单", businessType = BusinessType.UPDATE) @Log(title = "销售订单", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody SysOrder sysOrder) public AjaxResult edit(@RequestBody SysOrder sysOrder) {
{
return toAjax(sysOrderService.updateSysOrder(sysOrder)); return toAjax(sysOrderService.updateSysOrder(sysOrder));
} }
@ -96,8 +106,29 @@ public class SysOrderController extends BaseController
@PreAuthorize("@ss.hasPermi('custom:order:remove')") @PreAuthorize("@ss.hasPermi('custom:order:remove')")
@Log(title = "销售订单", businessType = BusinessType.DELETE) @Log(title = "销售订单", businessType = BusinessType.DELETE)
@DeleteMapping("/{orderIds}") @DeleteMapping("/{orderIds}")
public AjaxResult remove(@PathVariable Long[] orderIds) public AjaxResult remove(@PathVariable Long[] orderIds) {
{
return toAjax(sysOrderService.deleteSysOrderByIds(orderIds)); return toAjax(sysOrderService.deleteSysOrderByIds(orderIds));
} }
@GetMapping("/getOptions")
public AjaxResult getOptions() {
AjaxResult ajax = AjaxResult.success();
List<SysUserPost> userPosts = postService.selectUserPostAll();
List<UserPostOption> userPostOptions = new ArrayList<>();
for (SysUserPost userPost : userPosts) {
SysPost post = postService.selectPostById(userPost.getPostId());
SysUser user = userService.selectUserById(userPost.getUserId());
UserPostOption userPostOption = new UserPostOption();
userPostOption.setPostCode(post.getPostCode());
userPostOption.setUserId(userPost.getUserId());
userPostOption.setUserName(user.getNickName());
userPostOptions.add(userPostOption);
}
ajax.put(AjaxResult.DATA_TAG, userPostOptions);
return ajax;
}
} }

View File

@ -1,57 +1,60 @@
# 数据源配置 # 数据源配置
spring: spring:
datasource: datasource:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
druid: druid:
# 主库数据源 # 主库数据源
master: master:
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 # url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root # password: wonderdb
password: wonderdb
# 从库数据源 url: jdbc:mysql://47.97.194.44:3306/long_shop?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
slave: password: 9gPUnV$#2s/j(7_(
# 从数据源开关/默认关闭 username: root
enabled: false # 从库数据源
url: slave:
username: # 从数据源开关/默认关闭
password: enabled: false
# 初始连接数 url:
initialSize: 5 username:
# 最小连接池数量 password:
minIdle: 10 # 初始连接数
# 最大连接池数量 initialSize: 5
maxActive: 20 # 最小连接池数量
# 配置获取连接等待超时的时间 minIdle: 10
maxWait: 60000 # 最大连接池数量
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 maxActive: 20
timeBetweenEvictionRunsMillis: 60000 # 配置获取连接等待超时的时间
# 配置一个连接在池中最小生存的时间,单位是毫秒 maxWait: 60000
minEvictableIdleTimeMillis: 300000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
# 配置一个连接在池中最大生存的时间,单位是毫秒 timeBetweenEvictionRunsMillis: 60000
maxEvictableIdleTimeMillis: 900000 # 配置一个连接在池中最小生存的时间,单位是毫秒
# 配置检测连接是否有效 minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL # 配置一个连接在池中最大生存的时间,单位是毫秒
testWhileIdle: true maxEvictableIdleTimeMillis: 900000
testOnBorrow: false # 配置检测连接是否有效
testOnReturn: false validationQuery: SELECT 1 FROM DUAL
webStatFilter: testWhileIdle: true
enabled: true testOnBorrow: false
statViewServlet: testOnReturn: false
enabled: true webStatFilter:
# 设置白名单,不填则允许所有访问 enabled: true
allow: statViewServlet:
url-pattern: /druid/* enabled: true
# 控制台管理用户名和密码 # 设置白名单,不填则允许所有访问
login-username: allow:
login-password: url-pattern: /druid/*
filter: # 控制台管理用户名和密码
stat: login-username:
enabled: true login-password:
# 慢SQL记录 filter:
log-slow-sql: true stat:
slow-sql-millis: 1000 enabled: true
merge-sql: true # 慢SQL记录
wall: log-slow-sql: true
config: slow-sql-millis: 1000
multi-statement-allow: true merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -0,0 +1,43 @@
package com.ruoyi.system.domain.custom;
public class UserPostOption {
private Long userId;
private String userName;
private String postCode;
public String getPostCode() {
return postCode;
}
public Long getUserId() {
return userId;
}
public String getUserName() {
return userName;
}
public void setPostCode(String postCode) {
this.postCode = postCode;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public String toString() {
return "UserPostOption{" +
"userId=" + userId +
", userName='" + userName + '\'' +
", postCode='" + postCode + '\'' +
'}';
}
}

View File

@ -1,15 +1,16 @@
package com.ruoyi.system.mapper; package com.ruoyi.system.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
/** /**
* 岗位信息 数据层 * 岗位信息 数据层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface SysPostMapper public interface SysPostMapper {
{
/** /**
* 查询岗位数据集合 * 查询岗位数据集合
* *
@ -25,6 +26,8 @@ public interface SysPostMapper
*/ */
public List<SysPost> selectPostAll(); public List<SysPost> selectPostAll();
public List<SysUserPost> selectUserPostAll();
/** /**
* 通过岗位ID查询岗位信息 * 通过岗位ID查询岗位信息
* *

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.mapper; package com.ruoyi.system.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.SysUserPost; import com.ruoyi.system.domain.SysUserPost;
/** /**
@ -8,8 +9,8 @@ import com.ruoyi.system.domain.SysUserPost;
* *
* @author ruoyi * @author ruoyi
*/ */
public interface SysUserPostMapper public interface SysUserPostMapper {
{
/** /**
* 通过用户ID删除用户和岗位关联 * 通过用户ID删除用户和岗位关联
* *

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
/** /**
* 岗位信息 服务层 * 岗位信息 服务层
@ -18,6 +19,8 @@ public interface ISysPostService
*/ */
public List<SysPost> selectPostList(SysPost post); public List<SysPost> selectPostList(SysPost post);
public List<SysUserPost> selectUserPostAll();
/** /**
* 查询所有岗位 * 查询所有岗位
* *

View File

@ -1,6 +1,8 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.SysUserPost;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
@ -48,6 +50,11 @@ public class SysPostServiceImpl implements ISysPostService
return postMapper.selectPostAll(); return postMapper.selectPostAll();
} }
@Override
public List<SysUserPost> selectUserPostAll() {
return postMapper.selectUserPostAll();
}
/** /**
* 通过岗位ID查询岗位信息 * 通过岗位ID查询岗位信息
* *

View File

@ -1,52 +1,65 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysPostMapper"> <mapper namespace="com.ruoyi.system.mapper.SysPostMapper">
<resultMap type="SysPost" id="SysPostResult"> <resultMap type="SysPost" id="SysPostResult">
<id property="postId" column="post_id" /> <id property="postId" column="post_id"/>
<result property="postCode" column="post_code" /> <result property="postCode" column="post_code"/>
<result property="postName" column="post_name" /> <result property="postName" column="post_name"/>
<result property="postSort" column="post_sort" /> <result property="postSort" column="post_sort"/>
<result property="status" column="status" /> <result property="status" column="status"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<sql id="selectPostVo"> <resultMap id="SysUserPostResult" type="SysUserPost">
<id property="userId" column="user_id"/>
<result property="postId" column="post_id"/>
</resultMap>
<sql id="selectPostVo">
select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark select post_id, post_code, post_name, post_sort, status, create_by, create_time, remark
from sys_post from sys_post
</sql> </sql>
<select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult"> <sql id="selectUserPostVo">
<include refid="selectPostVo"/> select * from sys_user_post
<where> </sql>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostAll" resultMap="SysPostResult"> <select id="selectPostList" parameterType="SysPost" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
</select> <where>
<if test="postCode != null and postCode != ''">
AND post_code like concat('%', #{postCode}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="postName != null and postName != ''">
AND post_name like concat('%', #{postName}, '%')
</if>
</where>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult"> <select id="selectPostAll" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_id = #{postId} </select>
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Integer"> <select id="selectUserPostAll" resultMap="SysUserPostResult">
<include refid="selectUserPostVo"/>
</select>
<select id="selectPostById" parameterType="Long" resultMap="SysPostResult">
<include refid="selectPostVo"/>
where post_id = #{postId}
</select>
<select id="selectPostListByUserId" parameterType="Long" resultType="Integer">
select p.post_id select p.post_id
from sys_post p from sys_post p
left join sys_user_post up on up.post_id = p.post_id left join sys_user_post up on up.post_id = p.post_id
@ -54,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.user_id = #{userId} where u.user_id = #{userId}
</select> </select>
<select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult"> <select id="selectPostsByUserName" parameterType="String" resultMap="SysPostResult">
select p.post_id, p.post_name, p.post_code select p.post_id, p.post_name, p.post_code
from sys_post p from sys_post p
left join sys_user_post up on up.post_id = p.post_id left join sys_user_post up on up.post_id = p.post_id
@ -62,61 +75,61 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where u.user_name = #{userName} where u.user_name = #{userName}
</select> </select>
<select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult"> <select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_name=#{postName} limit 1 where post_name=#{postName} limit 1
</select> </select>
<select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult"> <select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
<include refid="selectPostVo"/> <include refid="selectPostVo"/>
where post_code=#{postCode} limit 1 where post_code=#{postCode} limit 1
</select> </select>
<update id="updatePost" parameterType="SysPost"> <update id="updatePost" parameterType="SysPost">
update sys_post update sys_post
<set> <set>
<if test="postCode != null and postCode != ''">post_code = #{postCode},</if> <if test="postCode != null and postCode != ''">post_code = #{postCode},</if>
<if test="postName != null and postName != ''">post_name = #{postName},</if> <if test="postName != null and postName != ''">post_name = #{postName},</if>
<if test="postSort != null and postSort != ''">post_sort = #{postSort},</if> <if test="postSort != null and postSort != ''">post_sort = #{postSort},</if>
<if test="status != null and status != ''">status = #{status},</if> <if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate() update_time = sysdate()
</set> </set>
where post_id = #{postId} where post_id = #{postId}
</update> </update>
<insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId"> <insert id="insertPost" parameterType="SysPost" useGeneratedKeys="true" keyProperty="postId">
insert into sys_post( insert into sys_post(
<if test="postId != null and postId != 0">post_id,</if> <if test="postId != null and postId != 0">post_id,</if>
<if test="postCode != null and postCode != ''">post_code,</if> <if test="postCode != null and postCode != ''">post_code,</if>
<if test="postName != null and postName != ''">post_name,</if> <if test="postName != null and postName != ''">post_name,</if>
<if test="postSort != null and postSort != ''">post_sort,</if> <if test="postSort != null and postSort != ''">post_sort,</if>
<if test="status != null and status != ''">status,</if> <if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if> <if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="postId != null and postId != 0">#{postId},</if> <if test="postId != null and postId != 0">#{postId},</if>
<if test="postCode != null and postCode != ''">#{postCode},</if> <if test="postCode != null and postCode != ''">#{postCode},</if>
<if test="postName != null and postName != ''">#{postName},</if> <if test="postName != null and postName != ''">#{postName},</if>
<if test="postSort != null and postSort != ''">#{postSort},</if> <if test="postSort != null and postSort != ''">#{postSort},</if>
<if test="status != null and status != ''">#{status},</if> <if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if> <if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
<delete id="deletePostById" parameterType="Long"> <delete id="deletePostById" parameterType="Long">
delete from sys_post where post_id = #{postId} delete from sys_post where post_id = #{postId}
</delete> </delete>
<delete id="deletePostByIds" parameterType="Long"> <delete id="deletePostByIds" parameterType="Long">
delete from sys_post where post_id in delete from sys_post where post_id in
<foreach collection="array" item="postId" open="(" separator="," close=")"> <foreach collection="array" item="postId" open="(" separator="," close=")">
#{postId} #{postId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -2,10 +2,18 @@ import request from '@/utils/request'
// 查询销售订单列表 // 查询销售订单列表
export function listOrder(query) { export function listOrder(query) {
const [fromOrderTime, toOrderTime] = query.orderTime || [null, null];
const params = {
...query,
fromOrderTime,
toOrderTime,
orderTime: null
}
return request({ return request({
url: '/custom/order/list', url: '/custom/order/list',
method: 'get', method: 'get',
params: query params: params
}) })
} }
@ -51,3 +59,10 @@ export function exportOrder(query) {
params: query params: query
}) })
} }
export function getOptions() {
return request({
url: '/custom/order/getOptions',
method: 'get'
})
}

View File

@ -20,7 +20,7 @@ export default {
props: { props: {
showSearch: { showSearch: {
type: Boolean, type: Boolean,
default: true, default: false,
}, },
}, },

View File

@ -14,17 +14,17 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="4">--> <!-- <el-col :span="4">-->
<!-- <el-form-item label="电话" prop="phone">--> <!-- <el-form-item label="电话" prop="phone">-->
<!-- <el-input--> <!-- <el-input-->
<!-- v-model="queryParams.phone"--> <!-- v-model="queryParams.phone"-->
<!-- placeholder="请输入电话"--> <!-- placeholder="请输入电话"-->
<!-- clearable--> <!-- clearable-->
<!-- size="small"--> <!-- size="small"-->
<!-- @keyup.enter.native="handleQuery"--> <!-- @keyup.enter.native="handleQuery"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-col>--> <!-- </el-col>-->
<el-col :span="4"> <el-col :span="4">
<el-form-item label="收款方式" prop="payTypeId"> <el-form-item label="收款方式" prop="payTypeId">
@ -141,14 +141,31 @@
<!-- @keyup.enter.native="handleQuery"--> <!-- @keyup.enter.native="handleQuery"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-col :span="4"> <el-col :span="8">
<el-form-item label="成交日期" prop="orderTime"> <el-form-item label="成交日期" prop="orderTime">
<el-date-picker clearable size="small" style="width: 200px"
v-model="queryParams.orderTime" <el-date-picker
type="date" v-model="queryParams.orderTime"
value-format="yyyy-MM-dd" type="daterange"
placeholder="选择成交日期"> size="small"
align="right"
unlink-panels
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
:picker-options="pickerOptions">
</el-date-picker> </el-date-picker>
<!-- <el-date-picker-->
<!-- clearable-->
<!-- size="small"-->
<!-- style="width: 200px"-->
<!-- v-model="queryParams.orderTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="选择成交日期">>-->
<!-- </el-date-picker>-->
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -432,7 +449,7 @@
</template> </template>
<script> <script>
import {listOrder, getOrder, delOrder, addOrder, updateOrder, exportOrder} from "@/api/custom/order"; import {listOrder, getOrder, delOrder, addOrder, updateOrder, exportOrder, getOptions} from "@/api/custom/order";
export default { export default {
name: "Order", name: "Order",
@ -447,7 +464,7 @@
// //
multiple: true, multiple: true,
// //
showSearch: true, showSearch: false,
// //
total: 0, total: 0,
// //
@ -504,39 +521,68 @@
], ],
orderTime: [ orderTime: [
{required: true, message: "成交日期不能为空", trigger: "blur"} {required: true, message: "成交日期不能为空", trigger: "blur"}
],
payTypeId: [
{required: true, message: "首款方式不能为空", trigger: "blur"}
],
accountId: [
{required: true, message: "账号不能为空", trigger: "blur"}
] ]
} },
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}]
},
}; };
}, },
created() { created() {
this.getList(); this.getList();
getOptions().then(response => {
console.log(response)
const options = response.data.reduce((opts, cur) => {
if (!opts[cur.postCode]) {
opts[cur.postCode] = [];
}
opts[cur.postCode].push({dictValue: cur.userId, dictLabel: cur.userName})
return opts;
}, {})
this.preSaleIdOptions = options['pre_sale'] || [];
this.afterSaleIdOptions = options['after_sale'] || [];
this.nutritionistIdOptions = options['nutri'] || [];
this.nutriAssisIdOptions = options['nutri_assis'] || [];
this.plannerIdOptions = options['planner'] || [];
this.plannerAssisIdOptions = options['planner_assis'] || [];
this.operatorIdOptions = options['operator'] || [];
})
this.getDicts("cus_pay_type").then(response => { this.getDicts("cus_pay_type").then(response => {
this.payTypeIdOptions = response.data; this.payTypeIdOptions = response.data;
}); });
this.getDicts("cus_pre_sale").then(response => {
this.preSaleIdOptions = response.data;
});
this.getDicts("cus_after_sale").then(response => {
this.afterSaleIdOptions = response.data;
});
this.getDicts("cus_nutri").then(response => {
this.nutritionistIdOptions = response.data;
});
this.getDicts("cus_nutri_assis").then(response => {
this.nutriAssisIdOptions = response.data;
});
this.getDicts("cus_planner").then(response => {
this.plannerIdOptions = response.data;
});
this.getDicts("cus_account").then(response => { this.getDicts("cus_account").then(response => {
this.accountIdOptions = response.data; this.accountIdOptions = response.data;
}); });
this.getDicts("cus_planner_assis").then(response => {
this.plannerAssisIdOptions = response.data;
});
this.getDicts("cus_operator").then(response => {
this.operatorIdOptions = response.data;
});
}, },
methods: { methods: {
/** 查询销售订单列表 */ /** 查询销售订单列表 */
@ -627,33 +673,33 @@
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
this.getDicts("cus_pay_type").then(response => { // this.getDicts("cus_pay_type").then(response => {
this.payTypeIdOptions = response.data; // this.payTypeIdOptions = response.data;
}); // });
this.getDicts("cus_pre_sale").then(response => { // this.getDicts("cus_pre_sale").then(response => {
this.preSaleIdOptions = response.data; // this.preSaleIdOptions = response.data;
}); // });
this.getDicts("cus_after_sale").then(response => { // this.getDicts("cus_after_sale").then(response => {
this.afterSaleIdOptions = response.data; // this.afterSaleIdOptions = response.data;
}); // });
this.getDicts("cus_nutri").then(response => { // this.getDicts("cus_nutri").then(response => {
this.nutritionistIdOptions = response.data; // this.nutritionistIdOptions = response.data;
}); // });
this.getDicts("cus_nutri_assis").then(response => { // this.getDicts("cus_nutri_assis").then(response => {
this.nutriAssisIdOptions = response.data; // this.nutriAssisIdOptions = response.data;
}); // });
this.getDicts("cus_planner").then(response => { // this.getDicts("cus_planner").then(response => {
this.plannerIdOptions = response.data; // this.plannerIdOptions = response.data;
}); // });
this.getDicts("cus_custom").then(response => { // this.getDicts("cus_account").then(response => {
this.accountIdOptions = response.data; // this.accountIdOptions = response.data;
}); // });
this.getDicts("cus_planner_assis").then(response => { // this.getDicts("cus_planner_assis").then(response => {
this.plannerAssisIdOptions = response.data; // this.plannerAssisIdOptions = response.data;
}); // });
this.getDicts("cus_operator").then(response => { // this.getDicts("cus_operator").then(response => {
this.operatorIdOptions = response.data; // this.operatorIdOptions = response.data;
}); // });
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
@ -687,7 +733,7 @@
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
console.log(this.form) // console.log(this.form)
this.form.payType = this.selectDictLabel(this.payTypeIdOptions, this.form.payTypeId); this.form.payType = this.selectDictLabel(this.payTypeIdOptions, this.form.payTypeId);
this.form.preSale = this.selectDictLabel(this.preSaleIdOptions, this.form.preSaleId); this.form.preSale = this.selectDictLabel(this.preSaleIdOptions, this.form.preSaleId);