Merge branches 'master' and 'xzj' of https://gitee.com/darlk/ShengTangManage into xzj

This commit is contained in:
xiezhijun 2021-03-11 18:43:55 +08:00
commit 41d8df3895
10 changed files with 196 additions and 47 deletions
stdiet-admin/src/main/java/com/stdiet/web/controller/custom
stdiet-custom/src/main
java/com/stdiet/custom/domain
resources/mapper/custom
stdiet-ui/src
api/custom
components/RecipesPlanDrawer
views/custom
customer
recipesBuild
PieChart.vue
RecipesView/RecipesHeaderCom
RecommendView/TemplateView

@ -1,19 +1,19 @@
package com.stdiet.web.controller.custom;
import java.util.List;
import com.stdiet.common.utils.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.stdiet.common.annotation.Log;
import com.stdiet.common.core.controller.BaseController;
import com.stdiet.common.core.domain.AjaxResult;
import com.stdiet.common.core.page.TableDataInfo;
import com.stdiet.common.enums.BusinessType;
import com.stdiet.common.utils.StringUtils;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.custom.domain.SysRecipesPlan;
import com.stdiet.custom.service.ISysRecipesPlanService;
import com.stdiet.common.utils.poi.ExcelUtil;
import com.stdiet.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 食谱计划Controller
@ -23,8 +23,7 @@ import com.stdiet.common.core.page.TableDataInfo;
*/
@RestController
@RequestMapping("/recipes/recipesPlan")
public class SysRecipesPlanController extends BaseController
{
public class SysRecipesPlanController extends BaseController {
@Autowired
private ISysRecipesPlanService sysRecipesPlanService;
@ -33,25 +32,29 @@ public class SysRecipesPlanController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('recipes:plan:list')")
@GetMapping("/list")
public TableDataInfo list(SysRecipesPlan sysRecipesPlan)
{
public TableDataInfo list(SysRecipesPlan sysRecipesPlan) {
startPage();
List<SysRecipesPlan> list = sysRecipesPlanService.selectPlanListByCondition(sysRecipesPlan);
for(SysRecipesPlan plan : list){
if(StringUtils.isNotEmpty(plan.getPhone())){
for (SysRecipesPlan plan : list) {
if (StringUtils.isNotEmpty(plan.getPhone())) {
plan.setHidePhone(StringUtils.hiddenPhoneNumber(plan.getPhone()));
}
}
return getDataTable(list);
}
@PreAuthorize("@ss.hasPermi('recipes:plan:add')")
@PostMapping("/add")
public AjaxResult add(@RequestBody SysRecipesPlan sysRecipesPlan) {
return toAjax(sysRecipesPlanService.insertSysRecipesPlan(sysRecipesPlan));
}
/**
* 根据订单查询完整食谱计划列表
*/
@PreAuthorize("@ss.hasPermi('recipes:plan:list')")
@GetMapping("/getAllPlanByOrderId")
public TableDataInfo getAllPlanByOrderId(SysRecipesPlan sysRecipesPlan)
{
public TableDataInfo getAllPlanByOrderId(SysRecipesPlan sysRecipesPlan) {
startPage();
List<SysRecipesPlan> list = sysRecipesPlanService.selectPlanListByOrderId(sysRecipesPlan);
return getDataTable(list);
@ -68,8 +71,7 @@ public class SysRecipesPlanController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('recipes:plan:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysRecipesPlanService.selectSysRecipesPlanById(id));
}
@ -79,8 +81,7 @@ public class SysRecipesPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('recipes:plan:edit')")
@Log(title = "食谱计划", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysRecipesPlan sysRecipesPlan)
{
public AjaxResult edit(@RequestBody SysRecipesPlan sysRecipesPlan) {
return toAjax(sysRecipesPlanService.updateSysRecipesPlan(sysRecipesPlan));
}
@ -90,11 +91,10 @@ public class SysRecipesPlanController extends BaseController
@PreAuthorize("@ss.hasPermi('recipes:plan:export')")
@Log(title = "食谱计划", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysRecipesPlan sysRecipesPlan)
{
public AjaxResult export(SysRecipesPlan sysRecipesPlan) {
List<SysRecipesPlan> list = sysRecipesPlanService.selectPlanListByCondition(sysRecipesPlan);
for(SysRecipesPlan plan : list){
if(StringUtils.isNotEmpty(plan.getPhone())){
for (SysRecipesPlan plan : list) {
if (StringUtils.isNotEmpty(plan.getPhone())) {
plan.setHidePhone(StringUtils.hiddenPhoneNumber(plan.getPhone()));
}
}

@ -39,6 +39,8 @@ public class SysCustomer extends BaseEntity
@Excel(name = "进粉日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date fansTime;
private Integer fansChannel;
/** 邮箱 */
@Excel(name = "邮箱")
private String email;

@ -13,6 +13,7 @@
<result property="payDate" column="pay_date" />
<result property="startDate" column="start_date" />
<result property="fansTime" column="fans_time" />
<result property="fansChannel" column="fans_channel" />
<result property="purchaseNum" column="purchase_num" />
<result property="payTotal" column="pay_total" />
<result property="mainDietitian" column="main_dietitian" />
@ -28,7 +29,7 @@
</resultMap>
<sql id="selectSysCustomerVo">
select id, name, phone, email, fans_time, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer
select id, name, phone, email, fans_time, fans_channel, address, pay_date, start_date, purchase_num, pay_total, main_dietitian, assistant_dietitian, after_dietitian, salesman, charge_person, follow_status, create_time, create_by, update_time, update_by from sys_customer
</sql>
<select id="selectSysCustomerList" parameterType="SysCustomer" resultMap="SysCustomerResult">
@ -50,6 +51,7 @@
<if test="name != null">name,</if>
<if test="phone != null">phone,</if>
<if test="fansTime != null">fans_time,</if>
<if test="fansChannel != null">fans_channel,</if>
<if test="email != null">email,</if>
<if test="address != null">address,</if>
<if test="payDate != null">pay_date,</if>
@ -71,6 +73,7 @@
<if test="name != null">#{name},</if>
<if test="phone != null">#{phone},</if>
<if test="fansTime != null">#{fansTime},</if>
<if test="fansChannel != null">#{fansChannel},</if>
<if test="email != null">#{email},</if>
<if test="address != null">#{address},</if>
<if test="payDate != null">#{payDate},</if>
@ -96,6 +99,7 @@
<if test="name != null">name = #{name},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="fansTime != null">fans_time = #{fansTime},</if>
<if test="fansChannel != null">fans_channel = #{fansChannel},</if>
<if test="email != null">email = #{email},</if>
<if test="address != null">address = #{address},</if>
<if test="payDate != null">pay_date = #{payDate},</if>

@ -73,7 +73,7 @@
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderId != null">order_id,</if>
<if test="cusId != null">cus_id,</if>
<if test="outId != null">out_id,</if>
<if test="cusId != null">out_id,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="startNumDay != null">start_num_day,</if>
@ -93,7 +93,7 @@
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
<if test="cusId != null">#{cusId},</if>
<if test="outId != null">#{outId},</if>
<if test="cusId != null">md5(#{cusId}),</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="startNumDay != null">#{startNumDay},</if>

@ -9,6 +9,14 @@ export function listRecipesPlan(query) {
});
}
export function addRecipesPlan(data) {
return request({
url: "/recipes/recipesPlan/add",
method: "post",
data
});
}
// 查询食谱计划详细
export function getRecipesPlan(id) {
return request({

@ -38,6 +38,14 @@
<el-button icon="el-icon-view" size="mini" @click="handleInnerOpen"
>查看暂停记录
</el-button>
<el-button
size="mini"
type="primary"
v-if="fansChannel === 1"
@click="createOneDay"
>
生成1天体验计划
</el-button>
</el-col>
</el-row>
@ -91,12 +99,45 @@
<!-- 暂停记录抽屉 -->
<PlanPauseDrawer ref="planPauseRef" />
<!-- 创建计划 -->
<el-dialog
title="创建1天体验计划"
:visible.sync="open"
width="480px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="100px"
v-loading="createLoading"
>
<el-form-item label="开始时间" prop="startDate">
<el-date-picker
v-model="form.startDate"
type="date"
placeholder="选择开始时间"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
:picker-options="fanPickerOptions"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleOnCreateConfirm"
> </el-button
>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</el-drawer>
</template>
<script>
import Clipboard from "clipboard";
import { listRecipesPlanByCusId } from "@/api/custom/recipesPlan";
import { addRecipesPlan } from "@/api/custom/recipesPlan";
import PlanPauseDrawer from "./PlanPauseDrawer";
import VueQr from "vue-qr";
const logo = require("@/assets/logo/logo_b.png");
@ -109,26 +150,45 @@ export default {
data() {
return {
logo,
open: false,
visible: false,
createLoading: false,
title: "",
cusOutId: "",
copyValue: "",
planLoading: false,
planList: [],
fansChannel: 0,
form: {},
rules: {
startDate: [
{ required: true, message: "开始时间不能为空", trigger: "blur" },
],
},
fanPickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now();
},
},
};
},
methods: {
showDrawer(data) {
// console.log(data);
console.log(data);
this.data = data;
if (!this.data) {
return;
}
this.fansChannel = data.fansChannel;
this.visible = true;
this.title = `${this.data.name}」食谱计划`;
this.getList();
},
getList() {
this.planLoading = true;
listRecipesPlanByCusId(data.id).then((response) => {
listRecipesPlanByCusId(this.data.id).then((response) => {
this.planList = response.data;
this.cusOutId = response.data.reduce((str, cur) => {
if (!str && cur.recipesId && cur.reviewStatus === 2) {
@ -144,6 +204,12 @@ export default {
this.planLoading = false;
});
},
reset() {
this.form = {
startDate: null,
};
this.resetForm("form");
},
handleOnClosed() {
this.data = undefined;
this.cusOutId = "";
@ -165,6 +231,35 @@ export default {
// const { id, name } = this.data;
window.open("/recipes/build/" + this.data.name + "/" + data.id, "_blank");
},
createOneDay() {
this.open = true;
},
handleOnCreateConfirm() {
const { id } = this.data;
this.createLoading = true;
addRecipesPlan({
cusId: id,
startNumDay: 1,
endNumDay: 1,
startDate: this.form.startDate,
endDate: this.form.startDate,
})
.then((res) => {
if (res.code === 200) {
this.$message.success("创建成功");
this.getList();
}
this.createLoading = false;
this.open = false;
})
.catch(() => {
this.createLoading = false;
});
},
cancel() {
this.open = false;
this.reset();
},
},
};
</script>

@ -111,18 +111,31 @@
label="创建时间"
align="center"
prop="createTime"
width="166"
/>
width="100"
>
<template slot-scope="scope">
<div v-for="time in scope.row.createTime.split(' ')" :key="time">
{{ time }}
</div>
</template>
</el-table-column>
<el-table-column
label="进粉时间"
align="center"
prop="fansTime"
width="120"
width="100"
>
<template slot-scope="scope">
<span>{{ parseTime(scope.row.fansTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column
label="进粉渠道"
align="center"
prop="fansChannel"
:formatter="fansChannelFormat"
>
</el-table-column>
<el-table-column label="客户姓名" align="center" prop="name" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column
@ -316,7 +329,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="24">
<el-form-item label="进粉时间" prop="fansTime">
<el-date-picker
v-model="form.fansTime"
@ -329,6 +342,18 @@
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="进粉渠道" prop="fansChannel">
<el-select v-model="form.fansChannel" placeholder="请选择">
<el-option
v-for="dict in fansChannelOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
/>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
<div slot="footer" class="dialog-footer">
@ -346,7 +371,7 @@
<!-- 外食热量统计 -->
<heatStatisticsDrawer ref="heatStatisticsRef"></heatStatisticsDrawer>
<!-- 食谱计划抽屉 -->
<RecipesPlanDrawer ref="recipesPlanDrawerRef"/>
<RecipesPlanDrawer ref="recipesPlanDrawerRef" />
</div>
</template>
@ -365,7 +390,7 @@ import OrderDrawer from "@/components/OrderDrawer";
import PhysicalSignsDialog from "@/components/PhysicalSignsDialog";
import ContractDrawer from "@/components/ContractDrawer";
import HeatStatisticsDrawer from "@/components/HeatStatisticsDrawer";
import RecipesPlanDrawer from '@/components/RecipesPlanDrawer'
import RecipesPlanDrawer from "@/components/RecipesPlanDrawer";
import { mapGetters } from "vuex";
export default {
@ -375,7 +400,7 @@ export default {
"physical-signs-dialog": PhysicalSignsDialog,
"contract-drawer": ContractDrawer,
heatStatisticsDrawer: HeatStatisticsDrawer,
RecipesPlanDrawer
RecipesPlanDrawer,
},
data() {
const userId = store.getters && store.getters.userId;
@ -395,6 +420,8 @@ export default {
total: 0,
//
customerCenterList: [],
//
fansChannelOptions: [],
//
title: "",
//
@ -450,6 +477,9 @@ export default {
};
},
created() {
this.getDicts("customer_fans_channel").then((response) => {
this.fansChannelOptions = response.data;
});
this.getList();
},
computed: {
@ -496,6 +526,9 @@ export default {
row.assistantDietitian
);
},
fansChannelFormat(row, column) {
return this.selectDictLabel(this.fansChannelOptions, row.fansChannel);
},
handleOnOrderClick(row) {
this.$refs["cusOrderDrawerRef"].showDrawer(row);
},
@ -510,7 +543,7 @@ export default {
},
handleOnMenuClick(row) {
// console.log(row);
this.$refs['recipesPlanDrawerRef'].showDrawer(row);
this.$refs["recipesPlanDrawerRef"].showDrawer(row);
},
handleClickHeatStatistics(row) {
this.$refs["heatStatisticsRef"].showDrawer(row);
@ -537,6 +570,8 @@ export default {
afterDietitian: null,
salesman: null,
chargePerson: null,
fansChannel: 0,
fansTime: null,
followStatus: 0,
createTime: null,
createBy: null,

@ -24,7 +24,10 @@
{{ totalHeat.toFixed(1) }}千卡
</div>
</div>
<div style="text-align: right; margin-top: 4px">
<div
style="text-align: right; margin-top: 4px"
v-if="recipesData.length > 1"
>
<el-button size="mini" type="text" @click="backToAll"
>查看全部</el-button
>
@ -39,7 +42,7 @@ require("@/utils/echarts/myShine");
import resize from "@/views/dashboard/mixins/resize";
import TextInfo from "@/components/TextInfo";
import { createNamespacedHelpers } from "vuex";
const { mapMutations } = createNamespacedHelpers("recipes");
const { mapMutations, mapState } = createNamespacedHelpers("recipes");
export default {
mixins: [resize],
@ -99,6 +102,7 @@ export default {
// console.log(mData);
return mData;
},
...mapState(["recipesData"]),
},
mounted() {
this.$nextTick(() => {

@ -2,10 +2,12 @@
<div class="recipes_header_com_wrapper">
<div class="header_btns" v-loading="loading">
<section>
<div>食谱制作</div>
<el-button
size="mini"
v-if="!!recipesId"
type="primary"
style="margin-left: 12px"
icon="el-icon-document-copy"
@click="handleOnTemplateClick"
>
@ -103,13 +105,11 @@ export default {
],
};
},
updated() {
},
updated() {},
computed: {
...mapState(["recipesId", "reviewStatus", "fontSize"]),
},
watch: {
},
watch: {},
methods: {
handleOnSizeChange(fontSize) {
this.updateFontSize({ fontSize });

@ -1,10 +1,10 @@
<template>
<div class="template_view_wrapper">
<div class="header">
<div style="fontWeight: bold">选择模板</div>
<el-button size="mini" @click="handleOnBackClick">返回</el-button>
</div>
<div class="content">
<h2>选择模板</h2>
<!-- 筛选 -->
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="模板名称" prop="name">
@ -116,7 +116,7 @@ export default {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
@ -162,12 +162,13 @@ export default {
.header {
height: 32px;
display: flex;
justify-content: flex-end;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.content {
height: calc(100% - 32px);
padding-top: 12px;
overflow: auto;
}
}
</style>