feat: web端初步完成

This commit is contained in:
2026-07-27 08:41:32 +08:00
parent 08e6d08668
commit a6a2471111
16 changed files with 1669 additions and 0 deletions
@@ -0,0 +1,62 @@
package com.budwk.app.zhgh.pointsmall.order.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallOrderPageParam;
import com.budwk.app.zhgh.pointsmall.order.service.PointsMallOrderService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
@IocBean
@Ok("json:full")
@At("/platform/zhgh/points-mall/order")
public class PointsMallOrderController {
@Inject
private PointsMallOrderService pointsMallOrderService;
@At("")
@Ok("beetl:/platform/zhgh/points-mall/order/index.html")
@SaCheckPermission("points.mall.order")
public void index() {
}
@At
@SaCheckPermission("points.mall.order")
public Result pageData(PointsMallOrderPageParam param) {
return Result.success(pointsMallOrderService.pageMain(param));
}
@At
@SaCheckPermission("points.mall.order")
public Result supplierList() {
return Result.success(pointsMallOrderService.listSuppliers());
}
@At
@SaCheckPermission("points.mall.order")
public Result subPageData(PointsMallOrderPageParam param) {
return Result.success(pointsMallOrderService.pageSub(param));
}
@At
@SaCheckPermission("points.mall.order")
public Result exchangeList(@Param("mainOrderId") String mainOrderId) {
return Result.success(pointsMallOrderService.listExchange(mainOrderId));
}
@At
@SaCheckPermission("points.mall.order")
public Result productList(@Param("orderId") String orderId) {
return Result.success(pointsMallOrderService.listSubProducts(orderId));
}
@At
@SaCheckPermission("points.mall.order")
public Result exchangeProductList(@Param("orderId") String orderId) {
return Result.success(pointsMallOrderService.listExchangeProducts(orderId));
}
}
@@ -0,0 +1,115 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_exchange")
@Comment("积分商城退换货订单")
public class PointsMallOrderExchange extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("关联主订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderMainId;
@Column
@Comment("售后订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderId;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String userId;
@Column
@Comment("应用名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String aplName;
@Column
@Comment("订单创建时间")
private Date orderCreateTime;
@Column
@Comment("订单更新时间")
private Date orderUpdateTime;
@Column
@Comment("完成时间")
private Date orderCompleteTime;
@Column
@Comment("发货状态")
private Integer deliveryStatus;
@Column
@Comment("运费")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal freightCost;
@Column
@Comment("退款")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal refund;
@Column
@Comment("物流单号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String logisticsOrderId;
@Column
@Comment("物流承运商")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String crrgBsnNm;
@Column
@Comment("订单状态")
private Integer orderState;
@Column
@Comment("订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal totalPrice;
@Column
@Comment("现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPay;
@Column
@Comment("消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pointsPrice;
@Column
@Comment("发票代码")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String invoiceCode;
@Column
@Comment("商品扩展信息JSON")
@ColDefine(type = ColType.TEXT)
private String extJson;
}
@@ -0,0 +1,128 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_main")
@Comment("积分商城主订单")
public class PointsMallOrderMain extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("主订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderId;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("订单编号")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderNumberId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String userId;
@Column
@Comment("应用名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String aplName;
@Column
@Comment("订单创建时间")
private Date orderCreateTime;
@Column
@Comment("订单更新时间")
private Date orderUpdateTime;
@Column
@Comment("发货时间")
private Date deliveryTime;
@Column
@Comment("确认收货时间")
private Date orderFinishTime;
@Column
@Comment("完成时间")
private Date orderCompleteTime;
@Column
@Comment("发货状态")
@ColDefine(type = ColType.VARCHAR, width = 20)
private String deliveryStatus;
@Column
@Comment("运费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal freightCost;
@Column
@Comment("退款积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal refund;
@Column
@Comment("物流单号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String logisticsOrderId;
@Column
@Comment("物流承运商")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String crrgBsnNm;
@Column
@Comment("订单状态")
private Integer orderState;
@Column
@Comment("订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal totalPrice;
@Column
@Comment("现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPay;
@Column
@Comment("消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pointsPrice;
@Column
@Comment("发票代码")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String invoiceCode;
@Column
@Comment("商品扩展信息JSON")
@ColDefine(type = ColType.TEXT)
private String extJson;
@Column
@Comment("现金支付状态")
private Integer cashPaid;
}
@@ -0,0 +1,146 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_sub")
@Comment("积分商城子订单")
public class PointsMallOrderSub extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("子订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderId;
@Column
@Comment("订单编号")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderNumberId;
@Column
@Comment("主订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String mainOrderId;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("用户ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String userId;
@Column
@Comment("应用名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String aplName;
@Column
@Comment("订单创建时间")
private Date orderCreateTime;
@Column
@Comment("订单更新时间")
private Date orderUpdateTime;
@Column
@Comment("发货时间")
private Date deliveryTime;
@Column
@Comment("确认收货时间")
private Date orderFinishTime;
@Column
@Comment("完成时间")
private Date orderCompleteTime;
@Column
@Comment("发货状态")
private Integer deliveryStatus;
@Column
@Comment("运费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal freightCost;
@Column
@Comment("运费现金")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPayFreightCost;
@Column
@Comment("退款积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal refund;
@Column
@Comment("退款现金")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPayRefund;
@Column
@Comment("物流单号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String logisticsOrderId;
@Column
@Comment("物流承运商")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String crrgBsnNm;
@Column
@Comment("订单状态")
private Integer orderState;
@Column
@Comment("订单总金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal totalPrice;
@Column
@Comment("现金金额")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal wPayOrAPay;
@Column
@Comment("消费积分")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal pointsPrice;
@Column
@Comment("发票代码")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String invoiceCode;
@Column
@Comment("扩展信息JSON")
@ColDefine(type = ColType.TEXT)
private String extJson;
@Column
@Comment("对账状态")
private Integer reconciliationStatus;
@Column
@Comment("开票状态")
private Integer invoiceStatus;
}
@@ -0,0 +1,58 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_order_sub_product")
@Comment("积分商城子订单商品")
public class PointsMallOrderSubProduct extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("子订单ID")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String orderSubId;
@Column
@Comment("商品SKU")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String sku;
@Column
@Comment("购买数量")
private Integer number;
@Column
@Comment("商品单价")
@ColDefine(type = ColType.FLOAT, width = 18, precision = 2)
private BigDecimal price;
@Column
@Comment("商品名称")
@ColDefine(type = ColType.VARCHAR, width = 300)
private String name;
@Column
@Comment("税率")
@ColDefine(type = ColType.FLOAT, width = 10, precision = 4)
private BigDecimal taxRate;
@Column
@Comment("商品图片信息")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String picInfo;
}
@@ -0,0 +1,98 @@
package com.budwk.app.zhgh.pointsmall.order.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_supplier")
@Comment("积分商城供应商")
public class PointsMallSupplier extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("供应商名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String supplierName;
@Column
@Comment("供应商首页跳转地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierUrl;
@Column
@Comment("供应商订单详情地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierOrderUrl;
@Column
@Comment("供应商售后订单地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierReturnOrderUrl;
@Column
@Comment("供应商接口地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierApiUrl;
@Column
@Comment("供应商图片访问地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPic;
@Column
@Comment("供应商图片文件路径")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPicPath;
@Column
@Comment("联系人信息")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String contactInfo;
@Column
@Comment("服务商编号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String sroNo;
@Column
@Comment("合作到期时间")
private Date cooperationExpTime;
@Column
@Comment("客户端ID")
@ColDefine(type = ColType.VARCHAR, width = 128)
private String clientId;
@Column
@Comment("客户端密钥")
@ColDefine(type = ColType.VARCHAR, width = 256)
private String clientSecret;
@Column
@Comment("排序号")
@Default("0")
private Integer sortCode;
@Column
@Comment("商城类型")
@Default("1")
private Integer mallType;
}
@@ -0,0 +1,17 @@
package com.budwk.app.zhgh.pointsmall.order.param;
import com.budwk.app.base.param.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class PointsMallOrderPageParam extends PageForm {
private String supplierId;
private String orderId;
private String userId;
private String orderState;
private String logisticsOrderId;
private String mainOrderId;
}
@@ -0,0 +1,25 @@
package com.budwk.app.zhgh.pointsmall.order.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.pointsmall.order.models.PointsMallOrderMain;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallOrderPageParam;
import org.nutz.dao.entity.Record;
import java.util.List;
public interface PointsMallOrderService extends BaseService<PointsMallOrderMain> {
Pagination<Record> pageMain(PointsMallOrderPageParam param);
Pagination<Record> pageSub(PointsMallOrderPageParam param);
List<Record> listExchange(String mainOrderId);
List<Record> listSubProducts(String orderId);
List<Record> listExchangeProducts(String orderId);
List<PointsMallSupplier> listSuppliers();
}
@@ -0,0 +1,98 @@
package com.budwk.app.zhgh.pointsmall.order.service.impl;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.pointsmall.order.models.PointsMallOrderMain;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.order.param.PointsMallOrderPageParam;
import com.budwk.app.zhgh.pointsmall.order.service.PointsMallOrderService;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.entity.Record;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.Sqls;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class PointsMallOrderServiceImpl extends BaseServiceImpl<PointsMallOrderMain> implements PointsMallOrderService {
public PointsMallOrderServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination<Record> pageMain(PointsMallOrderPageParam param) {
Cnd cnd = Cnd.where("m.delFlag", "=", false);
if (StrUtil.isNotBlank(param.getSupplierId())) {
cnd.and("m.supplierId", "=", param.getSupplierId());
}
if (StrUtil.isNotBlank(param.getOrderId())) {
cnd.and("m.orderId", "like", "%" + param.getOrderId() + "%");
}
if (StrUtil.isNotBlank(param.getUserId())) {
cnd.and("m.userId", "like", "%" + param.getUserId() + "%");
}
if (StrUtil.isNotBlank(param.getOrderState())) {
cnd.and("m.orderState", "=", param.getOrderState());
}
if (StrUtil.isNotBlank(param.getLogisticsOrderId())) {
cnd.and("m.logisticsOrderId", "like", "%" + param.getLogisticsOrderId() + "%");
}
cnd.desc("m.orderCreateTime");
Sql sql = Sqls.create("select m.*, s.supplierName from points_mall_order_main m left join points_mall_supplier s on m.supplierId = s.supplierId and s.delFlag = 0 $condition");
sql.setCondition(cnd);
return listPageMap(param.getPageNumber(), param.getPageSize(), sql);
}
@Override
public Pagination<Record> pageSub(PointsMallOrderPageParam param) {
Cnd cnd = Cnd.where("o.delFlag", "=", false);
if (StrUtil.isNotBlank(param.getMainOrderId())) {
cnd.and("o.mainOrderId", "=", param.getMainOrderId());
}
if (StrUtil.isNotBlank(param.getOrderState())) {
cnd.and("o.orderState", "=", param.getOrderState());
}
cnd.desc("o.orderCreateTime");
Sql sql = Sqls.create("select o.*, s.supplierName from points_mall_order_sub o left join points_mall_supplier s on o.supplierId = s.supplierId and s.delFlag = 0 $condition");
sql.setCondition(cnd);
return listPageMap(param.getPageNumber(), param.getPageSize(), sql);
}
@Override
public List<Record> listExchange(String mainOrderId) {
Cnd cnd = Cnd.where("e.delFlag", "=", false);
if (StrUtil.isNotBlank(mainOrderId)) {
cnd.and("e.orderMainId", "=", mainOrderId);
}
cnd.desc("e.orderCreateTime");
Sql sql = Sqls.create("select e.*, s.supplierName from points_mall_order_exchange e left join points_mall_supplier s on e.supplierId = s.supplierId and s.delFlag = 0 $condition");
sql.setCondition(cnd);
return list(sql);
}
@Override
public List<Record> listSubProducts(String orderId) {
Cnd cnd = Cnd.where("delFlag", "=", false);
if (StrUtil.isNotBlank(orderId)) {
cnd.and("orderSubId", "=", orderId);
}
cnd.asc("createdAt");
Sql sql = Sqls.create("select * from points_mall_order_sub_product $condition");
sql.setCondition(cnd);
return list(sql);
}
@Override
public List<Record> listExchangeProducts(String orderId) {
return listSubProducts(orderId);
}
@Override
public List<PointsMallSupplier> listSuppliers() {
return dao().query(PointsMallSupplier.class, Cnd.where("delFlag", "=", false).asc("sortCode"));
}
}
@@ -0,0 +1,104 @@
package com.budwk.app.zhgh.pointsmall.supplier.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.result.Result;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.supplier.param.PointsMallSupplierPageParam;
import com.budwk.app.zhgh.pointsmall.supplier.service.PointsMallSupplierService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
import org.nutz.mvc.annotation.Param;
import java.util.List;
@IocBean
@Ok("json:full")
@At("/platform/zhgh/points-mall/supplier")
public class PointsMallSupplierController {
@Inject
private PointsMallSupplierService pointsMallSupplierService;
@At("")
@Ok("beetl:/platform/zhgh/points-mall/supplier/index.html")
@SaCheckPermission("points.mall.supplier")
public void index() {
}
@At
@SaCheckPermission("points.mall.supplier")
public Result pageData(PointsMallSupplierPageParam param) {
return Result.success(pointsMallSupplierService.page(param));
}
@At
@SLog(tag = "积分商城供应商管理", msg = "新增供应商")
@SaCheckPermission("points.mall.supplier")
public Result doAdd(PointsMallSupplier supplier) {
Result check = checkSupplier(supplier, false);
if (!check.isSuccess()) {
return check;
}
if (pointsMallSupplierService.existsSupplierId(supplier.getSupplierId(), null)) {
return Result.error("供应商编码已存在");
}
pointsMallSupplierService.insert(supplier);
return Result.success();
}
@At
@SLog(tag = "积分商城供应商管理", msg = "编辑供应商")
@SaCheckPermission("points.mall.supplier")
public Result doEdit(PointsMallSupplier supplier) {
if (StrUtil.isBlank(supplier.getId())) {
return Result.error("ID不能为空");
}
Result check = checkSupplier(supplier, true);
if (!check.isSuccess()) {
return check;
}
if (pointsMallSupplierService.existsSupplierId(supplier.getSupplierId(), supplier.getId())) {
return Result.error("供应商编码已存在");
}
pointsMallSupplierService.updateIgnoreNull(supplier);
return Result.success();
}
@At
@SLog(tag = "积分商城供应商管理", msg = "删除供应商")
@SaCheckPermission("points.mall.supplier")
public Result doDelete(@Param("ids") String ids) {
List<String> idList = StrUtil.split(ids, ',');
if (idList.isEmpty()) {
return Result.error("请选择需要删除的数据");
}
pointsMallSupplierService.deleteByIds(idList);
return Result.success();
}
private Result checkSupplier(PointsMallSupplier supplier, boolean update) {
if (supplier == null) {
return Result.error("供应商信息不能为空");
}
if (update && StrUtil.isBlank(supplier.getId())) {
return Result.error("ID不能为空");
}
if (StrUtil.isBlank(supplier.getSupplierId())) {
return Result.error("供应商编码不能为空");
}
if (StrUtil.isBlank(supplier.getSupplierName())) {
return Result.error("供应商名称不能为空");
}
if (supplier.getMallType() == null) {
return Result.error("商城类型不能为空");
}
if (supplier.getSortCode() == null) {
supplier.setSortCode(99);
}
return Result.success();
}
}
@@ -0,0 +1,98 @@
package com.budwk.app.zhgh.pointsmall.supplier.models;
import com.budwk.app.base.model.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import java.io.Serializable;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Table("points_mall_supplier")
@Comment("积分商城供应商")
public class PointsMallSupplier extends BaseModel implements Serializable {
@Name
@Column
@Comment("ID")
@ColDefine(type = ColType.VARCHAR, width = 32)
@PrevInsert(uu32 = true)
private String id;
@Column
@Comment("供应商编码")
@ColDefine(type = ColType.VARCHAR, width = 64)
private String supplierId;
@Column
@Comment("供应商名称")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String supplierName;
@Column
@Comment("供应商首页跳转地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierUrl;
@Column
@Comment("供应商订单详情地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierOrderUrl;
@Column
@Comment("供应商售后订单地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierReturnOrderUrl;
@Column
@Comment("供应商接口地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierApiUrl;
@Column
@Comment("供应商图片访问地址")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPic;
@Column
@Comment("供应商图片文件路径")
@ColDefine(type = ColType.VARCHAR, width = 1000)
private String supplierPicPath;
@Column
@Comment("联系人信息")
@ColDefine(type = ColType.VARCHAR, width = 500)
private String contactInfo;
@Column
@Comment("服务商编号")
@ColDefine(type = ColType.VARCHAR, width = 100)
private String sroNo;
@Column
@Comment("合作到期时间")
private Date cooperationExpTime;
@Column
@Comment("客户端ID")
@ColDefine(type = ColType.VARCHAR, width = 128)
private String clientId;
@Column
@Comment("客户端密钥")
@ColDefine(type = ColType.VARCHAR, width = 256)
private String clientSecret;
@Column
@Comment("排序号")
@Default("0")
private Integer sortCode;
@Column
@Comment("商城类型")
@Default("1")
private Integer mallType;
}
@@ -0,0 +1,13 @@
package com.budwk.app.zhgh.pointsmall.supplier.param;
import com.budwk.app.base.param.PageForm;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
public class PointsMallSupplierPageParam extends PageForm {
private String supplierName;
private Integer mallType;
}
@@ -0,0 +1,17 @@
package com.budwk.app.zhgh.pointsmall.supplier.service;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.BaseService;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.supplier.param.PointsMallSupplierPageParam;
import java.util.List;
public interface PointsMallSupplierService extends BaseService<PointsMallSupplier> {
Pagination<PointsMallSupplier> page(PointsMallSupplierPageParam param);
boolean existsSupplierId(String supplierId, String excludeId);
void deleteByIds(List<String> ids);
}
@@ -0,0 +1,53 @@
package com.budwk.app.zhgh.pointsmall.supplier.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
import com.budwk.app.zhgh.pointsmall.supplier.param.PointsMallSupplierPageParam;
import com.budwk.app.zhgh.pointsmall.supplier.service.PointsMallSupplierService;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import java.util.List;
@IocBean(args = {"refer:dao"})
public class PointsMallSupplierServiceImpl extends BaseServiceImpl<PointsMallSupplier> implements PointsMallSupplierService {
public PointsMallSupplierServiceImpl(Dao dao) {
super(dao);
}
@Override
public Pagination<PointsMallSupplier> page(PointsMallSupplierPageParam param) {
Cnd cnd = Cnd.where("delFlag", "=", false);
if (StrUtil.isNotBlank(param.getSupplierName())) {
cnd.and("supplierName", "like", "%" + param.getSupplierName() + "%");
}
if (param.getMallType() != null) {
cnd.and("mallType", "=", param.getMallType());
}
cnd.asc("sortCode");
return listPage(param.getPageNumber(), param.getPageSize(), PointsMallSupplier.class, cnd);
}
@Override
public boolean existsSupplierId(String supplierId, String excludeId) {
Cnd cnd = Cnd.where("supplierId", "=", supplierId).and("delFlag", "=", false);
if (StrUtil.isNotBlank(excludeId)) {
cnd.and("id", "!=", excludeId);
}
return dao().count(PointsMallSupplier.class, cnd) > 0;
}
@Override
public void deleteByIds(List<String> ids) {
if (CollUtil.isEmpty(ids)) {
return;
}
dao().update(PointsMallSupplier.class, Chain.make("delFlag", true), Cnd.where("id", "in", ids));
}
}
@@ -0,0 +1,314 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="供应商">
<el-select clearable filterable placeholder="请选择供应商" style="width: 100%" v-model="pageForm.supplierId">
<el-option :key="item.supplierId" :label="item.supplierName" :value="item.supplierId" v-for="item in supplierList"></el-option>
</el-select>
</search-item>
<search-item label="订单号">
<el-input clearable placeholder="请输入订单号" v-model="pageForm.orderId"></el-input>
</search-item>
<search-item label="工号">
<el-input clearable placeholder="请输入工号" v-model="pageForm.userId"></el-input>
</search-item>
<search-item label="订单状态">
<el-select clearable placeholder="请选择订单状态" style="width: 100%" v-model="pageForm.orderState">
<el-option :key="item.value" :label="item.label" :value="item.value" v-for="item in orderStateOptions"></el-option>
</el-select>
</search-item>
<search-item label="物流单号">
<el-input clearable placeholder="请输入物流单号" v-model="pageForm.logisticsOrderId"></el-input>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="积分商城订单列表"></table-tool>
<el-table :data="tableData" border class="vi-table" size="small" style="width: 100%" v-loading="tableLoading">
<el-table-column :index="indexMethod" align="center" label="序号" type="index" width="70"></el-table-column>
<el-table-column align="center" label="订单号" min-width="160" prop="orderId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="订单编码" min-width="150" prop="orderNumberId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="工号" min-width="120" prop="userId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="供应商" min-width="140" prop="supplierName" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="应用名称" min-width="120" prop="aplName" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="创建时间" min-width="160" prop="orderCreateTime" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="订单状态" min-width="110">
<template slot-scope="{row}">
<el-tag :type="orderStatusType(row.orderState)" size="mini">{{ orderStateName(row.orderState) }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="订单总金额" min-width="110" prop="totalPrice"></el-table-column>
<el-table-column align="center" label="现金金额" min-width="110">
<template slot-scope="{row}">{{ row.wPayOrAPay || "-" }}</template>
</el-table-column>
<el-table-column align="center" label="消费积分" min-width="110" prop="pointsPrice"></el-table-column>
<el-table-column align="center" label="现金支付" min-width="120">
<template slot-scope="{row}">{{ cashPaidName(row.cashPaid) }}</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="100">
<template slot-scope="{row}">
<el-button @click="openSubOrders(row)" size="mini" type="primary">查看</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="pageForm.pageNumber"
:page-size="pageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="pageChange"
@size-change="sizeChange"
layout="total, sizes, prev, pager, next"
style="margin-top: 16px; text-align: right"
></el-pagination>
</el-card>
<el-dialog :close-on-click-modal="false" :title="'子订单详情 - ' + currentMainOrderId" :visible.sync="subDialogVisible" top="5vh" width="88%">
<el-table :data="subOrderList" border size="small" style="width: 100%" v-loading="subLoading">
<el-table-column align="center" label="子订单号" min-width="170" prop="orderId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="订单编码" min-width="150" prop="orderNumberId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="供应商" min-width="130" prop="supplierName" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="工号" min-width="110" prop="userId"></el-table-column>
<el-table-column align="center" label="创建时间" min-width="160" prop="orderCreateTime"></el-table-column>
<el-table-column align="center" label="订单状态" min-width="100">
<template slot-scope="{row}">
<el-tag :type="orderStatusType(row.orderState)" size="mini">{{ orderStateName(row.orderState) }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="消费积分" min-width="100" prop="pointsPrice"></el-table-column>
<el-table-column align="center" label="物流单号" min-width="140" prop="logisticsOrderId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="发票代码" min-width="120" prop="invoiceCode" show-overflow-tooltip></el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="180">
<template slot-scope="{row}">
<el-button @click="openProducts(row, false)" size="mini">商品</el-button>
<el-button @click="openExchange(row)" size="mini" type="warning">售后</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="subPageForm.pageNumber"
:page-size="subPageForm.pageSize"
:total="subPageForm.totalCount"
@current-change="subPageChange"
layout="total, prev, pager, next"
style="margin-top: 16px; text-align: right"
></el-pagination>
<span slot="footer">
<el-button @click="subDialogVisible = false">关闭</el-button>
</span>
</el-dialog>
<el-dialog :close-on-click-modal="false" :title="productDialogTitle" :visible.sync="productDialogVisible" width="72%">
<el-table :data="productList" border size="small" v-loading="productLoading">
<el-table-column align="center" label="商品名称" min-width="220" prop="name" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="SKU" min-width="140" prop="sku" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="数量" width="90" prop="number"></el-table-column>
<el-table-column align="center" label="单价" width="110" prop="price"></el-table-column>
<el-table-column align="center" label="税率" width="110" prop="taxRate"></el-table-column>
<el-table-column align="center" label="图片信息" min-width="180" prop="picInfo" show-overflow-tooltip></el-table-column>
</el-table>
<span slot="footer">
<el-button @click="productDialogVisible = false">关闭</el-button>
</span>
</el-dialog>
<el-dialog :close-on-click-modal="false" :title="'售后单 - ' + currentSubOrderId" :visible.sync="exchangeDialogVisible" width="82%">
<el-table :data="exchangeList" border size="small" v-loading="exchangeLoading">
<el-table-column align="center" label="售后订单号" min-width="170" prop="orderId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="供应商" min-width="130" prop="supplierName" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="工号" min-width="110" prop="userId"></el-table-column>
<el-table-column align="center" label="创建时间" min-width="160" prop="orderCreateTime"></el-table-column>
<el-table-column align="center" label="状态" min-width="100">
<template slot-scope="{row}">
<el-tag :type="orderStatusType(row.orderState)" size="mini">{{ orderStateName(row.orderState) }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="退款" width="100" prop="refund"></el-table-column>
<el-table-column align="center" label="消费积分" width="110" prop="pointsPrice"></el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="100">
<template slot-scope="{row}">
<el-button @click="openProducts(row, true)" size="mini">商品</el-button>
</template>
</el-table-column>
</el-table>
<span slot="footer">
<el-button @click="exchangeDialogVisible = false">关闭</el-button>
</span>
</el-dialog>
</div>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
supplierList: [],
tableData: [],
tableLoading: false,
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
supplierId: null,
orderId: null,
userId: null,
orderState: null,
logisticsOrderId: null
},
subDialogVisible: false,
subLoading: false,
currentMainOrderId: null,
subOrderList: [],
subPageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0
},
productDialogVisible: false,
productDialogTitle: "商品明细",
productLoading: false,
productList: [],
exchangeDialogVisible: false,
exchangeLoading: false,
currentSubOrderId: null,
exchangeList: [],
orderStateOptions: [
{ value: "0", label: "待付款" },
{ value: "1", label: "已支付" },
{ value: "2", label: "进行中" },
{ value: "3", label: "已取消" },
{ value: "4", label: "已签收" },
{ value: "5", label: "已完成" },
{ value: "6", label: "换货" },
{ value: "7", label: "退货" },
{ value: "8", label: "已废除" }
]
}
},
methods: {
indexMethod(index) {
return index + 1 + (this.pageForm.pageNumber - 1) * this.pageForm.pageSize
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
async pageData() {
this.tableLoading = true
const resp = await this.$axios.post(loc() + "/pageData", this.pageForm)
this.tableLoading = false
if (resp.code === 0) {
this.tableData = resp.data.list || []
this.pageForm.totalCount = resp.data.totalCount || 0
} else {
this.notifyWarning(resp.msg)
}
},
pageChange(val) {
this.pageForm.pageNumber = val
this.pageData()
},
sizeChange(val) {
this.pageForm.pageSize = val
this.pageForm.pageNumber = 1
this.pageData()
},
async loadSuppliers() {
const resp = await this.$axios.post(loc() + "/supplierList")
if (resp.code === 0) {
this.supplierList = resp.data || []
}
},
openSubOrders(row) {
this.currentMainOrderId = row.orderId
this.subPageForm.pageNumber = 1
this.subDialogVisible = true
this.subPageData()
},
async subPageData() {
this.subLoading = true
const resp = await this.$axios.post(loc() + "/subPageData", {
pageNumber: this.subPageForm.pageNumber,
pageSize: this.subPageForm.pageSize,
mainOrderId: this.currentMainOrderId
})
this.subLoading = false
if (resp.code === 0) {
this.subOrderList = resp.data.list || []
this.subPageForm.totalCount = resp.data.totalCount || 0
} else {
this.notifyWarning(resp.msg)
}
},
subPageChange(val) {
this.subPageForm.pageNumber = val
this.subPageData()
},
async openProducts(row, exchange) {
this.productDialogTitle = (exchange ? "售后单商品明细 - " : "子订单商品明细 - ") + row.orderId
this.productDialogVisible = true
this.productLoading = true
const resp = await this.$axios.post(loc() + (exchange ? "/exchangeProductList" : "/productList"), { orderId: row.orderId })
this.productLoading = false
if (resp.code === 0) {
this.productList = resp.data || []
} else {
this.notifyWarning(resp.msg)
}
},
async openExchange(row) {
this.currentSubOrderId = row.orderId
this.exchangeDialogVisible = true
this.exchangeLoading = true
const resp = await this.$axios.post(loc() + "/exchangeList", { mainOrderId: row.orderId })
this.exchangeLoading = false
if (resp.code === 0) {
this.exchangeList = resp.data || []
} else {
this.notifyWarning(resp.msg)
}
},
orderStateName(value) {
const item = this.orderStateOptions.find((v) => String(v.value) === String(value))
return item ? item.label : "-"
},
orderStatusType(value) {
const map = {
0: "info",
1: "primary",
2: "warning",
3: "danger",
4: "primary",
5: "success",
6: "warning",
7: "danger",
8: "info"
}
return map[value] || "info"
},
cashPaidName(value) {
const map = {
0: "不涉及",
1: "待现金支付",
2: "已现金支付",
3: "取消现金支付"
}
return map[value] || "-"
}
},
created() {
this.loadSuppliers()
this.pageData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,323 @@
<!--#
layout("/layouts/platform.html"){
#-->
<div id="app" v-cloak>
<el-card shadow="never">
<search @search="doSearch">
<search-item label="供应商名称">
<el-input clearable placeholder="请输入供应商名称" v-model="pageForm.supplierName"></el-input>
</search-item>
<search-item label="商城类型">
<el-select clearable placeholder="请选择商城类型" style="width: 100%" v-model="pageForm.mallType">
<el-option :value="1" label="积分商城"></el-option>
<el-option :value="2" label="观影商城"></el-option>
</el-select>
</search-item>
</search>
</el-card>
<el-card class="mt10" shadow="never">
<table-tool label="供应商列表">
<el-button @click="openAdd" icon="el-icon-plus" size="small" type="primary">新建</el-button>
<el-button @click="deleteSelected" icon="el-icon-delete" size="small" type="danger">删除</el-button>
</table-tool>
<el-table
:data="tableData"
@selection-change="handleSelectionChange"
border
class="vi-table"
ref="multipleTable"
size="small"
style="width: 100%"
v-loading="tableLoading"
>
<el-table-column type="selection" width="50"></el-table-column>
<el-table-column :index="indexMethod" align="center" label="序号" type="index" width="70"></el-table-column>
<el-table-column align="center" label="供应商ID" min-width="110" prop="supplierId" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="供应商名称" min-width="140" prop="supplierName" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="商城类型" min-width="100">
<template slot-scope="{row}">
<el-tag size="mini" :type="row.mallType === 1 ? 'success' : 'warning'">{{ mallTypeName(row.mallType) }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="首页链接" min-width="180" prop="supplierUrl" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="订单链接" min-width="180" prop="supplierOrderUrl" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="售后订单链接" min-width="180" prop="supplierReturnOrderUrl" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="API链接" min-width="180" prop="supplierApiUrl" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="场景号" min-width="110" prop="sroNo" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="合作到期" min-width="160" prop="cooperationExpTime" show-overflow-tooltip></el-table-column>
<el-table-column align="center" label="排序" width="80" prop="sortCode"></el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="150">
<template slot-scope="{row}">
<el-button @click="openEdit(row)" size="mini" type="primary">修改</el-button>
<el-button @click="deleteRows([row])" size="mini" type="danger">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="pageForm.pageNumber"
:page-size="pageForm.pageSize"
:page-sizes="[10, 20, 30, 50]"
:total="pageForm.totalCount"
@current-change="pageChange"
@size-change="sizeChange"
layout="total, sizes, prev, pager, next"
style="margin-top: 16px; text-align: right"
></el-pagination>
</el-card>
<el-dialog :close-on-click-modal="false" :title="formData.id ? '修改供应商' : '新增供应商'" :visible.sync="editDialogVisible" width="760px">
<el-form :model="formData" :rules="rules" label-width="130px" ref="form">
<el-row :gutter="18">
<el-col :span="12">
<el-form-item label="供应商ID" prop="supplierId">
<el-input maxlength="64" placeholder="请输入供应商ID" v-model="formData.supplierId"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="供应商名称" prop="supplierName">
<el-input maxlength="100" placeholder="请输入供应商名称" v-model="formData.supplierName"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商城类型" prop="mallType">
<el-select placeholder="请选择商城类型" style="width: 100%" v-model="formData.mallType">
<el-option :value="1" label="积分商城"></el-option>
<el-option :value="2" label="观影商城"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排序" prop="sortCode">
<el-input-number :min="0" controls-position="right" style="width: 100%" v-model="formData.sortCode"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="首页链接" prop="supplierUrl">
<el-input maxlength="1000" placeholder="请输入首页链接" v-model="formData.supplierUrl"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="订单链接" prop="supplierOrderUrl">
<el-input maxlength="1000" placeholder="请输入订单详情链接" v-model="formData.supplierOrderUrl"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="售后订单链接" prop="supplierReturnOrderUrl">
<el-input maxlength="1000" placeholder="请输入售后订单链接" v-model="formData.supplierReturnOrderUrl"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="API链接" prop="supplierApiUrl">
<el-input maxlength="1000" placeholder="请输入供应商API地址" v-model="formData.supplierApiUrl"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="场景号" prop="sroNo">
<el-input maxlength="100" placeholder="请输入场景号" v-model="formData.sroNo"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合作到期时间" prop="cooperationExpTime">
<el-date-picker
placeholder="请选择合作到期时间"
style="width: 100%"
type="datetime"
value-format="yyyy-MM-dd HH:mm:ss"
v-model="formData.cooperationExpTime"
></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户端ID" prop="clientId">
<el-input maxlength="128" placeholder="请输入客户端ID" v-model="formData.clientId"></el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="客户端密钥" prop="clientSecret">
<el-input maxlength="256" placeholder="请输入客户端密钥" show-password v-model="formData.clientSecret"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="图片地址" prop="supplierPic">
<el-input maxlength="1000" placeholder="请输入供应商图片地址" v-model="formData.supplierPic"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="图片文件路径" prop="supplierPicPath">
<el-input maxlength="1000" placeholder="请输入供应商图片文件路径" v-model="formData.supplierPicPath"></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="联系信息" prop="contactInfo">
<el-input maxlength="500" placeholder="请输入联系信息" v-model="formData.contactInfo"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer">
<el-button @click="editDialogVisible = false">取消</el-button>
<el-button :loading="submitLoading" @click="submitForm" type="primary">保存</el-button>
</span>
</el-dialog>
</div>
<script nonce="${cspNonce!}">
new Vue({
el: "#app",
mixins: [initTableMixins],
data() {
return {
tableData: [],
tableLoading: false,
submitLoading: false,
multipleSelection: [],
editDialogVisible: false,
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
supplierName: null,
mallType: null
},
formData: this.defaultForm(),
rules: {
supplierId: [{ required: true, message: "请输入供应商ID", trigger: ["change", "blur"] }],
supplierName: [{ required: true, message: "请输入供应商名称", trigger: ["change", "blur"] }],
mallType: [{ required: true, message: "请选择商城类型", trigger: ["change", "blur"] }],
sortCode: [{ required: true, message: "请输入排序", trigger: ["change", "blur"] }]
}
}
},
methods: {
defaultForm() {
return {
id: null,
supplierId: null,
supplierName: null,
supplierUrl: null,
supplierOrderUrl: null,
supplierReturnOrderUrl: null,
supplierApiUrl: null,
supplierPic: null,
supplierPicPath: null,
contactInfo: null,
sroNo: null,
cooperationExpTime: null,
clientId: null,
clientSecret: null,
sortCode: 99,
mallType: 1
}
},
indexMethod(index) {
return index + 1 + (this.pageForm.pageNumber - 1) * this.pageForm.pageSize
},
doSearch() {
this.pageForm.pageNumber = 1
this.pageData()
},
async pageData() {
this.tableLoading = true
const resp = await this.$axios.post(loc() + "/pageData", this.pageForm)
this.tableLoading = false
if (resp.code === 0) {
this.tableData = resp.data.list || []
this.pageForm.totalCount = resp.data.totalCount || 0
} else {
this.notifyWarning(resp.msg)
}
},
pageChange(val) {
this.pageForm.pageNumber = val
this.pageData()
},
sizeChange(val) {
this.pageForm.pageSize = val
this.pageForm.pageNumber = 1
this.pageData()
},
handleSelectionChange(val) {
this.multipleSelection = val
},
openAdd() {
this.formData = this.defaultForm()
this.editDialogVisible = true
this.$nextTick(() => {
this.$refs.form && this.$refs.form.clearValidate()
})
},
openEdit(row) {
this.formData = Object.assign(this.defaultForm(), row)
this.editDialogVisible = true
this.$nextTick(() => {
this.$refs.form && this.$refs.form.clearValidate()
})
},
submitForm() {
this.$refs.form.validate(async (valid) => {
if (!valid) {
return
}
this.submitLoading = true
const url = this.formData.id ? "/doEdit" : "/doAdd"
const resp = await this.$axios.post(loc() + url, this.formData)
this.submitLoading = false
if (resp.code === 0) {
this.$message.success(resp.msg)
this.editDialogVisible = false
this.pageData()
} else {
this.notifyWarning(resp.msg)
}
})
},
deleteSelected() {
if (!this.multipleSelection.length) {
this.$message.warning("请至少选择一条数据")
return
}
this.deleteRows(this.multipleSelection)
},
deleteRows(rows) {
const names = rows.map((row) => row.supplierName).join("、")
this.$confirm("确定删除供应商“" + names + "”吗?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
callback: async (action) => {
if (action !== "confirm") {
return
}
const resp = await this.$axios.post(loc() + "/doDelete", {
ids: rows.map((row) => row.id).join(",")
})
if (resp.code === 0) {
this.$message.success(resp.msg)
this.pageData()
} else {
this.notifyWarning(resp.msg)
}
}
})
},
mallTypeName(type) {
if (type === 1) {
return "积分商城"
}
if (type === 2) {
return "观影商城"
}
return "-"
}
},
created() {
this.pageData()
}
})
</script>
<!--#
}
#-->