From f76c9c5beb39916771402de95f05be18f39a9db6 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 17 Dec 2020 14:34:33 +0800 Subject: [PATCH] finish vip_detail vipInfo fn --- zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java | 3 zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java | 2 zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml | 10 + zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml | 47 +++++ zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip_detail.html | 162 ++++++++++--------- zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java | 76 +++++++++ zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java | 9 + zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java | 35 ++++ zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 6 zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java | 17 ++ zq-erp/src/main/java/com/matrix/core/tools/DateUtil.java | 35 ++++ zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java | 14 + zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java | 60 +++++++ 13 files changed, 396 insertions(+), 80 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/core/tools/DateUtil.java b/zq-erp/src/main/java/com/matrix/core/tools/DateUtil.java index 419bddf..07a0984 100644 --- a/zq-erp/src/main/java/com/matrix/core/tools/DateUtil.java +++ b/zq-erp/src/main/java/com/matrix/core/tools/DateUtil.java @@ -726,4 +726,39 @@ return targetDate; } + + public static String getAgeForBirthDay(Date birthDay) { + Calendar cal = Calendar.getInstance(); + if (birthDay == null) { + return "-"; + } + // 出生日期晚于当前时间,无法计算 + if (cal.before(birthDay)) { + return "-"; + } + // 当前年份 + int yearNow = cal.get(Calendar.YEAR); + // 当前月份 + int monthNow = cal.get(Calendar.MONTH); + // 当前日期 + int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); + cal.setTime(birthDay); + int yearBirth = cal.get(Calendar.YEAR); + int monthBirth = cal.get(Calendar.MONTH); + int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH); + // 计算整岁数 + Integer age = yearNow - yearBirth; + if (monthNow <= monthBirth) { + if (monthNow == monthBirth) { + if (dayOfMonthNow < dayOfMonthBirth) { + // 当前日期在生日之前,年龄减一 + age--; + } + } else { + age--; + } + } + + return age.toString(); + } } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java new file mode 100644 index 0000000..a93ef26 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/SysVipLabelController.java @@ -0,0 +1,60 @@ +package com.matrix.system.hive.action; + +import com.matrix.core.pojo.AjaxResult; +import com.matrix.system.common.bean.SysUsers; +import com.matrix.system.hive.bean.SysVipLabel; +import com.matrix.system.hive.dao.SysVipLabelDao; +import com.matrix.system.hive.plugin.util.CollectionUtils; +import jodd.util.CollectionUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.Date; +import java.util.List; + +/** + * @author wzy + * @date 2020-12-17 + **/ +@Controller +@RequestMapping(value = "/admin/label") +public class SysVipLabelController extends BaseController{ + + @Autowired + private SysVipLabelDao sysVipLabelDao; + + @RequestMapping(value = "/add") + @ResponseBody + public AjaxResult add(SysVipLabel sysVipLabel) { + SysUsers sysUsers = getMe(); + + List<SysVipLabel> sysVipLabels = sysVipLabelDao.selectByModel(sysVipLabel); + if (CollectionUtils.isNotEmpty(sysVipLabels)) { + return AjaxResult.buildFailInstance("已存在该标签"); + } + + sysVipLabel.setCreateBy(sysUsers.getSuName()); + sysVipLabel.setCreateTime(new Date()); + + int i = sysVipLabelDao.insert(sysVipLabel); + if (i > 0) { + AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("添加成功"); + ajaxResult.putInMap("label", sysVipLabel); + return ajaxResult; + } + return AjaxResult.buildFailInstance("添加失败"); + } + + @RequestMapping(value = "/del") + @ResponseBody + public AjaxResult del(Long id) { + int i = sysVipLabelDao.deleteById(id); + if (i > 0) { + return AjaxResult.buildSuccessInstance("删除成功"); + } + return AjaxResult.buildFailInstance("删除失败"); + } +} diff --git a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java index fd508ef..69717d5 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/action/VipInfoController.java @@ -22,6 +22,7 @@ import com.matrix.system.hive.action.util.QueryUtil; import com.matrix.system.hive.bean.*; import com.matrix.system.hive.dao.MoneyCardUseDao; +import com.matrix.system.hive.dao.SysVipLabelDao; import com.matrix.system.hive.dao.VipAnswerDao; import com.matrix.core.tools.DateUtil; import com.matrix.system.hive.pojo.RegisterInfo; @@ -76,10 +77,15 @@ private MoneyCardUseDao moneyCardUseDao; @Autowired + private SysVipLabelDao sysVipLabelDao; + + @Autowired private SystemDictionaryService dataDictionaryService; @Autowired private CustomerDataDictionaryDao customerDataDictionaryDao; + @Resource + private SysOrderService sysOrderService; @RequestMapping(value = "/showVipLevel") @@ -124,6 +130,7 @@ List<SysVipInfo> vips = vipInfoService.findByVipNoOrTel(keyWord); if (vips.size() > 0) { // 在session存放当前查询的客户 + vips.get(0).setSysOrder(sysOrderService.findSysOrderTjByVipId(vips.get(0).getId())); vips.get(0).setLevelCard(cardUseService.findByVipId(vips.get(0).getId())); WebUtil.getSession().setAttribute(SystemConstance.CURRENT_CUSTOMER, vips.get(0)); // 满20后删除一个 @@ -140,6 +147,8 @@ if (isNoRepeat) { userList.add(vips.get(0)); } + vips.get(0).setLabels(sysVipLabelDao.selectByVipId(vips.get(0).getId())); + vips.get(0).setAge(DateUtil.getAgeForBirthDay(vips.get(0).getBirthday1())); vips.get(0).setBalance(moneyCardUseDao.selectVipCardTotalMoney(vips.get(0).getId())); AjaxResult result= new AjaxResult(AjaxResult.STATUS_SUCCESS, vips, 0); return result; diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java index bb4736d..6b46164 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysOrder.java @@ -1,5 +1,6 @@ package com.matrix.system.hive.bean; +import com.fasterxml.jackson.annotation.JsonFormat; import com.matrix.core.tools.DateUtil; import org.springframework.format.annotation.DateTimeFormat; @@ -36,6 +37,7 @@ /** * 收款 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GTM-8") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") private Date payTime; @@ -155,6 +157,18 @@ @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_MM) private Date endTimeVo; + /** + * 消费次数 + */ + private Integer times; + + public Integer getTimes() { + return times; + } + + public void setTimes(Integer times) { + this.times = times; + } public String getBeatuyId() { return beatuyId; diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java index 92105d9..d00c8b5 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipInfo.java @@ -1,5 +1,6 @@ package com.matrix.system.hive.bean; +import com.fasterxml.jackson.annotation.JsonFormat; import com.matrix.core.tools.DateUtil; import com.matrix.system.hive.plugin.util.ExcelAnnotation; import org.springframework.format.annotation.DateTimeFormat; @@ -91,8 +92,11 @@ /** * 生日 */ + @JsonFormat(pattern = DateUtil.DATE_FORMAT_MM, timezone = "GTM-8") @DateTimeFormat(pattern = DateUtil.DATE_FORMAT_DD) private Date birthday1; + + private String age; /** * 地址 @@ -139,6 +143,7 @@ /** * 注册时间 */ + @JsonFormat(pattern = DateUtil.DATE_FORMAT_MM, timezone = "GTM-8") private Date createTime; /** * 备注 @@ -203,6 +208,15 @@ private Date createDistributionTime; + private SysOrder sysOrder; + + public SysOrder getSysOrder() { + return sysOrder; + } + + public void setSysOrder(SysOrder sysOrder) { + this.sysOrder = sysOrder; + } public Integer getIsDeal() { return isDeal; @@ -349,6 +363,27 @@ */ List<VipAnswer> vipAnswers; + /** + * 会员标签 + */ + List<SysVipLabel> labels; + + public List<SysVipLabel> getLabels() { + return labels; + } + + public void setLabels(List<SysVipLabel> labels) { + this.labels = labels; + } + + public String getAge() { + return age; + } + + public void setAge(String age) { + this.age = age; + } + public Long getCompanyId() { return companyId; } diff --git a/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java new file mode 100644 index 0000000..fe57323 --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/bean/SysVipLabel.java @@ -0,0 +1,76 @@ +package com.matrix.system.hive.bean; + +import java.io.Serializable; +import java.util.Date; + +/** + * @author wzy + * @date 2020-12-17 + **/ +public class SysVipLabel implements Serializable { + /** + * 创建时间 + */ + private Date createTime; + + /** + * 创建人 + */ + private String createBy; + + /** + * 主键ID + */ + private Long id; + + /** + * 会员ID + */ + private Long vipId; + + /** + * 标签内容 + */ + private String label; + + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getVipId() { + return vipId; + } + + public void setVipId(Long vipId) { + this.vipId = vipId; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } +} diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java index 361420c..42475ae 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysOrderDao.java @@ -33,5 +33,6 @@ public int selectInPageCount(@Param("record") SysOrder sysOrder); public void updateOrderTime(@Param("orderTime") Date orderTime, @Param("id") Long id); - + + SysOrder selectVipOrderInfoTotal(@Param("vipId") Long vipId); } \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java new file mode 100644 index 0000000..cc99bcc --- /dev/null +++ b/zq-erp/src/main/java/com/matrix/system/hive/dao/SysVipLabelDao.java @@ -0,0 +1,17 @@ +package com.matrix.system.hive.dao; + +import com.matrix.system.hive.bean.SysVipLabel; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface SysVipLabelDao { + + int insert(SysVipLabel sysVipLabel); + + int deleteById(@Param("id") Long id); + + List<SysVipLabel> selectByVipId(@Param("vipId") Long vipId); + + List<SysVipLabel> selectByModel(@Param("record") SysVipLabel sysVipLabel); +} diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java b/zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java index f9aa2a2..a283ccf 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/SysOrderService.java @@ -126,4 +126,6 @@ * @return */ SysOrder checkAndSaveOrder(SysOrder sysOrder); + + SysOrder findSysOrderTjByVipId(Long vipId); } \ No newline at end of file diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java index 7acacec..23c1e7e 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java @@ -1200,6 +1200,8 @@ } - - + @Override + public SysOrder findSysOrderTjByVipId(Long vipId) { + return sysOrderDao.selectVipOrderInfoTotal(vipId); + } } diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml index 7569362..237c65c 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysOrderDao.xml @@ -465,4 +465,14 @@ </sql> + <select id="selectVipOrderInfoTotal" resultType="com.matrix.system.hive.bean.SysOrder"> + select + sum(ZK_TOTAL) zkTotal, + count(1) times, + MAX(pay_time) payTime, + GROUP_CONCAT(DISTINCT t2.shop_short_name) shopName + from sys_order t1 + left join sys_shop_info t2 on t1.SHOP_ID=t2.ID + where VIP_ID=#{vipId} and STATU='已付款'; + </select> </mapper> \ No newline at end of file diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml new file mode 100644 index 0000000..aa566df --- /dev/null +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysVipLabelDao.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + +<mapper namespace="com.matrix.system.hive.dao.SysVipLabelDao"> + <insert id="insert" parameterType="com.matrix.system.hive.bean.SysVipLabel" useGeneratedKeys="true" + keyProperty="id"> + insert sys_vip_label ( + create_time, + create_by, + id, + vip_id, + label + ) values ( + #{createTime}, + #{createBy}, + #{id}, + #{vipId}, + #{label} + ) + </insert> + + <delete id="deleteById"> + delete from sys_vip_label + where id=#{id} + </delete> + + + <select id="selectByVipId" resultType="com.matrix.system.hive.bean.SysVipLabel"> + select * + from sys_vip_label + where vip_id=#{vipId} + </select> + + <select id="selectByModel" resultType="com.matrix.system.hive.bean.SysVipLabel"> + select * from sys_vip_label + where 1=1 + <if test="record!=null"> + <if test="record.label!=null and record.label!=''"> + and label=#{record.label} + </if> + <if test="record.vipId!=null"> + and vip_id=#{record.vipId} + </if> + </if> + </select> +</mapper> \ No newline at end of file diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip_detail.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip_detail.html index 07b43f8..ff9bdd1 100644 --- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip_detail.html +++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/vip_detail.html @@ -92,16 +92,16 @@ </style> </head> -<body onkeypress="dosearch(event)"> +<body> <div class="ibox-content container-fluid" id="app"> <el-container> <el-header style="background-color: white; margin: 15px; line-height: 60px"> <el-col :span="7"> <el-col :span="19"> - <el-input placeholder="请输入内容"></el-input> + <el-input v-model="searchValue" placeholder="输入会员姓名/手机号码/编号" @keyup.enter.native="searchVipInfo"></el-input> </el-col> <el-col :span="1"> - <el-button type="primary">查询</el-button> + <el-button type="primary" @click="searchVipInfo">查询</el-button> </el-col> </el-col> <el-col :span="9" style="float: right; margin-right: 20px;"> @@ -123,30 +123,30 @@ </el-row> <el-row type="flex" justify="center"> <el-col :span="4" style="text-align: center;"><span style="font-weight: bolder">{{vipInfo.vipName}}</span></el-col> - <el-col :span="4" style="text-align: center;">{{vipInfo.vipType}}</el-col> + <el-col :span="5" style="text-align: center;">{{vipInfo.vipType}}</el-col> </el-row> <el-row type="flex" justify="center"> - <span class="col-style">24岁</span> - <span class="col-style">{{vipInfo.addr}}</span> + <span class="col-style"><span v-if="vipInfo.age != null && vipInfo.age != ''">{{vipInfo.age}}</span><span v-else>-</span></span> + <span class="col-style"><span v-if="vipInfo.addr != null && vipInfo.addr != ''">{{vipInfo.addr}}</span><span v-else>-</span></span> <span class="col-style">{{vipInfo.phone}}</span> </el-row> <el-row style="padding: 10px 20px;"> - <p>余额:<span v-if="vipInfo.bal != null">{{vipInfo.bal}}元</span></p> + <p>余额:<span v-if="vipInfo.balance != null">{{vipInfo.balance}}元</span></p> <p>积分:<span v-if="vipInfo.pointAll != null">{{vipInfo.pointAll}}</span></p> - <p>累计消费金额:10元</p> - <p>累计消费次数:1次</p> - <p>上次消费时间:2020-12-12 19:19:19</p> + <p>累计消费金额:<span v-if="vipInfo.totalMoney != null">{{vipInfo.totalMoney}} 元</span></p> + <p>累计消费次数:<span v-if="vipInfo.totalTimes != null">{{vipInfo.totalTimes}} 次</span></p> + <p>上次消费时间:<span v-if="vipInfo.payTime">{{vipInfo.payTime}}</span></p> </el-row> <el-row style="border-top: 2px dashed #E4E7ED; border-bottom: 2px dashed #E4E7ED; padding: 10px 0px;"> <h4>标签</h4> <el-tag type="info" size="small" - :key="tag" + :key="tag.label" v-for="tag in tags.tags" closable :disable-transitions="false" @close="handleClose(tag)"> - {{tag}} + {{tag.label}} </el-tag> <el-input class="input-new-tag" @@ -162,17 +162,9 @@ <el-row style="padding: 10px 0;"> <h4>消费门店</h4> <el-row style="text-align: center"> - <el-col :span="10"> + <el-col :span="10" v-for="item in vipInfo.shopNames"> <el-avatar size="small" :src="circleUrl"></el-avatar> - <span class="col-style">龙华店</span> - </el-col> - <el-col :span="10"> - <el-avatar size="small" :src="circleUrl"></el-avatar> - <span class="col-style">星海店</span> - </el-col> - <el-col :span="10"> - <el-avatar size="small" :src="circleUrl"></el-avatar> - <span class="col-style">测试店</span> + <span class="col-style">{{item}}</span> </el-col> </el-row> </el-row> @@ -183,17 +175,17 @@ <el-tab-pane label="会员信息" name="vipInfo"> <el-row> <el-col :span="10"> - <p>生日 : {{vipInfo.birthday1}}}</p> + <p>生日 : {{vipInfo.birthday1}}</p> <p>会员状态 : {{vipInfo.vipState}}</p> <p>会员编号 : {{vipInfo.vipNo}}</p> <p>注册时间 : {{vipInfo.createTime}}</p> - <p>到店途径 : {{vipInfo.arrivalWay}}}</p> + <p>到店途径 : {{vipInfo.arrivalWay}}</p> </el-col> <el-col :span="10"> <p>会员卡类型 : {{vipInfo.vipType}}</p> <p>会员等级 : {{vipInfo.levelName}}</p> <p>生肖/星座 : {{vipInfo.constell}}</p> - <p>地址 : {{vipInfo.addr}}}</p> + <p>地址 : {{vipInfo.addr}}</p> <p>健康顾问 : {{vipInfo.staffName}}</p> </el-col> </el-row> @@ -597,11 +589,6 @@ <script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script> <script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script> <script th:inline="javascript"> - //初始带入vip的电话 - var key = $.query.get("vipPhone"); - if(key){ - selectList(key); - } var app = new Vue({ el: '#app', data : { @@ -612,7 +599,9 @@ inputVisible: false, inputValue: '' }, + searchValue : "", vipInfo : {}, + // 项目/套餐 tab projTab : { projType : "proj", projOptions : [{ value : '有效', label : "有效" }, { value : '失效', label : "失效" }], @@ -625,6 +614,7 @@ currentPage : 1 } }, + // 服务单tab serviceOrderTab : { tableData : [], selectTime : '', @@ -636,6 +626,7 @@ currentPage : 1, }, }, + // 订单 tab orderTab : { orderTableData : [], selectTime : '', @@ -645,6 +636,7 @@ currentPage : 1, }, }, + // 皮肤检测tab skinTab : { skinTableDate : [], selectTime : '', @@ -658,26 +650,82 @@ let _this = this; if (key) { - vipInfo(key); + _this.vipInfoFn(key); } }, methods : { - vipInfo(key) { + vipInfoFn(key) { + let _this = this; // 请求用户信息 $.AjaxProxy({ p: { keyWord: key } - }).invoke(basePath + "/admin/vipInfo/showVipInfo", function (loj) {}); + }).invoke(basePath + "/admin/vipInfo/showVipInfo", function (loj) { + if (loj.getRowCount() == 0) { + layer.msg('未查询到客户信息', { + icon: 5 + }); + return false; + } + console.log(loj); + let data = loj[0].result.rows[0]; + _this.vipInfo = {}; + _this.vipInfo = data; + + if (data.sysOrder != null) { + _this.vipInfo.totalMoney = data.sysOrder.zkTotal; + _this.vipInfo.totalTimes = data.sysOrder.times; + _this.vipInfo.payTime = data.sysOrder.payTime; + + if (data.sysOrder.shopName) { + var shopNames = data.sysOrder.shopName.split(','); + _this.vipInfo.shopNames = shopNames; + } + } + + _this.tags.tags = data.labels; + }); }, - radioChange() { - console.log(this.projTab.projType); + addLabelFn(key) { + let _this = this; + // 请求用户信息 + $.AjaxProxy({ + p: { + vipId: _this.vipInfo.id, + label : key + } + }).invoke(basePath + "/admin/label/add", function (loj) { + let label = loj.getResult().mapInfo.label; + _this.tags.tags.push(label); + }); }, + delLabelFn(id) { + $.AjaxProxy({ + p: { + id: id + } + }).invoke(basePath + "/admin/label/del", function (loj) { + }); + }, + searchVipInfo() { + let _this = this; + let inputVisible = _this.tags.inputVisible; + console.log(inputVisible) + if (!inputVisible) { + if (_this.searchValue) { + _this.vipInfoFn(_this.searchValue); + } + } + + }, + radioChange() {}, tabHandleClick() { }, handleClose(tag) { this.tags.tags.splice(this.tags.tags.indexOf(tag), 1); + this.delLabelFn(tag.id); }, showInput() { this.tags.inputVisible = true; @@ -688,7 +736,7 @@ handleInputConfirm() { let inputValue = this.tags.inputValue; if (inputValue) { - this.tags.tags.push(inputValue); + this.addLabelFn(inputValue); } this.tags.inputVisible = false; this.tags.inputValue = ''; @@ -703,47 +751,7 @@ console.log(`当前页: ${val}`); } } - }) - $(function () { - $("#key").keyup( - function () { - var $input = $("#key"); - if ($input.val().length > 1) { - $.AjaxProxy({ - p: { - keyWord: $input.val(), - }, - c: false, - }) - .invoke( - basePath + "/admin/vipInfo/findUserByPhotoOrName", - function (loj) { - var html = ""; - for (var i = 0; i < loj - .getRowCount(); i++) { - html += '<li onclick="selectList(\'' + loj.getString(i, 'phone') + '\')" >' - + loj.getString(i, 'phone') + "-" + loj.getString(i, 'vipName') - + "-" + loj.getString(i, 'vipNo') - + '</li>'; - } - $("#userList").html(html).show(); - }); - } else { - $("#userList").hide(); - } - }); - updateHistory(); - $("#userList").mouseleave(function () { - $(this).hide(); - }) - }) - - - function selectList(phone) { - $("#userList").hide(); - $("#key").val(phone); - selectByKey(); - } + }); </script> </body> </html> \ No newline at end of file -- Gitblit v1.9.1