Commit c58dbf9f by 郑云飞

后管团购订单功能完成

parent 697f0488
......@@ -4,6 +4,8 @@ import com.yunniu.farming.common.plugin.PageInfo;
import com.yunniu.farming.result.Result;
import com.yunniu.farming.webadmin.model.GroupBuy;
import com.yunniu.farming.webadmin.model.GroupOrder;
import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.model.OrderSub;
import com.yunniu.farming.webadmin.service.GroupOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
......@@ -33,6 +35,12 @@ public class GroupOrderController {
return "groupOrder/list";
}
@RequestMapping("/detailList")
public String detailList(Model model, Long id) {
model.addAttribute("orderId", id);
return "groupOrder/detailList";
}
@RequestMapping(value = "/orderDetail")
public String addOrEdit(Model model, Long id) {
model.addAttribute("id", id);
......@@ -92,4 +100,108 @@ public class GroupOrderController {
rmap.put("items", list);
return Result.success(rmap);
}
/**
* 团购订单用户列表
* @param item 团购订单id
* @return
*/
@RequestMapping(value = "/userList",method = RequestMethod.POST)
@ResponseBody
public Result userList(@RequestBody OrderMain item){
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>(2);
//传入当前页数,适配PC端Layui分页
if (item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if (item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if (item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if (pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
} else {
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
List<OrderMain> list = groupOrderService.userList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if (totalRs % pinfo.getPageSize() == 0) { //总页数计算
totalPs = totalRs / pinfo.getPageSize();
} else {
totalPs = 1 + totalRs / pinfo.getPageSize();
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", list);
return Result.success(rmap);
}
/**
* 购买商品列表
* @param item 用户列表id
* @return
*/
@RequestMapping(value = "/productList",method = RequestMethod.POST)
@ResponseBody
public Result productList(@RequestBody OrderSub item){
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>(2);
//传入当前页数,适配PC端Layui分页
if (item.getCurpage() != null || item.getPagesize() != null) {
PageInfo pinfo = new PageInfo();
if (item.getCurpage() != null) {
pinfo.setCurPage(item.getCurpage());
}
if (item.getPagesize() != null) {
pinfo.setPageSize(item.getPagesize());
}
item.setPageinfo(pinfo);
}
// 1.查询前 需要对分页对象 做处理,主要是 分页 开始记录数 limit arg0开始记录,arg1每页几条记录
PageInfo pinfo = item.getPageinfo();
if (pinfo == null) {
pinfo = new PageInfo();
item.setPageinfo(pinfo);
} else {
// 分页开始记录数
int curRecord = (pinfo.getCurPage() - 1) * pinfo.getPageSize();
pinfo.setCurRecord(curRecord);
item.setPageinfo(pinfo);
}
List<OrderSub> list = groupOrderService.productList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
int totalPs = 0; //总页数
if (totalRs % pinfo.getPageSize() == 0) { //总页数计算
totalPs = totalRs / pinfo.getPageSize();
} else {
totalPs = 1 + totalRs / pinfo.getPageSize();
}
pinfo.setTotalPages(totalPs);
// 4.将分页对象、结果集合 封装后返回前台
rmap.put("pageinfo", pinfo);
rmap.put("items", list);
return Result.success(rmap);
}
}
......@@ -135,7 +135,7 @@ public class OrderMainController {
item.setPageinfo(pinfo);
}
// 2.1 执行主表 查询
List<OrderMain> items=this.subService.selectSubByParamPageList(item);
List<OrderSub> items=this.subService.selectSubByParamPageList(item);
// 3.将查询结果的 分页数据封装后返回
int totalRs = pinfo.getTotalRecords(); //总记录数
......
......@@ -17,5 +17,5 @@ public interface OrderMainDao extends BaseMapper<OrderMain> {
Double countOrderMoney(OrderMain orderMain);
List<OrderMain> getPageListByGroupOrderId(OrderMain item);
}
......@@ -17,7 +17,8 @@ public interface OrderSubDao extends BaseMapper<OrderSub> {
int insertBatch(List<OrderSub> sub);
List<OrderMain> selectByPageList(OrderSub sub);
List<OrderSub> selectByPageList(OrderSub sub);
List<OrderSub> getPageListByOrderMianId(OrderSub item);
}
\ No newline at end of file
......@@ -131,4 +131,7 @@ public class OrderMain {
@TableField(exist = false)
private Integer appflag;
@TableField(exist = false)
private String swxnick;
}
package com.yunniu.farming.webadmin.service;
import com.yunniu.farming.webadmin.model.GroupBuy;
import com.yunniu.farming.webadmin.model.GroupOrder;
import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.model.OrderSub;
import java.util.List;
......@@ -18,4 +18,12 @@ public interface GroupOrderService {
List<GroupOrder> findPageList(GroupOrder item);
GroupOrder findById(Long id);
List<OrderMain> userList(OrderMain item);
/**
* 购买商品列表
* @param item 用户列表id
* @return
*/
List<OrderSub> productList(OrderSub item);
}
......@@ -4,16 +4,13 @@ import com.alibaba.fastjson.JSON;
import com.aliyun.oss.ServiceException;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.mysql.cj.xdevapi.Warning;
import com.yunniu.farming.util.StringHelper;
import com.yunniu.farming.webadmin.dao.GroupAreaDao;
import com.yunniu.farming.webadmin.dao.GroupBuyDao;
import com.yunniu.farming.webadmin.dao.GroupOrderDao;
import com.yunniu.farming.webadmin.dao.*;
import com.yunniu.farming.webadmin.model.GroupBuy;
import com.yunniu.farming.webadmin.model.GroupOrder;
import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.model.OrderSub;
import com.yunniu.farming.webadmin.service.GroupOrderService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -36,7 +33,9 @@ public class GroupOrderServiceImpl implements GroupOrderService {
@Autowired
private GroupBuyDao groupBuyDao;
@Autowired
private GroupAreaDao groupAreaDao;
private OrderMainDao orderMainDao;
@Autowired
private OrderSubDao orderSubDao;
/**
* 保存团购订单
......@@ -97,9 +96,35 @@ public class GroupOrderServiceImpl implements GroupOrderService {
return orderDao.findPageList(item);
}
/**
* 团购订单详情
* @param id
* @return
*/
@Override
public GroupOrder findById(Long id) {
GroupOrder order = orderDao.detailById(id);
return order;
}
/**
* 团购订单用户信息列表
* @param item
* @return
*/
@Override
public List<OrderMain> userList(OrderMain item) {
List<OrderMain> list = orderMainDao.getPageListByGroupOrderId(item);
return list;
}
/**
* 购买商品列表
* @param item 用户列表id
* @return
*/
@Override
public List<OrderSub> productList(OrderSub item) {
return orderSubDao.getPageListByOrderMianId(item);
}
}
......@@ -73,7 +73,7 @@ public class OrderSubServiceImpl {
* 分页查询所有数据
* @return
*/
public List<OrderMain> selectSubByParamPageList(OrderSub sub) {
public List<OrderSub> selectSubByParamPageList(OrderSub sub) {
return this.orderSubDao.selectByPageList(sub);
......
......@@ -2,23 +2,23 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yunniu.farming.webadmin.dao.GroupOrderDao">
<select id="findPageList" resultType="com.yunniu.farming.webadmin.model.GroupOrder">
select
go.*,
select go.*,
gb.group_buy_title as groupBuyTitle,
ga.area_name as areaName,
sum(om.dactmoney) as sumDactmoney
sum(om.dactmoney) as sumDactmoney,
count(om.id) as groupSize
from group_order go
left join group_buy gb on go.group_buy_id = gb.id
left join group_area ga on go.area_id = ga.id
left join order_main om on go.id = om.group_order_id
left join order_main om on go.id = om.group_order_id and om.ipaystatus = 1
<where>
<if test="orderCode != null and orderCode != ''">
and go.order_code like concat('%', #{orderCode,jdbcType=VARCHAR},'%')
and go.order_code like concat('%', #{orderCode,jdbcType=VARCHAR}, '%')
</if>
<if test="groupBuyTitle != null and groupBuyTitle != ''">
and gb.group_buy_title like concat('%', #{groupBuyTitle,jdbcType=VARCHAR},'%')
and gb.group_buy_title like concat('%', #{groupBuyTitle,jdbcType=VARCHAR}, '%')
</if>
<if test="groupStatus != null">
<if test="groupStatus != null and groupStatus != ''">
and go.group_status = #{groupStatus,jdbcType=INTEGER}
</if>
</where>
......@@ -27,16 +27,21 @@
</select>
<select id="detailById" resultType="com.yunniu.farming.webadmin.model.GroupOrder">
select
go.*,
(case go.group_status when 0 then '待成团' when 1 then '待发货' when 2 then '已发货' when 3 then '已完成' else '已取消' end) as groupStatus,
select go.*,
(case go.group_status
when 0 then '待成团'
when 1 then '待发货'
when 2 then '已发货'
when 3 then '已完成'
when 4 then '已取消' end) as groupStatus,
gb.group_buy_title as groupBuyTitle,
ga.area_name as areaName,
sum(om.dactmoney) as sumDactmoney
sum(om.dactmoney) as sumDactmoney,
count(om.id) as groupSize
from group_order go
left join group_buy gb on go.group_buy_id = gb.id
left join group_area ga on go.area_id = ga.id
left join order_main om on go.id = om.group_order_id
left join order_main om on go.id = om.group_order_id and om.ipaystatus = 1
where go.id = #{id,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
......@@ -2,43 +2,43 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yunniu.farming.webadmin.dao.OrderMainDao">
<resultMap id="BaseResultMap" type="com.yunniu.farming.webadmin.model.OrderMain">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="customerid" property="customerid" jdbcType="INTEGER" />
<result column="addressid" property="addressid" jdbcType="INTEGER" />
<result column="sorderno" property="sorderno" jdbcType="VARCHAR" />
<result column="scusaddr" property="scusaddr" jdbcType="VARCHAR" />
<result column="scuname" property="scuname" jdbcType="VARCHAR" />
<result column="scuphone" property="scuphone" jdbcType="VARCHAR" />
<result column="sprovince" property="sprovince" jdbcType="VARCHAR" />
<result column="scity" property="scity" jdbcType="VARCHAR" />
<result column="sregion" property="sregion" jdbcType="VARCHAR" />
<result column="sorderdate" property="sorderdate" jdbcType="CHAR" />
<result column="tordertime" property="tordertime" jdbcType="TIMESTAMP" />
<result column="tovertime" property="tovertime" jdbcType="TIMESTAMP" />
<result column="dplanmoney" property="dplanmoney" jdbcType="DECIMAL" />
<result column="dactmoney" property="dactmoney" jdbcType="DECIMAL" />
<result column="dactscore" property="dactscore" jdbcType="DECIMAL" />
<result column="ipaystatus" property="ipaystatus" jdbcType="INTEGER" />
<result column="irefundstatus" property="irefundstatus" jdbcType="INTEGER" />
<result column="tpaytime" property="tpaytime" jdbcType="TIMESTAMP" />
<result column="trefundtime" property="trefundtime" jdbcType="TIMESTAMP" />
<result column="istatus" property="istatus" jdbcType="INTEGER" />
<result column="itype" property="itype" jdbcType="INTEGER" />
<result column="srefundreason" property="srefundreason" jdbcType="VARCHAR" />
<result column="productid" property="productid" jdbcType="INTEGER" />
<result column="ipaytype" property="ipaytype" jdbcType="INTEGER" />
<result column="sremark" property="sremark" jdbcType="VARCHAR" />
<result column="sdef1" property="sdef1" jdbcType="VARCHAR" />
<result column="sdef2" property="sdef2" jdbcType="VARCHAR" />
<result column="sdef3" property="sdef3" jdbcType="VARCHAR" />
<result column="sdef4" property="sdef4" jdbcType="VARCHAR" />
<result column="sdef5" property="sdef5" jdbcType="VARCHAR" />
<result column="idef6" property="idef6" jdbcType="INTEGER" />
<result column="idef7" property="idef7" jdbcType="INTEGER" />
<result column="ddef8" property="ddef8" jdbcType="DECIMAL" />
<result column="ddef9" property="ddef9" jdbcType="DECIMAL" />
<result column="ddef10" property="ddef10" jdbcType="TIMESTAMP" />
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="customerid" property="customerid" jdbcType="INTEGER"/>
<result column="addressid" property="addressid" jdbcType="INTEGER"/>
<result column="sorderno" property="sorderno" jdbcType="VARCHAR"/>
<result column="scusaddr" property="scusaddr" jdbcType="VARCHAR"/>
<result column="scuname" property="scuname" jdbcType="VARCHAR"/>
<result column="scuphone" property="scuphone" jdbcType="VARCHAR"/>
<result column="sprovince" property="sprovince" jdbcType="VARCHAR"/>
<result column="scity" property="scity" jdbcType="VARCHAR"/>
<result column="sregion" property="sregion" jdbcType="VARCHAR"/>
<result column="sorderdate" property="sorderdate" jdbcType="CHAR"/>
<result column="tordertime" property="tordertime" jdbcType="TIMESTAMP"/>
<result column="tovertime" property="tovertime" jdbcType="TIMESTAMP"/>
<result column="dplanmoney" property="dplanmoney" jdbcType="DECIMAL"/>
<result column="dactmoney" property="dactmoney" jdbcType="DECIMAL"/>
<result column="dactscore" property="dactscore" jdbcType="DECIMAL"/>
<result column="ipaystatus" property="ipaystatus" jdbcType="INTEGER"/>
<result column="irefundstatus" property="irefundstatus" jdbcType="INTEGER"/>
<result column="tpaytime" property="tpaytime" jdbcType="TIMESTAMP"/>
<result column="trefundtime" property="trefundtime" jdbcType="TIMESTAMP"/>
<result column="istatus" property="istatus" jdbcType="INTEGER"/>
<result column="itype" property="itype" jdbcType="INTEGER"/>
<result column="srefundreason" property="srefundreason" jdbcType="VARCHAR"/>
<result column="productid" property="productid" jdbcType="INTEGER"/>
<result column="ipaytype" property="ipaytype" jdbcType="INTEGER"/>
<result column="sremark" property="sremark" jdbcType="VARCHAR"/>
<result column="sdef1" property="sdef1" jdbcType="VARCHAR"/>
<result column="sdef2" property="sdef2" jdbcType="VARCHAR"/>
<result column="sdef3" property="sdef3" jdbcType="VARCHAR"/>
<result column="sdef4" property="sdef4" jdbcType="VARCHAR"/>
<result column="sdef5" property="sdef5" jdbcType="VARCHAR"/>
<result column="idef6" property="idef6" jdbcType="INTEGER"/>
<result column="idef7" property="idef7" jdbcType="INTEGER"/>
<result column="ddef8" property="ddef8" jdbcType="DECIMAL"/>
<result column="ddef9" property="ddef9" jdbcType="DECIMAL"/>
<result column="ddef10" property="ddef10" jdbcType="TIMESTAMP"/>
<association property="customer" column="customerid" select="selectCustomer"/>
......@@ -46,55 +46,104 @@
<!-- FRICE TODO 一对多 关联查询 -->
<collection property="subs" ofType="com.yunniu.farming.webadmin.model.OrderSub" javaType="java.util.ArrayList">
<!-- 以下为子表相关字段 -->
<id column="zid" property="id" jdbcType="INTEGER" />
<result column="zmainid" property="mainid" jdbcType="INTEGER" />
<result column="zproductid" property="productid" jdbcType="INTEGER" />
<result column="zipronum" property="ipronum" jdbcType="INTEGER" />
<result column="zdprosum" property="dprosum" jdbcType="DECIMAL" />
<result column="zsgoodprice" property="sgoodprice" jdbcType="DECIMAL" />
<id column="zid" property="id" jdbcType="INTEGER"/>
<result column="zmainid" property="mainid" jdbcType="INTEGER"/>
<result column="zproductid" property="productid" jdbcType="INTEGER"/>
<result column="zipronum" property="ipronum" jdbcType="INTEGER"/>
<result column="zdprosum" property="dprosum" jdbcType="DECIMAL"/>
<result column="zsgoodprice" property="sgoodprice" jdbcType="DECIMAL"/>
<!-- 以下为商品相关字段 -->
<result column="zsproductname" property="sproductname" jdbcType="VARCHAR" />
<result column="zspshortpic" property="spshortpic" jdbcType="VARCHAR" />
<result column="zsproductname" property="sproductname" jdbcType="VARCHAR"/>
<result column="zspshortpic" property="spshortpic" jdbcType="VARCHAR"/>
</collection>
</resultMap>
<select id="selectCustomer" parameterType="Integer" resultType="com.yunniu.farming.webadmin.model.Customer">
SELECT *
FROM customer WHERE id = #{customerid}
FROM customer
WHERE id = #{customerid}
</select>
<sql id="Base_Column_List">
id, customerid,addressid,productid, sorderno,
scusaddr,scuname,scuphone,sprovince,scity,sregion,itype,
sorderdate, tordertime,tovertime,
dplanmoney,dactmoney,dactscore, ipaystatus, irefundstatus,
tpaytime,trefundtime, istatus,
sdef1, sdef2, sdef3, sdef4, sdef5, idef6, idef7,
ddef8, ddef9, ddef10
id,
customerid,
addressid,
productid,
sorderno,
scusaddr,
scuname,
scuphone,
sprovince,
scity,
sregion,
itype,
sorderdate,
tordertime,
tovertime,
dplanmoney,
dactmoney,
dactscore,
ipaystatus,
irefundstatus,
tpaytime,
trefundtime,
istatus,
sdef1,
sdef2,
sdef3,
sdef4,
sdef5,
idef6,
idef7,
ddef8,
ddef9,
ddef10
</sql>
<sql id="Full_Column_List">
ordermain.id, ordermain.customerid,ordermain.addressid,ordermain.productid, ordermain.sorderno,
ordermain.scusaddr,ordermain.scuname,ordermain.scuphone,ordermain.sprovince,ordermain.scity,ordermain.sregion,ordermain.itype,
ordermain.sorderdate, ordermain.tordertime,ordermain.tovertime,
ordermain.dplanmoney,ordermain.dactmoney, ordermain.dactscore,ordermain.ipaystatus, ordermain.irefundstatus,
ordermain.tpaytime,ordermain.trefundtime, ordermain.istatus,ordermain.ipaytype,
ordermain.sdef1, ordermain.sdef2, ordermain.sdef3, ordermain.sdef4, ordermain.sdef5, ordermain.idef6, ordermain.idef7,
ordermain.ddef8, ordermain.ddef9, ordermain.ddef10
ordermain.id,
ordermain.customerid,
ordermain.addressid,
ordermain.productid,
ordermain.sorderno,
ordermain.scusaddr,
ordermain.scuname,
ordermain.scuphone,
ordermain.sprovince,
ordermain.scity,
ordermain.sregion,
ordermain.itype,
ordermain.sorderdate,
ordermain.tordertime,
ordermain.tovertime,
ordermain.dplanmoney,
ordermain.dactmoney,
ordermain.dactscore,
ordermain.ipaystatus,
ordermain.irefundstatus,
ordermain.tpaytime,
ordermain.trefundtime,
ordermain.istatus,
ordermain.ipaytype,
ordermain.sdef1,
ordermain.sdef2,
ordermain.sdef3,
ordermain.sdef4,
ordermain.sdef5,
ordermain.idef6,
ordermain.idef7,
ordermain.ddef8,
ordermain.ddef9,
ordermain.ddef10
</sql>
<!-- 带参数常规查询 S -->
<select id="selectByParam" resultMap="BaseResultMap" parameterType="com.yunniu.farming.webadmin.model.OrderMain">
select
<include refid="Full_Column_List" />
<include refid="Full_Column_List"/>
FROM order_main ordermain
......@@ -132,16 +181,20 @@
</select>
<!-- 带参数分页查询 S -->
<select id="selectByParamPageList" resultMap="BaseResultMap" parameterType="com.yunniu.farming.webadmin.model.OrderMain">
<select id="selectByParamPageList" resultMap="BaseResultMap"
parameterType="com.yunniu.farming.webadmin.model.OrderMain">
SELECT
<include refid="Full_Column_List" />
<include refid="Full_Column_List"/>
<!-- 关联子表信息 -->
,sub.id AS zid, sub.ipronum AS zipronum, sub.dprosum AS zdprosum,
sub.productid AS zproductid,sub.sgoodprice AS zsgoodprice,
,
sub.id AS zid,
sub.ipronum AS zipronum,
sub.dprosum AS zdprosum,
sub.productid AS zproductid,
sub.sgoodprice AS zsgoodprice,
sub.sproductname AS zsproductname,
sub.spshortpic AS zspshortpic
FROM
order_main ordermain
FROM order_main ordermain
LEFT JOIN order_sub sub ON ordermain.id = sub.mainid
<where>
<if test="appflag == null or appflag == ''">
......@@ -176,7 +229,6 @@
<if test="endDate != null">
AND ordermain.sorderdate <![CDATA[ <= ]]> #{endDate,jdbcType=VARCHAR}
</if>
</where>
<!-- 以时间倒序显示 -->
ORDER BY ordermain.tordertime DESC
......@@ -184,27 +236,28 @@
<!-- 带参数分页查询 E -->
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
SELECT
<include refid="Full_Column_List" />
<include refid="Full_Column_List"/>
<!-- 关联子表信息 -->
,sub.id AS zid, sub.ipronum AS zipronum, sub.dprosum AS zdprosum,
sub.productid AS zproductid,sub.sgoodprice AS zsgoodprice,
,
sub.id AS zid,
sub.ipronum AS zipronum,
sub.dprosum AS zdprosum,
sub.productid AS zproductid,
sub.sgoodprice AS zsgoodprice,
sub.sproductname AS zsproductname,
sub.spshortpic AS zspshortpic
FROM
order_main ordermain
FROM order_main ordermain
LEFT JOIN order_sub sub ON ordermain.id = sub.mainid
WHERE ordermain.id = #{id,jdbcType=INTEGER}
</select>
<select id="countOrderNum" resultType="int" parameterType="com.yunniu.farming.webadmin.model.OrderMain">
SELECT IFNULL(count(*),0) from order_main
SELECT IFNULL(count(*), 0)
from order_main
<where>
<if test="customerid != null">
AND customerid = #{customerid,jdbcType=INTEGER}
</if>
......@@ -214,22 +267,20 @@
<if test="ipaystatus != null">
AND ipaystatus = #{ipaystatus,jdbcType=INTEGER}
</if>
<if test="ipaytype != null" >
<if test="ipaytype != null">
AND ipaytype = #{ipaytype,jdbcType=INTEGER}
</if>
<if test="itype != null" >
<if test="itype != null">
AND itype = #{itype,jdbcType=INTEGER}
</if>
</where>
</select>
<select id="countOrderMoney" resultType="double" parameterType="com.yunniu.farming.webadmin.model.OrderMain">
SELECT IFNULL(SUM(dactmoney) ,0) from order_main
SELECT IFNULL(SUM(dactmoney), 0)
from order_main
<where>
<if test="customerid != null">
AND customerid = #{customerid,jdbcType=INTEGER}
</if>
......@@ -240,16 +291,25 @@
<if test="ipaystatus != null">
AND ipaystatus = #{ipaystatus,jdbcType=INTEGER}
</if>
<if test="itype != null" >
<if test="itype != null">
AND itype = #{itype,jdbcType=INTEGER}
</if>
<if test="ipaytype != null" >
<if test="ipaytype != null">
AND ipaytype = #{ipaytype,jdbcType=INTEGER}
</if>
</where>
</select>
<select id="getPageListByGroupOrderId" resultType="com.yunniu.farming.webadmin.model.OrderMain">
select om.id,
c.swxnick,
om.sorderno,
om.dactmoney,
om.tpaytime,
concat(om.sprovince, om.scity, om.sregion, om.scusaddr) as scusaddr,
om.sremark
from order_main om
left join customer c on om.customerid = c.id
where om.group_order_id = #{id,jdbcType=BIGINT}
</select>
</mapper>
......@@ -69,5 +69,9 @@
#{item.ddef8,jdbcType=DECIMAL}, #{item.ddef9,jdbcType=DECIMAL}, #{item.ddef10,jdbcType=TIMESTAMP})
</foreach>
</insert>
<select id="getPageListByOrderMianId" resultMap="BaseResultMap">
select sproductname, ipronum, spshortpic, sgoodprice, dprosum from order_sub where mainid = #{id,jdbcType=BIGINT}
</select>
<!-- 批量插入e -->
</mapper>
\ No newline at end of file
......@@ -213,7 +213,6 @@
});
});
} else if (obj.event === 'edit') {
console.log("1111111111111111111 =", obj.data.id);
var id = obj.data.id;
var w = ($(window).width() * 0.9);
var h = ($(window).height() * 0.9);
......
......@@ -8,6 +8,7 @@
<link rel="shortcut icon" th:href="@{/images/logo.jpg}"/>
<link rel="stylesheet" th:href="@{/js/layui/css/layui.css}">
<link rel="stylesheet" th:href="@{/js/layui/css/admin.css}">
<link rel="stylesheet" th:href="@{/js/layui/css/my.css}">
<link rel="stylesheet" th:href="@{/js/upload_img/css/index.css}">
<script type="text/javascript" th:src="@{/js/jquery-3.3.1.min.js}"></script>
<script th:src="@{/js/layui/layui.js}" charset="utf-8"></script>
......@@ -16,6 +17,8 @@
<script type="text/javascript" th:src="@{/js/ueditor/ueditor.all.js}"></script>
<script type="text/javascript" th:src="@{/js/ueditor/lang/zh-cn/zh-cn.js}"></script>
<script src="http://www.jq22.com/jquery/jquery-1.7.1.js"></script>
<link rel="stylesheet" href="https://cdn.staticfile.org/layui/2.5.6/css/layui.min.css">
<script src="https://cdn.staticfile.org/layui/2.5.6/layui.min.js"></script>
<style>
......@@ -31,14 +34,15 @@
</head>
<body>
<div class="layui-form" style="padding: 20px 0 0 0;">
<!-- <div class="tab-container">-->
<!-- <ul class="tabs">-->
<!-- <li><a href="#tab1">详情</a></li>-->
<!-- <li><a href="#tab2">用户信息</a></li>-->
<!-- </ul>-->
<!-- <div class="tab-content">-->
<!-- <div id="tab1">-->
<div class="layui-tab" lay-filter="tab-demo">
<ul class="layui-tab-title">
<li class="layui-this">详情</li>
<li>用户信息</li>
</ul>
<div class="layui-tab-content">
<!-- 详情 -->
<div class="layui-tab-item layui-show">
<div class="layui-form" style="padding: 20px 0 0 0;">
<form id="formId" onsubmit="return false;">
<div class="layui-form-item">
<label class="layui-form-label">活动标题</label>
......@@ -55,82 +59,50 @@
<div class="layui-form-item">
<label class="layui-form-label">订单实付金额</label>
<div class="layui-input-inline">
<input type="number" class="layui-input" name="sumDactmoney" id="sumDactmoney" th:value="${obj.sumDactmoney}">
<input type="number" class="layui-input" name="sumDactmoney" id="sumDactmoney"
th:value="${obj.sumDactmoney}">
</div>
<label class="layui-form-label">订单状态</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" name="groupStatus" id="groupStatus" th:value="${obj.groupStatus}">
<input type="text" class="layui-input" name="groupStatus" id="groupStatus"
th:value="${obj.groupStatus}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">成团时间</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" name="successTime" id="successTime" th:value="${obj.successTime}">
<input type="text" class="layui-input" name="successTime" id="successTime"
th:value="${obj.successTime}">
</div>
<label class="layui-form-label">小区名称</label>
<div class="layui-input-inline">
<input type="text" class="layui-input" name="areaName" id="areaName" th:value="${obj.areaName}">
<input type="text" class="layui-input" name="areaName" id="areaName"
th:value="${obj.areaName}">
</div>
</div>
<button class="layui-btn" style="display: none;" id="saveBtn" onclick="save()">保存</button>
</form>
<!-- </div>-->
<!-- <div id="tab2"><p>Content for tab 2 goes here.</p></div>-->
<!-- </div>-->
</div>
</div>
<!-- 用户信息 -->
<div class="layui-tab-item">
<table class="layui-hide" id="tableId" lay-filter="tableId"></table>
</div>
</div>
</div>
<script type="text/javascript" th:src="@{/js/upload_img/js/updateimg.js}"></script>
<script>
var id = '[[${id}]]';
var ue = UE.getEditor('editor');
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
UE.Editor.prototype.getActionUrl = function (action) {
if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
return "http://1.15.43.240:8330/product/uploads";
// return "https://127.0.0.1/goods/uploads";
} else if (action == 'listimage') {
return this._bkGetActionUrl.call(this, action);
} else {
return this._bkGetActionUrl.call(this, action);
}
}
<script type="text/html" id="table-handle">
<i class="layui-icon layui-icon-form" lay-event="detail" title="详情"></i>
$(function () {
if (id) {
// getGoodsInfo(goodsId);
showImg('[[${obj.groupBuyTitle}]]');
}
});
</script>
function showImg(goodsImgs) {
var arr = goodsImgs.split(",");
for (var i = 0; i < arr.length; i++) {
var imgMsg = {
name: randomString(5), //获取文件名
base64: arr[i], //reader.readAsDataURL方法执行完后,base64数据储存在reader.result里
}
dataArr.push(imgMsg);
currentReViewImgIndex = i;
var showui = document.getElementById("showui");
result = '<div class="showdiv"><img class="left" src="/js/upload_img/img/Arrow_left.svg" /><img class="center" src="/js/upload_img/img/delete.svg" /><img class="right" src="/js/upload_img/img/Arrow_right.svg" /></div><img id="img' + currentReViewImgIndex + randomString(1) + randomString(2) + randomString(5) + '" class="showimg" src="' + arr[i] + '" />';
var li = document.createElement('li');
li.innerHTML = result;
showui.appendChild(li);
}
}
<script>
var id = '[[${id}]]';
function uploadImg() {
$("#upgteimg").click();
}
layui.use('form', function () {
var form = layui.form;
form.render();
......@@ -148,7 +120,113 @@
$('#file' + i).trigger("click");
}
layui.use('element', function () {
var element = layui.element;
//监听Tab切换,以改变地址hash值
element.on('tab(tab-demo)', function () {
location.hash = 'tab-demo=' + this.getAttribute('lay-id');
});
//获取hash来切换选项卡,假设当前地址的hash为lay-id对应的值
var hash = location.hash.replace(/^#tab-demo=/, '');
element.tabChange('tab-demo', hash);
});
var field = {};
layui.use(['table', 'laydate', 'form'], function () {
var form = layui.form, table = layui.table;
//监听搜索
form.on('submit(The-search)', function (data) {
field = data.field;
//执行重载
table.reload('tableId', {
where: field
, page: {
curr: 1
}
});
});
table.render({
elem: '#tableId'
, url: 'userList'
, method: 'post'
, contentType: "application/json" // 内容编码, json格式
, height: 500
, toolbar: '#toolbarUtil' //开启头部工具栏,并为其绑定左侧模板
, defaultToolbar: ['filter']
, cellMinWidth: 20 //全局定义常规单元格的最小宽度,layui 2.2.1 新增
, skin: 'line ' //表格风格 line (行边框风格)row (列边框风格)nob (无边框风格)
, even: true //隔行换色
, limit: 20 //每页默认显示的数量
, page: true
, where: {
id: id
}
, request: {
pageName: "curpage", // 页码的参数名称,默认:page
limitName: "pagesize" // 每页数据量的参数名,默认:limit
}
, response: {
statusName: "code", // 规定数据状态的字段名称,默认:code
statusCode: 100, // 规定成功的状态码,默认:0
msgName: "msg", // 规定状态信息的字段名称,默认:msg
countName: "count", // 规定数据总数的字段名称,默认:count
dataName: "data" // 规定数据列表的字段名称,默认:data
}
, parseData: function (res) { // res 即为原始返回的数据
return {
"code": res.code, // 解析接口状态
"msg": res.desc, // 解析提示文本
"count": res.data.pageinfo.totalRecords, // 解析数据长度
"data": res.data.items // 解析数据列表
};
}
, limits: [10, 20, 50, 100] //每页条数的选择项,默认:[10,20,30,40,50,60,70,80,90]。
, cols: [
[
{type: 'checkbox', fixed: "left"}
, {field: 'swxnick', title: '用户昵称', fixed: "left"}
, {field: 'sorderno', title: '订单号'}
, {field: 'dactmoney', title: '实付金额'}
, {field: 'tpaytime', title: '付款时间'}
, {field: 'scusaddr', title: '收获地址'}
, {field: 'sremark', title: '备注'}
, {field: '', width: 130, title: '操作', toolbar: '#table-handle', fixed: "right"}
]
]
});
//监听行工具事件
table.on('tool(tableId)', function (obj) {
var data = obj.data;
if (obj.event === 'detail') {
var id = obj.data.id;
console.log("========== ", id)
var w = ($(window).width() * 0.95);
var h = ($(window).height() * 0.95);
layer.open({
type: 2
, title: '详情'
, content: 'detailList?id=' + id
, area: [w + 'px', h + 'px']
, fix: false //不固定
, maxmin: true
, shadeClose: true
, shade: 0.4
, btn: ['关闭']
// , yes: function (index, layero) {
// var body = layer.getChildFrame('body', index); //得到iframe页面层的BODY
// var iframeBtn = body.find('#saveBtn');//得到iframe页面层的提交按钮
// iframeBtn.click();//模拟iframe页面层的提交按钮点击
// }
});
}
});
}
);
</script>
</body>
......
......@@ -43,8 +43,10 @@
table.render({
elem: '#tableId'
, url: 'findSubPageList'
, where: field
, url: 'productList'
, where: {
id: id
}
, method: 'post'
,contentType: "application/json" // 内容编码, json格式
, height: 500
......@@ -61,7 +63,7 @@
}
,response: {
statusName: "code", // 规定数据状态的字段名称,默认:code
statusCode: 0, // 规定成功的状态码,默认:0
statusCode: 100, // 规定成功的状态码,默认:0
msgName: "msg", // 规定状态信息的字段名称,默认:msg
countName: "count", // 规定数据总数的字段名称,默认:count
dataName: "data" // 规定数据列表的字段名称,默认:data
......@@ -81,7 +83,7 @@
, cols: [
[
{type: 'checkbox', fixed: "left"}
, {field: 'sproductname',width: 100,title: '商品名称'}
, {field: 'sproductname',width: 200,title: '商品名称'}
,{
title: "商品图片",
align: "center",
......@@ -91,8 +93,9 @@
'';
}
}
, {field: 'ipronum', width: 100, title: '购买数量'}
, {field: 'dprosum', width: 100, title: '金额小计'}
, {field: 'ipronum', width: 150, title: '购买数量'}
, {field: 'sgoodprice', width: 150, title: '商品售价'}
, {field: 'dprosum', width: 150, title: '金额小计'}
......
......@@ -155,7 +155,6 @@
, {field: 'areaName', title: '小区名称'}
, {field: 'orderCode', title: '订单编号'}
, {field: 'sumDactmoney', title: '订单实付金额'}
, {field: 'sumDactmoney', title: '订单实付金额'}
,{
title: "订单状态",
templet: function(d) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment