增加了退款流程

This commit is contained in:
mactj 2021-01-22 10:54:01 +08:00
parent 6a1931ae80
commit be8f6b7576
14 changed files with 351 additions and 142 deletions

View File

@ -18,6 +18,7 @@ import com.ruoyi.winery.domain.AppOrder;
import com.ruoyi.winery.domain.goods.GoodsMain; import com.ruoyi.winery.domain.goods.GoodsMain;
import com.ruoyi.winery.service.IAppOrderService; import com.ruoyi.winery.service.IAppOrderService;
import com.ruoyi.winery.service.IGoodsMainService; import com.ruoyi.winery.service.IGoodsMainService;
import com.ruoyi.winery.vo.AppRequestRefundDetailVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -49,7 +50,7 @@ import static com.ruoyi.common.core.domain.AjaxResult.error;
*/ */
@RequiredArgsConstructor(onConstructor_ = @Autowired) @RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController @RestController
@RequestMapping("/winery/detail" ) @RequestMapping("/winery/detail")
public class AppOrderDetailController extends BaseController { public class AppOrderDetailController extends BaseController {
private final IAppOrderDetailService iAppOrderDetailService; private final IAppOrderDetailService iAppOrderDetailService;
@ -68,34 +69,34 @@ public class AppOrderDetailController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('winery:detail:list')") @PreAuthorize("@ss.hasPermi('winery:detail:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(AppOrderDetail appOrderDetail) public TableDataInfo list(AppOrderDetail appOrderDetail) {
{
startPage(); startPage();
LambdaQueryWrapper<AppOrderDetail> lqw = Wrappers.lambdaQuery(appOrderDetail); LambdaQueryWrapper<AppOrderDetail> lqw = Wrappers.lambdaQuery(appOrderDetail);
if (appOrderDetail.getDeptId() != null){ if (appOrderDetail.getDeptId() != null) {
lqw.eq(AppOrderDetail::getDeptId ,appOrderDetail.getDeptId()); lqw.eq(AppOrderDetail::getDeptId, appOrderDetail.getDeptId());
} }
if (appOrderDetail.getUserId() != null){ if (appOrderDetail.getUserId() != null) {
lqw.eq(AppOrderDetail::getUserId ,appOrderDetail.getUserId()); lqw.eq(AppOrderDetail::getUserId, appOrderDetail.getUserId());
} }
if (StringUtils.isNotBlank(appOrderDetail.getOrderId())){ if (StringUtils.isNotBlank(appOrderDetail.getOrderId())) {
lqw.eq(AppOrderDetail::getOrderId ,appOrderDetail.getOrderId()); lqw.eq(AppOrderDetail::getOrderId, appOrderDetail.getOrderId());
} }
if (StringUtils.isNotBlank(appOrderDetail.getGoodsId())){ if (StringUtils.isNotBlank(appOrderDetail.getGoodsId())) {
lqw.eq(AppOrderDetail::getGoodsId ,appOrderDetail.getGoodsId()); lqw.eq(AppOrderDetail::getGoodsId, appOrderDetail.getGoodsId());
} }
if (appOrderDetail.getGoodsCount() != null){ if (appOrderDetail.getGoodsCount() != null) {
lqw.eq(AppOrderDetail::getGoodsCount ,appOrderDetail.getGoodsCount()); lqw.eq(AppOrderDetail::getGoodsCount, appOrderDetail.getGoodsCount());
} }
if (appOrderDetail.getStatus() != null){ if (appOrderDetail.getStatus() != null) {
lqw.eq(AppOrderDetail::getStatus ,appOrderDetail.getStatus()); lqw.eq(AppOrderDetail::getStatus, appOrderDetail.getStatus());
} }
if (StringUtils.isNotBlank(appOrderDetail.getRefundNo())){ if (StringUtils.isNotBlank(appOrderDetail.getRefundNo())) {
lqw.eq(AppOrderDetail::getRefundNo ,appOrderDetail.getRefundNo()); lqw.eq(AppOrderDetail::getRefundNo, appOrderDetail.getRefundNo());
} }
if (appOrderDetail.getRefundTime() != null){ if (appOrderDetail.getRefundTime() != null) {
lqw.eq(AppOrderDetail::getRefundTime ,appOrderDetail.getRefundTime()); lqw.eq(AppOrderDetail::getRefundTime, appOrderDetail.getRefundTime());
} }
lqw.orderByDesc(AppOrderDetail::getCreateTime);
List<AppOrderDetail> list = iAppOrderDetailService.list(lqw); List<AppOrderDetail> list = iAppOrderDetailService.list(lqw);
for (AppOrderDetail detail : list) { for (AppOrderDetail detail : list) {
detail.setGoods(goodsMainService.getById(detail.getGoodsId())); detail.setGoods(goodsMainService.getById(detail.getGoodsId()));
@ -106,22 +107,22 @@ public class AppOrderDetailController extends BaseController {
/** /**
* 导出订单明细列表 * 导出订单明细列表
*/ */
@PreAuthorize("@ss.hasPermi('winery:detail:export')" ) @PreAuthorize("@ss.hasPermi('winery:detail:export')")
@Log(title = "订单明细" , businessType = BusinessType.EXPORT) @Log(title = "订单明细", businessType = BusinessType.EXPORT)
@GetMapping("/export" ) @GetMapping("/export")
public AjaxResult export(AppOrderDetail appOrderDetail) { public AjaxResult export(AppOrderDetail appOrderDetail) {
LambdaQueryWrapper<AppOrderDetail> lqw = new LambdaQueryWrapper<AppOrderDetail>(appOrderDetail); LambdaQueryWrapper<AppOrderDetail> lqw = new LambdaQueryWrapper<AppOrderDetail>(appOrderDetail);
List<AppOrderDetail> list = iAppOrderDetailService.list(lqw); List<AppOrderDetail> list = iAppOrderDetailService.list(lqw);
ExcelUtil<AppOrderDetail> util = new ExcelUtil<AppOrderDetail>(AppOrderDetail. class); ExcelUtil<AppOrderDetail> util = new ExcelUtil<AppOrderDetail>(AppOrderDetail.class);
return util.exportExcel(list, "detail" ); return util.exportExcel(list, "detail");
} }
/** /**
* 获取订单明细详细信息 * 获取订单明细详细信息
*/ */
@PreAuthorize("@ss.hasPermi('winery:detail:query')" ) @PreAuthorize("@ss.hasPermi('winery:detail:query')")
@GetMapping(value = "/{id}" ) @GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id" ) String id) { public AjaxResult getInfo(@PathVariable("id") String id) {
AppOrderDetail detail = iAppOrderDetailService.getById(id); AppOrderDetail detail = iAppOrderDetailService.getById(id);
detail.setGoods(goodsMainService.getById(detail.getGoodsId())); detail.setGoods(goodsMainService.getById(detail.getGoodsId()));
return AjaxResult.success(detail); return AjaxResult.success(detail);
@ -130,8 +131,8 @@ public class AppOrderDetailController extends BaseController {
/** /**
* 新增订单明细 * 新增订单明细
*/ */
@PreAuthorize("@ss.hasPermi('winery:detail:add')" ) @PreAuthorize("@ss.hasPermi('winery:detail:add')")
@Log(title = "订单明细" , businessType = BusinessType.INSERT) @Log(title = "订单明细", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody AppOrderDetail appOrderDetail) { public AjaxResult add(@RequestBody AppOrderDetail appOrderDetail) {
return toAjax(iAppOrderDetailService.save(appOrderDetail) ? 1 : 0); return toAjax(iAppOrderDetailService.save(appOrderDetail) ? 1 : 0);
@ -140,8 +141,8 @@ public class AppOrderDetailController extends BaseController {
/** /**
* 修改订单明细 * 修改订单明细
*/ */
@PreAuthorize("@ss.hasPermi('winery:detail:edit')" ) @PreAuthorize("@ss.hasPermi('winery:detail:edit')")
@Log(title = "订单明细" , businessType = BusinessType.UPDATE) @Log(title = "订单明细", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AppOrderDetail appOrderDetail) { public AjaxResult edit(@RequestBody AppOrderDetail appOrderDetail) {
return toAjax(iAppOrderDetailService.updateById(appOrderDetail) ? 1 : 0); return toAjax(iAppOrderDetailService.updateById(appOrderDetail) ? 1 : 0);
@ -150,9 +151,9 @@ public class AppOrderDetailController extends BaseController {
/** /**
* 删除订单明细 * 删除订单明细
*/ */
@PreAuthorize("@ss.hasPermi('winery:detail:remove')" ) @PreAuthorize("@ss.hasPermi('winery:detail:remove')")
@Log(title = "订单明细" , businessType = BusinessType.DELETE) @Log(title = "订单明细", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}" ) @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) { public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(iAppOrderDetailService.removeByIds(Arrays.asList(ids)) ? 1 : 0); return toAjax(iAppOrderDetailService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
} }
@ -185,4 +186,17 @@ public class AppOrderDetailController extends BaseController {
return error(); return error();
} }
} }
@PreAuthorize("@ss.hasPermi('winery:detail:query')")
@Log(title = "请求退款", businessType = BusinessType.OTHER)
@PostMapping("/requestRefund")
AjaxResult requestRefund(@RequestBody AppRequestRefundDetailVo vo) {
AppOrderDetail detail = iAppOrderDetailService.getById(vo.getId());
detail.setStatus(1);
detail.setRefundReason(vo.getRefundReason());
iAppOrderDetailService.updateById(detail);
return AjaxResult.success(detail);
}
} }

View File

@ -0,0 +1,42 @@
package com.ruoyi.winery.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.winery.domain.goods.GoodsMain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 请求退款对象
*
* @author ruoyi
* @date 2021-01-18
*/
@Data
@ToString
@EqualsAndHashCode
@NoArgsConstructor
@Accessors(chain = true)
public class AppRequestRefundDetailVo implements Serializable {
/**
* 明细ID
*/
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
@Excel(name = "退款理由")
private String refundReason;
}

View File

@ -24,9 +24,10 @@ class OrderApis {
}) })
} }
refundOrder(id) { requestRefund(data) {
return request.post({ return request.post({
url: baseUrl + 'winery/detail/refund/' + id url: baseUrl + 'winery/detail/requestRefund',
data: data
}) })
} }

View File

@ -5,8 +5,8 @@
*/ */
// export const baseUrl = 'http://36.1.50.18:18989/' // export const baseUrl = 'http://36.1.50.18:18989/'
export const baseUrl = 'http://127.0.0.1:18989/' // export const baseUrl = 'http://127.0.0.1:18989/'
// export const baseUrl = 'https://mall.xiao4r.com/api/' export const baseUrl = 'https://mall.xiao4r.com/api/'
export const imgbaseUrl = 'https://www.xiao4r.com/xiao4rstatic/img/winery/' export const imgbaseUrl = 'https://www.xiao4r.com/xiao4rstatic/img/winery/'
export const sysImgBaseUrl = 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' export const sysImgBaseUrl = 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/'

View File

@ -185,7 +185,7 @@ wepy.component({
onRefund(item) { onRefund(item) {
// 申请退款 // 申请退款
appManager.showToast('即将开放:如需联系退款请拨打客服热线17395097925') eventHub.$emit('onShowRefund', item)
}, },
onDetail(item) { onDetail(item) {
appManager.navigateTo(goodsDetailPage + '?id=' + item.goods.id) appManager.navigateTo(goodsDetailPage + '?id=' + item.goods.id)

View File

@ -4,7 +4,6 @@ return 'https://winery-1257413599.cos.ap-beijing.myqcloud.com/' + imageKey
} }
module.exports.parseImage = parseImage; module.exports.parseImage = parseImage;
</wxs> </wxs>
@ -15,9 +14,33 @@ module.exports.parseImage = parseImage;
width: 100%; width: 100%;
height: 536rpx; height: 536rpx;
z-index: -10; z-index: -10;
} }
.cell-item {
margin-left: 22px;
margin-top: 12px;
display: flex;
align-items: center;
}
.cell-input {
display: flex;
justify-content: center;
align-items: center;
input {
margin-left: 10px;
border: #dddddd solid 1px;
border-radius: 8px;
padding: 5px 10px;
width: 320rpx;
}
}
</style> </style>
<template> <template>
@ -31,6 +54,7 @@ module.exports.parseImage = parseImage;
bind:cancel="onClose" bind:cancel="onClose"
bind:confirm="onConfirm" bind:confirm="onConfirm"
:asyncClose="true" :asyncClose="true"
> >
<van-card <van-card
@ -41,10 +65,50 @@ module.exports.parseImage = parseImage;
:thumb="filters.parseImage(item.goods.goodsFaceImg)" :thumb="filters.parseImage(item.goods.goodsFaceImg)"
> >
<view slot="footer" style="display: flex;align-items: center;padding:10px;">
<span style="font-size: 14px;">如需联系可致电客服热线17395097925</span>
<van-radio-group value="{{ refundReason }}" bind:change="onChangeRefundReason">
<div style="display: flex;margin: 5px;flex-direction: column;">
<div class="cell-item" v-for="(type,index) in reasonType">
<div v-if="index === 4" class="cell-input">
<van-radio name="其他" checked-color="#AC1630">其他<van-radio/>
<input
v-model="text"
clearable
placeholder="请输入退款理由"
/>
</div>
<div v-else>
<van-radio name="{{type}}" checked-color="#AC1630">{{type}}</van-radio>
</div>
</div>
</div>
</van-radio-group>
</view>
</van-card> </van-card>
<van-radio-group value="{{ refundReason }}" bind:change="onChangeRefundReason">
<div style="display: flex;margin: 5px;flex-direction: column;">
<div class="cell-item" v-for="(item,index) in reasonTypes">
<div v-if="index === 4" class="cell-input">
<van-radio name="{{item}}" checked-color="#AC1630" />
<input
v-model="text"
clearable
placeholder="请输入退款理由"
/>
</div>
<div v-else>
<van-radio name="{{item}}" checked-color="#AC1630">{{item}}</van-radio>
</div>
</div>
</div>
</van-radio-group>
</van-dialog> </van-dialog>
</div> </div>
@ -56,17 +120,18 @@ import store from '@/store'
import { mapActions, mapState } from '@wepy/x' import { mapActions, mapState } from '@wepy/x'
import eventHub from '../../common/eventHub' import eventHub from '../../common/eventHub'
import appManager from '../../appManager' import appManager from '../../appManager'
import orderApis from '../../apis/orderApis'
wepy.component({ wepy.component({
store, store,
props: {
item: {}
},
hooks: {}, hooks: {},
data: { data: {
isShow: false isShow: false,
item: {},
refundReason: '',
reasonTypes: ['买错,不想要了', '发错货', '商品损坏/包装脏污', '商品与介绍不符', '其他'],
text: ''
}, },
computed: { computed: {
...mapState({ ...mapState({
@ -76,11 +141,26 @@ wepy.component({
events: {}, events: {},
methods: { methods: {
...mapActions([ ...mapActions([]),
]),
onChangeRefundReason(e) {
this.refundReason = e.$wx.detail
},
onConfirm(event) { onConfirm(event) {
let refundReason = this.refundReason === '其他' ? this.text : this.refundReason
if (!refundReason) {
appManager.showToast('请输入您的退款理由.')
return
}
let data = {
id: this.item.id,
refundReason: refundReason
}
orderApis.requestRefund(data).then(r => {
this.$emit('reload')
this.isShow = false
})
}, },
onClose() { onClose() {
@ -90,6 +170,11 @@ wepy.component({
}, },
ready() { ready() {
eventHub.$on('onShowRefund', (...args) => {
console.log('onShowRefund:', args[0])
this.item = args[0]
this.isShow = true
})
} }
}) })

View File

@ -119,7 +119,7 @@ wepy.component({
console.log('userInfo:', store.state.user.userInfo) console.log('userInfo:', store.state.user.userInfo)
if (!this.isChecked) { if (!this.isChecked) {
appManager.showToast('请确认xxxx协议.') appManager.showToast('请同意并遵守紫色名片《隐私政策》以及《用户条款》.')
return false return false
} }
if (!this.user.mobile) { if (!this.user.mobile) {

View File

@ -36,6 +36,8 @@ input {
} }
</style> </style>
<template> <template>
<nav-bar /> <nav-bar />

View File

@ -150,12 +150,18 @@ wepy.page({
this.pageIndex = index this.pageIndex = index
}, },
init() { async init() {
mallApis.getHotSwitch().then(r => { wx.showLoading({ title: '正在连接...', mask: true })
store.state.hotSwitch = r.data const r = await mallApis.getHotSwitch()
if (r && r.code === 200) {
store.state.hotSwitch = r.data
wx.hideLoading()
appManager.login() appManager.login()
}) return
}
await this.init()
} }
}, },

View File

@ -188,6 +188,7 @@ wepy.page({
wx.hideLoading() wx.hideLoading()
if (r.code !== 200) { if (r.code !== 200) {
appManager.showToast(r.msg)
return return
} }

View File

@ -36,7 +36,7 @@ module.exports.parseImage = parseImage;
</van-tabs> </van-tabs>
<!-- <dialog-refund />--> <dialog-refund @reload="reload" />
</div> </div>
@ -80,6 +80,9 @@ wepy.page({
}, },
reload() { reload() {
eventHub.$emit('refreshOrderList') eventHub.$emit('refreshOrderList')
},
showRefund() {
eventHub.$emit('onShowRefund')
} }
}, },
onLoad(options) { onLoad(options) {

View File

@ -60,11 +60,11 @@ spring:
active: @profiles.active@ active: @profiles.active@
# 文件上传 # 文件上传
servlet: servlet:
multipart: multipart:
# 单个文件大小 # 单个文件大小
max-file-size: 20MB max-file-size: 20MB
# 设置总上传的文件大小 # 设置总上传的文件大小
max-request-size: 20MB max-request-size: 20MB
# 服务模块 # 服务模块
devtools: devtools:
restart: restart:
@ -73,13 +73,13 @@ spring:
# token配置 # token配置
token: token:
# 令牌自定义标识 # 令牌自定义标识
header: Authorization header: Authorization
# 令牌密钥 # 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟 # 令牌有效期默认30分钟
# expireTime: 30 # expireTime: 30
expireTime: 300 expireTime: 300
# MyBatis配置 # MyBatis配置
# https://baomidou.com/config/ # https://baomidou.com/config/
@ -205,17 +205,21 @@ tencent-cos:
#微信小程序支付配置 #微信小程序支付配置
wxmini: wxmini:
# appId: wx76ec015fc31a1946 #微信公众号或者小程序等的appid 必填 # appId: wx76ec015fc31a1946 # 宁夏通
appId: wx4306452d346f783d #微信公众号或者小程序等的appid 必填 appId: wx4306452d346f783d # 紫色名片
# secret: 94ee42c0899a6ceccf353e1e729c50d4 #微信小程序的Secret # secret: 94ee42c0899a6ceccf353e1e729c50d4 # 宁夏通
secret: dc55bc1729090bdff9b63e1a5f0d03b2 #微信小程序的Secret secret: dc55bc1729090bdff9b63e1a5f0d03b2 # 紫色名片
mchId: 1486984962 mchId: 1486984962
mchKey: 82aZ9Tb6eu5W2HdXKQWZU2SztU8w8nJ8 mchKey: 82aZ9Tb6eu5W2HdXKQWZU2SztU8w8nJ8
keyPath: "classpath:/cert/apiclient_cert1486984962.p12" # p12证书的位置可以指定绝对路径也可以指定类路径以classpath:开头)
subAppId: #服务商模式下的子商户公众账号ID subAppId: #服务商模式下的子商户公众账号ID
subMchId: #服务商模式下的子商户号 subMchId: #服务商模式下的子商户号
tradeType: JSAPI #交易类型 tradeType: JSAPI #交易类型
keyPath: "classpath:/cert/apiclient_cert1486984962.p12" # p12证书的位置可以指定绝对路径也可以指定类路径以classpath:开头)
token: xiao4r #微信小程序消息服务器配置的token token: xiao4r #微信小程序消息服务器配置的token
aesKey: jNXajd2sQSMYQNg3rcdMF9HraUJxXF0iswgdMxVik9W #微信小程序消息服务器配置的EncodingAESKey aesKey: jNXajd2sQSMYQNg3rcdMF9HraUJxXF0iswgdMxVik9W #微信小程序消息服务器配置的EncodingAESKey

View File

@ -51,3 +51,11 @@ export function exportDetail(query) {
params: query params: query
}) })
} }
// 操作退款
export function refund(id) {
return request({
url: '/winery/detail/refund/' + id,
method: 'post'
})
}

View File

@ -48,7 +48,7 @@
</el-form-item> </el-form-item>
<el-form-item label="明细状态" prop="status"> <el-form-item label="明细状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择明细状态" clearable size="small"> <el-select v-model="queryParams.status" placeholder="请选择明细状态" clearable size="small">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value=""/>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="统一退单号" prop="refundNo"> <el-form-item label="统一退单号" prop="refundNo">
@ -62,10 +62,10 @@
</el-form-item> </el-form-item>
<el-form-item label="退款时间" prop="refundTime"> <el-form-item label="退款时间" prop="refundTime">
<el-date-picker clearable size="small" style="width: 200px" <el-date-picker clearable size="small" style="width: 200px"
v-model="queryParams.refundTime" v-model="queryParams.refundTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择退款时间"> placeholder="选择退款时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -82,7 +82,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['winery:detail:add']" v-hasPermi="['winery:detail:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -92,7 +93,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['winery:detail:edit']" v-hasPermi="['winery:detail:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -102,7 +104,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['winery:detail:remove']" v-hasPermi="['winery:detail:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -111,21 +114,27 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['winery:detail:export']" v-hasPermi="['winery:detail:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="detailList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="detailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="明细ID" align="center" prop="id" v-if="false"/> <el-table-column label="明细ID" align="center" prop="id" v-if="false"/>
<el-table-column label="部门ID" align="center" prop="deptId" /> <el-table-column label="部门ID" align="center" prop="deptId"/>
<el-table-column label="用户ID" align="center" prop="userId" /> <el-table-column label="用户ID" align="center" prop="userId"/>
<el-table-column label="订单ID" align="center" prop="orderId" /> <el-table-column label="订单ID" align="center" prop="orderId"/>
<el-table-column label="商品ID" align="center" prop="goodsId" /> <el-table-column label="商品ID" align="center" prop="goodsId"/>
<el-table-column label="商品数量" align="center" prop="goodsCount" /> <el-table-column label="退款时间" align="center" prop="goods" width="180">
<el-table-column label="明细状态" align="center" prop="status" /> <template slot-scope="scope">
<el-table-column label="统一退单号" align="center" prop="refundNo" /> <span>{{ goods.goodsName }}</span>
</template>
</el-table-column>
<el-table-column label="商品数量" align="center" prop="goodsCount"/>
<el-table-column label="明细状态" align="center" prop="status" :formatter="statusFormat"/>
<el-table-column label="统一退单号" align="center" prop="refundNo"/>
<el-table-column label="退款时间" align="center" prop="refundTime" width="180"> <el-table-column label="退款时间" align="center" prop="refundTime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.refundTime, '{y}-{m}-{d}') }}</span> <span>{{ parseTime(scope.row.refundTime, '{y}-{m}-{d}') }}</span>
@ -133,20 +142,32 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleRefund(scope.row)"
v-hasPermi="['winery:detail:refund\n']"
>退款
</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['winery:detail:edit']" v-hasPermi="['winery:detail:edit']"
>修改</el-button> >修改
<el-button </el-button>
size="mini" <!-- <el-button-->
type="text" <!-- size="mini"-->
icon="el-icon-delete" <!-- type="text"-->
@click="handleDelete(scope.row)" <!-- icon="el-icon-delete"-->
v-hasPermi="['winery:detail:remove']" <!-- @click="handleDelete(scope.row)"-->
>删除</el-button> <!-- v-hasPermi="['winery:detail:remove']"-->
<!-- >删除-->
<!-- </el-button>-->
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -163,19 +184,19 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="部门ID" prop="deptId"> <el-form-item label="部门ID" prop="deptId">
<el-input v-model="form.deptId" placeholder="请输入部门ID" /> <el-input v-model="form.deptId" placeholder="请输入部门ID"/>
</el-form-item> </el-form-item>
<el-form-item label="用户ID" prop="userId"> <el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" /> <el-input v-model="form.userId" placeholder="请输入用户ID"/>
</el-form-item> </el-form-item>
<el-form-item label="订单ID" prop="orderId"> <el-form-item label="订单ID" prop="orderId">
<el-input v-model="form.orderId" placeholder="请输入订单ID" /> <el-input v-model="form.orderId" placeholder="请输入订单ID"/>
</el-form-item> </el-form-item>
<el-form-item label="商品ID" prop="goodsId"> <el-form-item label="商品ID" prop="goodsId">
<el-input v-model="form.goodsId" placeholder="请输入商品ID" /> <el-input v-model="form.goodsId" placeholder="请输入商品ID"/>
</el-form-item> </el-form-item>
<el-form-item label="商品数量" prop="goodsCount"> <el-form-item label="商品数量" prop="goodsCount">
<el-input v-model="form.goodsCount" placeholder="请输入商品数量" /> <el-input v-model="form.goodsCount" placeholder="请输入商品数量"/>
</el-form-item> </el-form-item>
<el-form-item label="明细状态"> <el-form-item label="明细状态">
<el-radio-group v-model="form.status"> <el-radio-group v-model="form.status">
@ -183,14 +204,14 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="统一退单号" prop="refundNo"> <el-form-item label="统一退单号" prop="refundNo">
<el-input v-model="form.refundNo" placeholder="请输入统一退单号" /> <el-input v-model="form.refundNo" placeholder="请输入统一退单号"/>
</el-form-item> </el-form-item>
<el-form-item label="退款时间" prop="refundTime"> <el-form-item label="退款时间" prop="refundTime">
<el-date-picker clearable size="small" style="width: 200px" <el-date-picker clearable size="small" style="width: 200px"
v-model="form.refundTime" v-model="form.refundTime"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择退款时间"> placeholder="选择退款时间">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -203,12 +224,11 @@
</template> </template>
<script> <script>
import { listDetail, getDetail, delDetail, addDetail, updateDetail, exportDetail } from "@/api/winery/detail"; import {listDetail, getDetail, delDetail, addDetail, updateDetail, exportDetail, refund} from "@/api/winery/detail";
export default { export default {
name: "Detail", name: "Detail",
components: { components: {},
},
data() { data() {
return { return {
// //
@ -225,6 +245,8 @@ export default {
total: 0, total: 0,
// //
detailList: [], detailList: [],
// 退
statusOptions: [],
// //
title: "", title: "",
// //
@ -247,28 +269,31 @@ export default {
// //
rules: { rules: {
userId: [ userId: [
{ required: true, message: "用户ID不能为空", trigger: "blur" } {required: true, message: "用户ID不能为空", trigger: "blur"}
], ],
orderId: [ orderId: [
{ required: true, message: "订单ID不能为空", trigger: "blur" } {required: true, message: "订单ID不能为空", trigger: "blur"}
], ],
goodsId: [ goodsId: [
{ required: true, message: "商品ID不能为空", trigger: "blur" } {required: true, message: "商品ID不能为空", trigger: "blur"}
], ],
status: [ status: [
{ required: true, message: "明细状态不能为空", trigger: "blur" } {required: true, message: "明细状态不能为空", trigger: "blur"}
], ],
createTime: [ createTime: [
{ required: true, message: "创建时间不能为空", trigger: "blur" } {required: true, message: "创建时间不能为空", trigger: "blur"}
], ],
updateTime: [ updateTime: [
{ required: true, message: "更新时间不能为空", trigger: "blur" } {required: true, message: "更新时间不能为空", trigger: "blur"}
] ]
} }
}; };
}, },
created() { created() {
this.getList(); this.getList();
this.getDicts("refund_status").then(response => {
this.statusOptions = response.data;
});
}, },
methods: { methods: {
/** 查询订单明细列表 */ /** 查询订单明细列表 */
@ -280,6 +305,12 @@ export default {
this.loading = false; this.loading = false;
}); });
}, },
//
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
// //
cancel() { cancel() {
this.open = false; this.open = false;
@ -315,7 +346,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -334,6 +365,18 @@ export default {
this.title = "修改订单明细"; this.title = "修改订单明细";
}); });
}, },
/** 退款操作 */
handleRefund(row) {
this.reset();
const id = row.id || this.ids
refund(id).then(response => {
this.msgSuccess(response.msg);
if (response.code === 200) {
this.getList();
}
});
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
@ -358,28 +401,28 @@ export default {
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$confirm('是否确认删除订单明细编号为"' + ids + '"的数据项?', "警告", { this.$confirm('是否确认删除订单明细编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return delDetail(ids); return delDetail(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}) })
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams;
this.$confirm('是否确认导出所有订单明细数据项?', "警告", { this.$confirm('是否确认导出所有订单明细数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return exportDetail(queryParams); return exportDetail(queryParams);
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg);
}) })
} }
} }
}; };