Commit ec4795a4 by zhengyunfei

二次开发

parent 1c569b7b
...@@ -186,9 +186,29 @@ public class OrderMainAppController { ...@@ -186,9 +186,29 @@ public class OrderMainAppController {
public Result cancelOrder(@RequestBody JSONObject json) { public Result cancelOrder(@RequestBody JSONObject json) {
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象 //1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json, OrderMain.class); OrderMain user = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.cancelOrder(user); return this.orderService.cancelOrder(user);
}
/**
* 申请退款
*/
@RequestMapping(value = "/refundOrder", method = RequestMethod.POST)
@ResponseBody
public Result refundOrder(@RequestBody JSONObject json) {
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.refundOrder(user);
}
/**
* 退货
*/
@RequestMapping(value = "/saveCourierNumber", method = RequestMethod.POST)
@ResponseBody
public Result saveCourierNumber(@RequestBody JSONObject json) {
//1. 将前台传过来的json对象转换成具有业务属性的 Java 对象
OrderMain user = JSONObject.toJavaObject(json, OrderMain.class);
return this.orderService.saveCourierNumber(user);
} }
......
...@@ -100,7 +100,7 @@ public class WxController { ...@@ -100,7 +100,7 @@ public class WxController {
@RequestMapping(value = "/wxRefund", method = RequestMethod.POST) @RequestMapping(value = "/wxRefund", method = RequestMethod.POST)
public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) { public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) {
try { try {
return wxService.wxRefund(userId, orderId, request); return wxService.wxRefund(userId, orderId,"", request);
} catch (Exception e) { } catch (Exception e) {
return new Result(103); return new Result(103);
} }
......
...@@ -31,6 +31,10 @@ public class OrderMainController { ...@@ -31,6 +31,10 @@ public class OrderMainController {
public String loanList(Model model) { public String loanList(Model model) {
return "order/loanList"; return "order/loanList";
} }
@RequestMapping(value = "/refundList")
public String refundList(Model model) {
return "order/refundList";
}
@RequestMapping(value = "/vipList") @RequestMapping(value = "/vipList")
public String vipList(Model model) { public String vipList(Model model) {
...@@ -155,6 +159,60 @@ public class OrderMainController { ...@@ -155,6 +159,60 @@ public class OrderMainController {
/** /**
* 团购退款订单列表
*/
@RequestMapping(value = "/findPageRefundList", method = RequestMethod.POST)
@ResponseBody
public Result findPageRefundList(@RequestBody OrderMain item) {
//这里对返回对象用Map处理,map.pageinfo=>分页信息;map.items=>结果数据集;
Map<String,Object> rmap = new HashMap<String,Object>();
//传入当前页数,适配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);
}
// 2.1 执行主表 查询
List<OrderMain> items=this.orderService.selectByParamPageRefundGroupList(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", items);
return Result.success(rmap);
}
/**
* 多参数查询列表 * 多参数查询列表
*/ */
@RequestMapping(value = "/findByParam", method = RequestMethod.POST) @RequestMapping(value = "/findByParam", method = RequestMethod.POST)
...@@ -255,7 +313,34 @@ public class OrderMainController { ...@@ -255,7 +313,34 @@ public class OrderMainController {
} }
/**
* 退款申请通过
*/
@RequestMapping(value = "/refundApplicationPass",method = RequestMethod.POST)
@ResponseBody
public Result refundApplicationPass(@RequestBody JSONObject json){
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.refundApplicationPass(user);
}
/**
* 退款申请拒绝
*/
@RequestMapping(value = "/refundApplicationRefuse",method = RequestMethod.POST)
@ResponseBody
public Result refundApplicationRefuse(@RequestBody JSONObject json){
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.refundApplicationRefuse(user);
}
/**
* 已收到退回货物,开始退款
*/
@RequestMapping(value = "/receive",method = RequestMethod.POST)
@ResponseBody
public Result refundReceive(@RequestBody JSONObject json){
OrderMain user = JSONObject.toJavaObject(json,OrderMain.class);
return this.orderService.refundReceive(user);
}
/** /**
* 订单已完成 * 订单已完成
...@@ -272,7 +357,7 @@ public class OrderMainController { ...@@ -272,7 +357,7 @@ public class OrderMainController {
/** /**
* @积分兑换 商品 * 积分兑换 商品
*/ */
@RequestMapping(value = "/integralPay", method = RequestMethod.POST) @RequestMapping(value = "/integralPay", method = RequestMethod.POST)
public Result integralPay(Integer userId, Integer orderId){ public Result integralPay(Integer userId, Integer orderId){
......
...@@ -77,7 +77,7 @@ public class TaskJob { ...@@ -77,7 +77,7 @@ public class TaskJob {
// 循环退款 // 循环退款
orderMains.forEach(orderMain -> { orderMains.forEach(orderMain -> {
try { try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), null); wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "拼团失败", null);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -22,4 +22,6 @@ public interface OrderMainDao extends BaseMapper<OrderMain> { ...@@ -22,4 +22,6 @@ public interface OrderMainDao extends BaseMapper<OrderMain> {
List<OrderMain> selectByGroupOrderId(Long id); List<OrderMain> selectByGroupOrderId(Long id);
OrderMain getLastOrderAddres(Integer userId); OrderMain getLastOrderAddres(Integer userId);
List<OrderMain> selectByParamPageRefundGroupList(OrderMain item);
} }
...@@ -60,13 +60,18 @@ public class OrderMain { ...@@ -60,13 +60,18 @@ public class OrderMain {
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
private String endDate; private String endDate;
//订单状态[10:待付款 20:待发货 30:待收货 90:已完成 99:已拒绝/关闭 100:取消/退款] //订单状态[10:待付款 20:待发货 30:待收货 90:已完成 99:已拒绝/关闭 100:取消 101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝]
public static final Integer STATUS_NOPAY = 10; public static final Integer STATUS_NOPAY = 10;
public static final Integer STATUS_YESPAY = 20; public static final Integer STATUS_YESPAY = 20;
public static final Integer STATUS_WAITING = 30; public static final Integer STATUS_WAITING = 30;
public static final Integer STATUS_COMPLETE = 90; public static final Integer STATUS_COMPLETE = 90;
public static final Integer STATUS_REFUSEED = 99; public static final Integer STATUS_REFUSEED = 99;
public static final Integer STATUS_CANCEL = 100; public static final Integer STATUS_CANCEL = 100;
public static final Integer STATUS_APPLICATION = 101;
public static final Integer STATUS_RETURN_GOODS = 102;
public static final Integer STATUS_REFUND = 103;
public static final Integer STATUS_REFUND_SUC = 104;
public static final Integer STATUS_REFUND_REFUSE = 105;
//数据库字段 //数据库字段
private Integer id; // id主键 private Integer id; // id主键
...@@ -88,9 +93,12 @@ public class OrderMain { ...@@ -88,9 +93,12 @@ public class OrderMain {
private Double dactscore; // 订单实付积分[整数] private Double dactscore; // 订单实付积分[整数]
private Integer ipaystatus; // 支付状态[0:未支付1:支付成功2:支付失败] private Integer ipaystatus; // 支付状态[0:未支付1:支付成功2:支付失败]
private Date tpaytime; // 支付时间[yyyy-MM-dd hh:mm:ss] private Date tpaytime; // 支付时间[yyyy-MM-dd hh:mm:ss]
private Integer irefundstatus; // 退款状态[0:待退款1:已退款2:退款失败] private String refundorderno;
private Integer irefundstatus; // 退款状态[101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝]
private Date trefundtime; // 退款时间[yyyy-MM-dd hh:mm:ss] private Date trefundtime; // 退款时间[yyyy-MM-dd hh:mm:ss]
private String srefundreason; // 退款理由 private String srefundreason; // 退款理由
private String srefundpic; // 退款图片
private String couriernumber; // 退货快递单号
private Integer istatus; // 订单状态 private Integer istatus; // 订单状态
private Integer itype; // 订单类型 //10 外卖订单 20 团购订单 private Integer itype; // 订单类型 //10 外卖订单 20 团购订单
private Integer ipaytype; // 支付方式[10:微信支付.20:支付宝支付.30积分支付] private Integer ipaytype; // 支付方式[10:微信支付.20:支付宝支付.30积分支付]
...@@ -126,6 +134,9 @@ public class OrderMain { ...@@ -126,6 +134,9 @@ public class OrderMain {
private Long groupBuyId; private Long groupBuyId;
@TableField(exist = false) @TableField(exist = false)
private String groupBuyName;
@TableField(exist = false)
private Integer appflag; private Integer appflag;
@TableField(exist = false) @TableField(exist = false)
......
...@@ -15,7 +15,7 @@ public interface WxService { ...@@ -15,7 +15,7 @@ public interface WxService {
void notify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException; void notify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException;
Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) throws Exception; Result wxRefund(Integer userId, Integer orderId, String srefundreason, HttpServletRequest request) throws Exception;
void wxRefundNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException; void wxRefundNotify(HttpServletRequest request, HttpServletResponse response) throws IOException, JDOMException;
} }
...@@ -121,6 +121,7 @@ public class GroupBuyServiceimpl implements GroupBuyService { ...@@ -121,6 +121,7 @@ public class GroupBuyServiceimpl implements GroupBuyService {
public List<Product> productList(Product item) { public List<Product> productList(Product item) {
DocCatalog catalog = docCatalogDao.selectOne(Wrappers.<DocCatalog>lambdaQuery().like(DocCatalog::getSname, "团购")); DocCatalog catalog = docCatalogDao.selectOne(Wrappers.<DocCatalog>lambdaQuery().like(DocCatalog::getSname, "团购"));
item.setCatalogid(catalog.getId()); item.setCatalogid(catalog.getId());
item.setIstatus(1);
return productDao.selectByParamPageList(item); return productDao.selectByParamPageList(item);
} }
......
package com.yunniu.farming.webadmin.service.impl; package com.yunniu.farming.webadmin.service.impl;
import com.alibaba.fastjson.JSON;
import com.yunniu.farming.result.Result; import com.yunniu.farming.result.Result;
import com.yunniu.farming.util.DateTools; import com.yunniu.farming.util.DateTools;
import com.yunniu.farming.util.DateUtils; import com.yunniu.farming.util.DateUtils;
...@@ -14,9 +15,12 @@ import com.yunniu.farming.webadmin.model.Integralrec; ...@@ -14,9 +15,12 @@ import com.yunniu.farming.webadmin.model.Integralrec;
import com.yunniu.farming.webadmin.model.OrderMain; import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.model.OrderSub; import com.yunniu.farming.webadmin.model.OrderSub;
import com.yunniu.farming.webadmin.service.GroupOrderService; import com.yunniu.farming.webadmin.service.GroupOrderService;
import com.yunniu.farming.webadmin.service.WxService;
import com.yunniu.farming.wx.WxConfigUtil; import com.yunniu.farming.wx.WxConfigUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -27,7 +31,7 @@ import java.util.HashMap; ...@@ -27,7 +31,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Slf4j
@Service @Service
public class OrderMainServiceImpl { public class OrderMainServiceImpl {
...@@ -47,6 +51,10 @@ public class OrderMainServiceImpl { ...@@ -47,6 +51,10 @@ public class OrderMainServiceImpl {
@Autowired @Autowired
private GroupOrderService orderService; private GroupOrderService orderService;
@Autowired
@Lazy
private WxService wxService;
/** /**
* 分页查询所有数据 * 分页查询所有数据
...@@ -54,7 +62,6 @@ public class OrderMainServiceImpl { ...@@ -54,7 +62,6 @@ public class OrderMainServiceImpl {
*/ */
public List<OrderMain> selectByParamPageList(OrderMain doc) { public List<OrderMain> selectByParamPageList(OrderMain doc) {
return this.orderMainDao.selectByParamPageList(doc); return this.orderMainDao.selectByParamPageList(doc);
} }
...@@ -278,7 +285,51 @@ public class OrderMainServiceImpl { ...@@ -278,7 +285,51 @@ public class OrderMainServiceImpl {
} }
/**
* 更改订单退款申请通过
*/
public Result refundApplicationPass(OrderMain order) {
if(order.getId() == null){
return Result.error();
}
order.setIrefundstatus(OrderMain.STATUS_RETURN_GOODS);
this.orderMainDao.updateById(order);
return Result.success("成功");
}
/**
* 更改订单退款申请通过
*/
public Result refundApplicationRefuse(OrderMain order) {
if(order.getId() == null){
return Result.error();
}
order.setIrefundstatus(OrderMain.STATUS_REFUND_REFUSE);
this.orderMainDao.updateById(order);
return Result.success("成功");
}
/**
* 已收到退回货物,开始退款
* @param order
* @return
*/
@Transactional(rollbackFor = Exception.class)
public Result refundReceive(OrderMain order) {
// 根据id获取订单信息
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setIrefundstatus(OrderMain.STATUS_REFUND);
this.orderMainDao.updateById(orderMain);
log.info("收货成功,开始退款:{}", JSON.toJSONString(orderMain));
try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null);
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
@Transactional(rollbackFor = Exception.class)
public Result cancelOrder(OrderMain order) { public Result cancelOrder(OrderMain order) {
if(order.getId() == null){ if(order.getId() == null){
...@@ -288,8 +339,12 @@ public class OrderMainServiceImpl { ...@@ -288,8 +339,12 @@ public class OrderMainServiceImpl {
OrderMain orderMain = this.orderMainDao.selectById(order.getId()); OrderMain orderMain = this.orderMainDao.selectById(order.getId());
//已支付订单 无法取消 //已支付订单 无法取消
if(orderMain.getIpaystatus().equals(OrderMain.FLAG_Y)){ if(orderMain.getIpaystatus().equals(OrderMain.PAY_STATUS_OK)){
return Result.error("订单已支付,无法取消"); try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null);
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
//已取消 //已取消
...@@ -473,4 +528,31 @@ public class OrderMainServiceImpl { ...@@ -473,4 +528,31 @@ public class OrderMainServiceImpl {
return Result.success(this.orderMainDao.getLastOrderAddres(userId)); return Result.success(this.orderMainDao.getLastOrderAddres(userId));
} }
/**
* 申请退款
* @param order
* @return
*/
@Transactional(rollbackFor = Exception.class)
public Result refundOrder(OrderMain order) {
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setSrefundreason(order.getSrefundreason());
orderMain.setSrefundpic(order.getSrefundpic());
orderMain.setIrefundstatus(OrderMain.STATUS_APPLICATION);
this.orderMainDao.updateById(orderMain);
return Result.success("成功");
}
public List<OrderMain> selectByParamPageRefundGroupList(OrderMain item) {
return this.orderMainDao.selectByParamPageRefundGroupList(item);
}
public Result saveCourierNumber(OrderMain order) {
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setIrefundstatus(OrderMain.STATUS_RETURN_GOODS);
orderMain.setCouriernumber(order.getCouriernumber());
this.orderMainDao.updateById(orderMain);
return Result.success("成功");
}
} }
...@@ -234,15 +234,16 @@ public class WxServiceImpl implements WxService { ...@@ -234,15 +234,16 @@ public class WxServiceImpl implements WxService {
* @return * @return
*/ */
@Override @Override
public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) throws Exception { public Result wxRefund(Integer userId, Integer orderId, String srefundreason, HttpServletRequest request) throws Exception {
OrderMain order = orderMainDao.selectByPrimaryKey(orderId); OrderMain order = orderMainDao.selectByPrimaryKey(orderId);
if (order == null || !order.getCustomerid().equals(userId)) { if (order == null || !order.getCustomerid().equals(userId)) {
return new Result(102); return new Result(102);
} }
order.setSdef1("R" + StringHelper.getOrderno()); // 退款单号 order.setSdef1("R" + StringHelper.getOrderno()); // 退款单号
order.setSrefundreason("拼团失败"); // 退款理由 order.setSrefundreason(srefundreason); // 退款理由
order.setIrefundstatus(0); order.setIrefundstatus(0);
order.setTrefundtime(new Date()); order.setTrefundtime(new Date());
order.setRefundorderno(StringHelper.getOrderno());
orderMainDao.updateById(order); orderMainDao.updateById(order);
double tradeMoney = order.getDactmoney(); double tradeMoney = order.getDactmoney();
...@@ -259,6 +260,7 @@ public class WxServiceImpl implements WxService { ...@@ -259,6 +260,7 @@ public class WxServiceImpl implements WxService {
//parameters.put("profit_sharing", "Y"); //parameters.put("profit_sharing", "Y");
// 用户端实际ip // 用户端实际ip
parameters.put("notify_url", WxConfigUtil.refund_notify_url); // 接收微信支付异步通知回调地址 parameters.put("notify_url", WxConfigUtil.refund_notify_url); // 接收微信支付异步通知回调地址
parameters.put("out_refund_no", order.getRefundorderno());
System.out.println("sign=====" + parameters); System.out.println("sign=====" + parameters);
// 设置签名 // 设置签名
String sign = WxUtil.createSignMD5(parameters); String sign = WxUtil.createSignMD5(parameters);
...@@ -267,8 +269,8 @@ public class WxServiceImpl implements WxService { ...@@ -267,8 +269,8 @@ public class WxServiceImpl implements WxService {
// 封装请求参数结束 // 封装请求参数结束
String requestXML = WxUtil.getRequestXml(parameters); String requestXML = WxUtil.getRequestXml(parameters);
System.out.println(requestXML); System.out.println(requestXML);
// 调用统一下单接口 // 调用申请退款接口
String result = WxUtil.httpsRequest(WxConfigUtil.REFUND_ORDER_URL, "POST", requestXML); String result = WxUtil.doRefund(WxConfigUtil.REFUND_ORDER_URL, requestXML);
System.out.println(result); System.out.println(result);
Map<String, String> map = XMLUtil.doXMLParse(result); Map<String, String> map = XMLUtil.doXMLParse(result);
if (!"SUCCESS".equals(map.get("result_code"))){ if (!"SUCCESS".equals(map.get("result_code"))){
......
...@@ -20,6 +20,21 @@ import java.security.NoSuchAlgorithmException; ...@@ -20,6 +20,21 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.util.*; import java.util.*;
import java.io.File;
import java.io.InputStream;
import java.security.KeyStore;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.SSLContexts;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.core.io.ClassPathResource;
public class WxUtil { public class WxUtil {
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
...@@ -247,6 +262,51 @@ public class WxUtil { ...@@ -247,6 +262,51 @@ public class WxUtil {
return null; return null;
} }
public static String doRefund(String url, String data) throws Exception {
KeyStore keyStore = KeyStore.getInstance("PKCS12");
// 指定证书路径
String path = "apiclient_cert.p12";
ClassPathResource classPathResource = new ClassPathResource(path);
//读取本机存放的PKCS12证书文件
InputStream stream = classPathResource.getInputStream();
String mchId = WxConfigUtil.MCH_ID;
try {
//指定PKCS12的密码(商户ID)
keyStore.load(stream, mchId.toCharArray());
} finally {
stream.close();
}
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, mchId.toCharArray()).build();
//指定TLS版本
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory( sslcontext,new String[] { "TLSv1.2"},null,SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
//设置httpclient的SSLSocketFactory
CloseableHttpClient httpclient = HttpClients.custom().setSSLSocketFactory(sslsf).build();
try {
HttpPost httpost = new HttpPost(url); // 设置响应头信息
httpost.addHeader("Connection", "keep-alive");
httpost.addHeader("Accept", "*/*");
httpost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
httpost.addHeader("Host", "api.mch.weixin.qq.com");
httpost.addHeader("X-Requested-With", "XMLHttpRequest");
httpost.addHeader("Cache-Control", "max-age=0");
httpost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");
httpost.setEntity(new StringEntity(data, "UTF-8"));
CloseableHttpResponse response = httpclient.execute(httpost);
try {
HttpEntity entity = response.getEntity();
String jsonStr = EntityUtils.toString(response.getEntity(), "UTF-8");
EntityUtils.consume(entity);
return jsonStr;
} finally {
response.close();
}
} finally {
httpclient.close();
}
}
public static JSONObject httpsRequest(String requestUrl, String requestMethod) { public static JSONObject httpsRequest(String requestUrl, String requestMethod) {
JSONObject jsonObject = null; JSONObject jsonObject = null;
......
#spring.datasource.url=jdbc:mysql://152.136.113.101:3306/farming?autoReconnect=true&useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 #spring.datasource.url=jdbc:mysql://152.136.113.101:3306/farming?autoReconnect=true&useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
#spring.datasource.username=root #spring.datasource.username=root
#spring.datasource.password=Root_123456 #spring.datasource.password=Root_123456
spring.datasource.url=jdbc:mysql://localhost:3306/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai #spring.datasource.url=jdbc:mysql://localhost:3306/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=farming #spring.datasource.username=farming
spring.datasource.password=PKWB6psxa7FBApZB #spring.datasource.password=PKWB6psxa7FBApZB
#spring.datasource.url=jdbc:mysql://db1.prd.jianghuxx.com:3317/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url=jdbc:mysql://db1.prd.jianghuxx.com:3317/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
#spring.datasource.username=root spring.datasource.username=root
#spring.datasource.password=4f9fa23639242790 spring.datasource.password=4f9fa23639242790
#7LwimZ27FqEnzIPg #7LwimZ27FqEnzIPg
##47.101.199.10 ##47.101.199.10
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
......
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
<result column="istatus" property="istatus" jdbcType="INTEGER"/> <result column="istatus" property="istatus" jdbcType="INTEGER"/>
<result column="itype" property="itype" jdbcType="INTEGER"/> <result column="itype" property="itype" jdbcType="INTEGER"/>
<result column="srefundreason" property="srefundreason" jdbcType="VARCHAR"/> <result column="srefundreason" property="srefundreason" jdbcType="VARCHAR"/>
<result column="srefundpic" property="srefundpic" jdbcType="VARCHAR"/>
<result column="couriernumber" property="couriernumber" jdbcType="VARCHAR"/>
<result column="productid" property="productid" jdbcType="INTEGER"/> <result column="productid" property="productid" jdbcType="INTEGER"/>
<result column="ipaytype" property="ipaytype" jdbcType="INTEGER"/> <result column="ipaytype" property="ipaytype" jdbcType="INTEGER"/>
<result column="sremark" property="sremark" jdbcType="VARCHAR"/> <result column="sremark" property="sremark" jdbcType="VARCHAR"/>
...@@ -124,6 +126,9 @@ ...@@ -124,6 +126,9 @@
ordermain.dactscore, ordermain.dactscore,
ordermain.ipaystatus, ordermain.ipaystatus,
ordermain.irefundstatus, ordermain.irefundstatus,
ordermain.srefundreason,
ordermain.srefundpic,
ordermain.couriernumber,
ordermain.tpaytime, ordermain.tpaytime,
ordermain.trefundtime, ordermain.trefundtime,
ordermain.istatus, ordermain.istatus,
...@@ -182,22 +187,85 @@ ...@@ -182,22 +187,85 @@
ORDER BY tordertime DESC ORDER BY tordertime DESC
</select> </select>
<resultMap id="ResultMap" 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="group_order_id" property="groupOrderId" 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="srefundpic" property="srefundpic" jdbcType="VARCHAR"/>
<result column="couriernumber" property="couriernumber" 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"/>
<result column="groupBuyId" property="groupBuyId" jdbcType="BIGINT"/>
<result column="groupBuyName" property="groupBuyName" jdbcType="VARCHAR"/>
<association property="customer" column="customerid" select="selectCustomer"/>
<!-- FRICE TODO 一对多 关联查询 -->
<collection property="subs" ofType="com.yunniu.farming.webadmin.model.OrderSub" select="selectOrderSub" column="id"/>
</resultMap>
<resultMap id="subs" type="com.yunniu.farming.webadmin.model.OrderSub">
<result 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"/>
</resultMap>
<select id="selectOrderSub" resultMap="subs">
select sub.id AS zid,
sub.mainid AS zmainid,
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_sub sub
where mainid = #{id}
</select>
<!-- 带参数分页查询 S --> <!-- 带参数分页查询 S -->
<select id="selectByParamPageList" resultMap="BaseResultMap" <select id="selectByParamPageList" resultMap="ResultMap"
parameterType="com.yunniu.farming.webadmin.model.OrderMain"> parameterType="com.yunniu.farming.webadmin.model.OrderMain">
SELECT 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.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> <where>
<if test="appflag == null or appflag == ''"> <if test="appflag == null or appflag == ''">
ordermain.itype = 10 ordermain.itype = 10
...@@ -336,4 +404,50 @@ ...@@ -336,4 +404,50 @@
and sdef3 is not null and sdef3 is not null
order by tordertime desc limit 1 order by tordertime desc limit 1
</select> </select>
<select id="selectByParamPageRefundGroupList" resultMap="ResultMap">
SELECT
<include refid="Full_Column_List"/>
<!-- 关联子表信息 -->
,gb.id as groupBuyId
,gb.group_buy_title as groupBuyName
FROM order_main ordermain
left join group_order go on ordermain.group_order_id = go.id
left join group_buy gb on go.group_buy_id = gb.id
<where>
ordermain.group_order_id IS NOT NULL
AND ordermain.irefundstatus IS NOT NULL
<if test="id != null">
AND ordermain.id = #{id,jdbcType=INTEGER}
</if>
<if test="customerid != null">
AND ordermain.customerid = #{customerid,jdbcType=INTEGER}
</if>
<if test="istatus != null">
AND ordermain.istatus = #{istatus,jdbcType=INTEGER}
</if>
<if test="irefundstatus != null">
AND ordermain.irefundstatus = #{irefundstatus,jdbcType=INTEGER}
</if>
<if test="itype != null">
AND ordermain.itype = #{itype,jdbcType=INTEGER}
</if>
<if test="ipaytype != null">
AND ordermain.ipaytype = #{ipaytype,jdbcType=INTEGER}
</if>
<if test="sorderno != null and sorderno != ''">
AND ordermain.sorderno = #{sorderno,jdbcType=VARCHAR}
</if>
<if test="beginDate != null">
AND ordermain.sorderdate <![CDATA[ >= ]]> #{beginDate,jdbcType=VARCHAR}
</if>
<if test="endDate != null">
AND ordermain.sorderdate <![CDATA[ <= ]]> #{endDate,jdbcType=VARCHAR}
</if>
</where>
<!-- 以时间倒序显示 -->
ORDER BY ordermain.tordertime DESC
</select>
</mapper> </mapper>
...@@ -422,7 +422,8 @@ ...@@ -422,7 +422,8 @@
groupBuy.areaIdList = areaIdList; groupBuy.areaIdList = areaIdList;
groupBuy.products = products; groupBuy.products = products;
groupBuy.goodsImgArr = goodsImgArr; groupBuy.goodsImgArr = goodsImgArr;
groupBuy.groupBuyPic = groupBuyPic; // groupBuy.groupBuyPic = groupBuyPic;
groupBuy.groupBuyPic = "https://ns-strategy.cdn.bcebos.com/ns-strategy/upload/fc_big_pic/part-00069-829.jpg";
groupBuy.startTime = startTime; groupBuy.startTime = startTime;
groupBuy.endTime = endTime; groupBuy.endTime = endTime;
$.ajax({ $.ajax({
......
...@@ -62,6 +62,13 @@ ...@@ -62,6 +62,13 @@
<span></span> <span></span>
{{# } }} {{# } }}
</script> </script>
<script type="text/html" id="istatus">
{{#if (d.istatus == 3) { }}
<span>已下架</span>
{{# }else if(d.istatus == 1){ }}
<span>在售</span>
{{# } }}
</script>
<!--<script type="text/javascript" th:src="@{/js/upload_img/js/updateimg.js}"></script>--> <!--<script type="text/javascript" th:src="@{/js/upload_img/js/updateimg.js}"></script>-->
...@@ -125,6 +132,7 @@ ...@@ -125,6 +132,7 @@
{field: 'catalogName', title: '分类'}, {field: 'catalogName', title: '分类'},
{field: 'doldprice', title: '原价'}, {field: 'doldprice', title: '原价'},
{field: 'dsaleprice', title: '售价'}, {field: 'dsaleprice', title: '售价'},
{field: 'istatus', title: '状态', toolbar: '#istatus'},
] ]
] ]
}); });
......
...@@ -82,7 +82,13 @@ ...@@ -82,7 +82,13 @@
<script type="text/html" id="table-handle"> <script type="text/html" id="table-handle">
<i class="layui-icon layui-icon-form" lay-event="orderDetail" title="订单详情"></i> <i class="layui-icon layui-icon-form" lay-event="orderDetail" title="订单详情"></i>
{{#if (d.istatus == 0 || d.istatus == 10) { }} <!-- 101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝-->
{{#if (d.irefundstatus == 101) { }}
<i class="layui-icon layui-icon-ok" lay-event="pass" title="退款申请通过"></i>
<i class="layui-icon layui-icon-close" lay-event="refuse" title="退款申请拒绝"></i>
{{# }else if(d.irefundstatus == 102){ }}
<i class="layui-icon layui-icon-component" lay-event="receive" title="退款已收货"></i>
{{# }else if (d.istatus == 0 || d.istatus == 10) { }}
{{# }else if(d.istatus == 20){ }} {{# }else if(d.istatus == 20){ }}
<i class="layui-icon layui-icon-ok-circle" lay-event="deliver" title="发货"></i> <i class="layui-icon layui-icon-ok-circle" lay-event="deliver" title="发货"></i>
{{# }else if(d.istatus == 30){ }} {{# }else if(d.istatus == 30){ }}
...@@ -183,7 +189,7 @@ ...@@ -183,7 +189,7 @@
,{ ,{
title: "订单状态", title: "订单状态",
width: 100, width: 200,
templet: function(d) { templet: function(d) {
var str = ""; var str = "";
...@@ -193,7 +199,7 @@ ...@@ -193,7 +199,7 @@
if (d.ipaystatus == 1) itype = "<span class='layui-badge'>支付成功</span>"; if (d.ipaystatus == 1) itype = "<span class='layui-badge'>支付成功</span>";
if (d.ipaystatus == 2) itype = "<span class='layui-badge layui-bg-gray'>支付失败</span>"; if (d.ipaystatus == 2) itype = "<span class='layui-badge layui-bg-gray'>支付失败</span>";
str += ' <span>' + itype + '</span>'; str += ' <span>' + itype + '</span>';
//订单状态 //订单状态 10:待付款 20:待发货 30:待收货 90:已完成 99:已拒绝/关闭 100:取消
var status = ""; var status = "";
if (d.istatus == 10) status = "<span class='layui-badge layui-bg-orange'>待付款</span>"; if (d.istatus == 10) status = "<span class='layui-badge layui-bg-orange'>待付款</span>";
if (d.istatus == 20) status = "<span class='layui-badge layui-bg-orange'>待发货</span>"; if (d.istatus == 20) status = "<span class='layui-badge layui-bg-orange'>待发货</span>";
...@@ -201,15 +207,34 @@ ...@@ -201,15 +207,34 @@
if (d.istatus == 90) status = "<span class='layui-badge layui-bg-green'>已完成</span>"; if (d.istatus == 90) status = "<span class='layui-badge layui-bg-green'>已完成</span>";
if (d.istatus == 99) status = "<span class='layui-badge layui-bg-gray'>交易关闭</span>"; if (d.istatus == 99) status = "<span class='layui-badge layui-bg-gray'>交易关闭</span>";
if (d.istatus == 100) status = "<span class='layui-badge layui-bg-black'>已取消</span>"; if (d.istatus == 100) status = "<span class='layui-badge layui-bg-black'>已取消</span>";
str += ' <span>' + status + '</span>'; str += ' <span>' + status + '</span>';
// 101退款申请中 102待退货 103待退款 104退款成功
var refundStatus = "";
if (d.irefundstatus == 101) refundStatus = "<span class='layui-badge layui-bg-red'>退款申请中</span>";
if (d.irefundstatus == 102) refundStatus = "<span class='layui-badge layui-bg-orange'>待退货</span>";
if (d.irefundstatus == 103) refundStatus = "<span class='layui-badge layui-bg-orange'>待退款</span>";
if (d.irefundstatus == 104) refundStatus = "<span class='layui-badge layui-bg-green'>退款成功</span>";
if (d.irefundstatus == 105) refundStatus = "<span class='layui-badge layui-bg-cyan'>退款拒绝</span>";
str += ' <span>' + refundStatus + '</span>';
str += '</div>'; str += '</div>';
return str ? str : ""; return str ? str : "";
} }
} }
, {field: 'tordertime', width: 100, title: '下单日期'} , {field: 'tordertime', width: 100, title: '下单日期'}
, {field: 'sremark', width: 100,title: '备注'} , {field: 'sremark', width: 100,title: '备注'}
, {field: 'trefundtime', width: 100, title: '退款时间'}
,{
width: 100,
title: "退款图片",
align: "center",
templet: function(d) {
return d.srefundpic ? '<div><img id="zi' + d.id + '" src="' + d.srefundpic +
'" onmouseover="bigImg(this)" onmouseout="smallImg()" onclick="tolook(src)" style="height:20px;"></div>' :
'';
}
}
, {field: 'srefundreason', width: 100, title: '退款理由'}
, {field: 'couriernumber', width: 120, title: '退款快递单号'}
, {field: 'scusaddr', width: 100, title: '地址'} , {field: 'scusaddr', width: 100, title: '地址'}
, {field: 'scuname', width: 100, title: '联系姓名'} , {field: 'scuname', width: 100, title: '联系姓名'}
, {field: 'scuphone', width: 100, title: '联系电话'} , {field: 'scuphone', width: 100, title: '联系电话'}
...@@ -461,6 +486,77 @@ ...@@ -461,6 +486,77 @@
iframeBtn.click();//模拟iframe页面层的提交按钮点击 iframeBtn.click();//模拟iframe页面层的提交按钮点击
} }
}); });
} else if (obj.event === 'pass') {
var id = obj.data.id;
layer.confirm('确定审核通过吗?', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "refundApplicationPass",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'refuse') {
var id = obj.data.id;
layer.confirm( '确定审核拒绝吗?', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "refundApplicationRefuse",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'receive') {
var id = obj.data.id;
layer.confirm( '确定已收到退回的货物吗? 确定后将进行退款!', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "receive",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} }
}); });
} }
......
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>后台管理系统</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<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}">
<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>
<style>img {
height: 25px;
}</style>
</head>
<body>
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto my-header">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">订单编号</label>
<div class="layui-input-block">
<input type="text" name="sorderno" class="layui-input" placeholder="请输入订单编号">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">订单状态</label>
<div class="layui-input-block">
<select name="istatus" lay-filter="istatus" lay-search>
<option value="">请选择</option>
<option value="10">待付款</option>
<!--<option value="20">待发货</option>-->
<option value="30">待收货</option>
<option value="90">已完成</option>
<option value="100">已取消</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-button-btn" lay-submit lay-filter="The-search" id="The-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn">
</i>
</button>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-button-btn"
onclick="javascript:location.replace(location.href);">
<i class="layui-icon layui-icon-refresh-3 layuiadmin-button-btn">
</i>
</button>
</div>
</div>
</div>
</div>
<div class="layui-card-body">
<table class="layui-hide" id="tableId" lay-filter="tableId"></table>
</div>
</div>
</div>
<script type="text/html" id="toolbarUtil">
<div class="layui-btn-container">
<!-- <button class="layui-btn layui-btn-danger" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除-->
<!-- </button>-->
<!-- <button class="layui-btn layui-btn" lay-event="export"><i class="layui-icon layui-icon-release"></i>导出</button>-->
</div>
</script>
<script type="text/html" id="table-handle">
<i class="layui-icon layui-icon-form" lay-event="orderDetail" title="订单详情"></i>
<!-- 101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝-->
{{#if (d.irefundstatus == 101) { }}
<i class="layui-icon layui-icon-ok" lay-event="pass" title="退款申请通过"></i>
<i class="layui-icon layui-icon-close" lay-event="refuse" title="退款申请拒绝"></i>
{{# }else if(d.irefundstatus == 102){ }}
<i class="layui-icon layui-icon-component" lay-event="receive" title="退款已收货"></i>
{{# } }}
</script>
<script>
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: 'findPageRefundList'
, where: field
, 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
,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: 'sorderno', width: 200, title: '订单编号', fixed: "left"}
, {field: 'groupBuyId', width: 200, title: '活动编码'}
, {field: 'groupBuyName', width: 200, title: '活动标题'}
,{title: '用户信息',
width: 100,
templet: function(d) {
var str = "";
if(d.customer){
if (d.customer.swximgurl) {
str += "<img style='width: 18px' src=" + d.customer.swximgurl + ">&nbsp;";
}
if (d.customer.swxnick) {
str += "<span style=''>" + d.customer.swxnick ? d.customer.swxnick : '' + "</span>"
}
}
return str;
}
}
,{
title: "订单金额",
width: 150,
templet: function(d) {
var str = "";
str += '金额:<span style="color:red;"> '+(d.dactmoney ? d.dactmoney : 0)+ '</span>&nbsp';
str += '积分:<span style="color:red;"> '+(d.dactscore ? d.dactscore : 0)+ '</span>';
str += '</div>';
return str ? str : "";
}
}
,{
title: "订单状态",
width: 200,
templet: function(d) {
var str = "";
str += '<div>';
var itype = ""; //0:未支付1:支付成功2:支付失败
if (d.ipaystatus == 0) itype = "<span class='layui-badge layui-bg-gray'>未付</span>";
if (d.ipaystatus == 1) itype = "<span class='layui-badge'>支付成功</span>";
if (d.ipaystatus == 2) itype = "<span class='layui-badge layui-bg-gray'>支付失败</span>";
str += ' <span>' + itype + '</span>';
//订单状态 10:待付款 20:待发货 30:待收货 90:已完成 99:已拒绝/关闭 100:取消
var status = "";
if (d.istatus == 10) status = "<span class='layui-badge layui-bg-orange'>待付款</span>";
if (d.istatus == 20) status = "<span class='layui-badge layui-bg-orange'>待发货</span>";
if (d.istatus == 30) status = "<span class='layui-badge layui-bg-orange'>待收货</span>";
if (d.istatus == 90) status = "<span class='layui-badge layui-bg-green'>已完成</span>";
if (d.istatus == 99) status = "<span class='layui-badge layui-bg-gray'>交易关闭</span>";
if (d.istatus == 100) status = "<span class='layui-badge layui-bg-black'>已取消</span>";
str += ' <span>' + status + '</span>';
// 101退款申请中 102待退货 103待退款 104退款成功
var refundStatus = "";
if (d.irefundstatus == 101) refundStatus = "<span class='layui-badge layui-bg-red'>退款申请中</span>";
if (d.irefundstatus == 102) refundStatus = "<span class='layui-badge layui-bg-orange'>待退货</span>";
if (d.irefundstatus == 103) refundStatus = "<span class='layui-badge layui-bg-orange'>待退款</span>";
if (d.irefundstatus == 104) refundStatus = "<span class='layui-badge layui-bg-green'>退款成功</span>";
if (d.irefundstatus == 105) refundStatus = "<span class='layui-badge layui-bg-cyan'>退款拒绝</span>";
str += ' <span>' + refundStatus + '</span>';
str += '</div>';
return str ? str : "";
}
}
, {field: 'tordertime', width: 100, title: '下单日期'}
, {field: 'sremark', width: 100,title: '备注'}
, {field: 'trefundtime', width: 100, title: '退款时间'}
,{
width: 100,
title: "退款图片",
align: "center",
templet: function(d) {
return d.srefundpic ? '<div><img id="zi' + d.id + '" src="' + d.srefundpic +
'" onmouseover="bigImg(this)" onmouseout="smallImg()" onclick="tolook(src)" style="height:20px;"></div>' :
'';
}
}
, {field: 'srefundreason', width: 100, title: '退款理由'}
, {field: 'couriernumber', width: 120, title: '退款快递单号'}
, {field: 'scusaddr', width: 100, title: '地址'}
, {field: 'scuname', width: 100, title: '联系姓名'}
, {field: 'scuphone', width: 100, title: '联系电话'}
, {field: 'sprovince', width: 100, title: '省份'}
, {field: 'scity', width: 100, title: '城市'}
, {field: 'sregion', width: 100, title: '区县'}
// , {field: 'scensus', width: 100, title: '户籍'}
, {field: '', width: 130, title: '操作', toolbar: '#table-handle', fixed: "right"}
]
]
});
//头工具栏事件
table.on('toolbar(tableId)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
switch (obj.event) {
case 'export':
var href = "exportOrder?orderState=[[${orderState}]]";
if (field.orderId) {
href = href + "&orderId=" + field.orderId;
}
location.href = href;
break;
case 'del':
var data = checkStatus.data;
var id = '';
if (data.length > 0) {
for (var j = 0; j < data.length; j++) {
id = id + "," + data[j].orderId;
if (data[j].orderState == 1) {
layer.msg("不能删除已支付的订单");
return false;
} else if (data[j].orderState == 2) {
layer.msg("不能删除已发货的订单");
return false;
}
}
} else {
layer.msg("请至少选择一条数据!");
return false;
}
layer.confirm('确定彻底删除选中的数据吗?', function (index) {
$.ajax({
url: "del",
data: {"id": id},
type: "POST",
dataType: "json",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
break;
// case 'deliver':
// var data = checkStatus.data;
// var id = '';
// if (data.length > 0) {
// for (var j = 0; j < data.length; j++) {
// id = id + "," + data[j].orderId;
// }
// } else {
// layer.msg("请至少选择一条数据!");
// return false;
// }
// layer.confirm('选中的订单确定发货吗?', function (index) {
// $.ajax({
// url: "deliver",
// data: {"id": id},
// type: "POST",
// dataType: "json",
// success: function (result) {
// if (result.code == 10001) {
// layer.msg(result.msg, {icon: 6, time: 1000}, function () {
// layer.close(index);
// table.reload('tableId');
// });
// } else {
// layer.msg(result.msg, {icon: 5});
// }
// }
// });
// });
// break;
}
;
});
//监听行工具事件
table.on('tool(tableId)', function (obj) {
var data = obj.data;
if (obj.event === 'deliver') {
var id = obj.data.id;
layer.confirm( '确定接受订单吗?', function (index) {
var param = {};
param.id = id;
param.istatus = 30;
$.ajax({
url: "updateFwStatus",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'edit') {
var id = obj.data.orderId;
var w = ($(window).width() * 0.95);
var h = ($(window).height() * 0.95);
layer.open({
type: 2
, title: '修改订单'
, content: 'orderDetailEdit?orderId=' + 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页面层的提交按钮点击
}
});
}else if (obj.event === 'orderDetail') {
var id = obj.data.id;
var w = ($(window).width() * 0.95);
var h = ($(window).height() * 0.95);
layer.open({
type: 2
, title: '订单详情'
, content: 'orderDetail?orderId=' + 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页面层的提交按钮点击
// }
});
}
else if (obj.event === 'del') {
var id = obj.data.orderId;
layer.confirm('确定彻底删除选中的数据吗?', function (index) {
$.ajax({
url: "del",
data: {"id": id},
type: "POST",
dataType: "json",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'receiving') {
var id = obj.data.id;
layer.confirm( '确定完成订单吗?', function (index) {
var param = {};
param.id = id;
param.istatus = 90;
$.ajax({
url: "updateOkStatus",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'lease') {
var id = obj.data.orderId;
layer.confirm(obj.data.orderDetails + '确定开始租赁?', function (index) {
$.ajax({
url: "receiving",
data: {"orderId": id, "orderState": 3},
type: "POST",
dataType: "json",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'refund') {
var id = obj.data.orderId;
var w = ($(window).width() * 0.95);
var h = ($(window).height() * 0.95);
layer.open({
type: 2
, title: '退还押金'
, content: 'toRefund?orderId=' + 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页面层的提交按钮点击
}
});
} else if (obj.event === 'pass') {
var id = obj.data.id;
layer.confirm('确定审核通过吗?', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "refundApplicationPass",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'refuse') {
var id = obj.data.id;
layer.confirm( '确定审核拒绝吗?', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "refundApplicationRefuse",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
} else if (obj.event === 'receive') {
var id = obj.data.id;
layer.confirm( '确定已收到退回的货物吗? 确定后将进行退款!', function (index) {
var param = {};
param.id = id;
$.ajax({
url: "receive",
data: JSON.stringify(param),
type: "POST",
dataType: "json",
contentType: "application/json;charset=utf-8",
success: function (result) {
if (result.code == 100) {
layer.msg(result.msg, {icon: 6, time: 1000}, function () {
layer.close(index);
table.reload('tableId');
});
} else {
layer.msg(result.msg, {icon: 5});
}
}
});
});
}
});
}
);
function tolook(e) {
window.open(e);
}
/**
* 鼠标移入图片时, 提示弹框 (放大的图片)
*/
function bigImg(obj){
var imgUrl = obj.getAttribute("src");
var imgid = obj.getAttribute("id");
layer.tips('<img src="' + imgUrl + '"style="width:120px; height: 120rpx;">', "#" + imgid, {
tips: [1, ''],
tipsMore: false,
area: ['150px', '140px'],
time: 20000
});
}
/**
* 鼠标移出图片时, 取消弹框
*/
function smallImg(){
layer.closeAll("tips");
}
</script>
</body>
</html>
\ No newline at end of file
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