微信支付后端、前端相关代码
This commit is contained in:
parent
f275302a41
commit
c9bc4642af
@ -122,4 +122,13 @@ public class BsOrderController extends BaseController
|
||||
{
|
||||
return success(bsOrderService.getPayStatus(orderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户查询订单
|
||||
*/
|
||||
@GetMapping("/userGet/{orderNo}")
|
||||
public AjaxResult userGetOrder(@PathVariable("orderNo") String orderNo)
|
||||
{
|
||||
return success(bsOrderService.userGetOrder(orderNo));
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,14 @@ public class BsGoods extends BaseEntity
|
||||
@Excel(name = "商品详情")
|
||||
private String details;
|
||||
|
||||
/** 商品详情 */
|
||||
@Excel(name = "商品视频")
|
||||
private String video;
|
||||
|
||||
/** 商品详情 */
|
||||
@Excel(name = "帮助")
|
||||
private String help;
|
||||
|
||||
/** 商品资源 */
|
||||
@Excel(name = "商品资源")
|
||||
private String resource;
|
||||
@ -127,6 +135,27 @@ public class BsGoods extends BaseEntity
|
||||
{
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setVideo(String video)
|
||||
{
|
||||
this.video = video;
|
||||
}
|
||||
|
||||
public String getVideo()
|
||||
{
|
||||
return video;
|
||||
}
|
||||
|
||||
public void setHelp(String help)
|
||||
{
|
||||
this.help = help;
|
||||
}
|
||||
|
||||
public String getHelp()
|
||||
{
|
||||
return help;
|
||||
}
|
||||
|
||||
public void setResource(String resource)
|
||||
{
|
||||
this.resource = resource;
|
||||
@ -157,6 +186,8 @@ public class BsGoods extends BaseEntity
|
||||
.append("price", getPrice())
|
||||
.append("introduction", getIntroduction())
|
||||
.append("details", getDetails())
|
||||
.append("video", getVideo())
|
||||
.append("help", getHelp())
|
||||
.append("resource", getResource())
|
||||
.append("createId", getCreateId())
|
||||
.append("createTime", getCreateTime())
|
||||
|
@ -74,4 +74,12 @@ public interface BsOrderMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int getPayStatus(String orderNo);
|
||||
|
||||
/**
|
||||
* 用户查询订单
|
||||
*
|
||||
* @param orderNo 商家订单号号
|
||||
* @return 结果
|
||||
*/
|
||||
public BsOrder userGetOrder(String orderNo);
|
||||
}
|
||||
|
@ -74,4 +74,12 @@ public interface IBsOrderService
|
||||
* @return 结果
|
||||
*/
|
||||
public int getPayStatus(String orderNo);
|
||||
|
||||
/**
|
||||
* 用户查询订单
|
||||
*
|
||||
* @param orderNo 商家订单号号
|
||||
* @return 结果
|
||||
*/
|
||||
public BsOrder userGetOrder(String orderNo);
|
||||
}
|
||||
|
@ -117,4 +117,15 @@ public class BsOrderServiceImpl implements IBsOrderService
|
||||
public int getPayStatus(String orderNo) {
|
||||
return bsOrderMapper.getPayStatus(orderNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户查询订单
|
||||
*
|
||||
* @param orderNo 商家订单号号
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public BsOrder userGetOrder(String orderNo) {
|
||||
return bsOrderMapper.userGetOrder(orderNo);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="price" column="price" />
|
||||
<result property="introduction" column="introduction" />
|
||||
<result property="details" column="details" />
|
||||
<result property="video" column="video" />
|
||||
<result property="help" column="help" />
|
||||
<result property="resource" column="resource" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
@ -25,6 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="price" column="price" />
|
||||
<result property="introduction" column="introduction" />
|
||||
<result property="details" column="details" />
|
||||
<result property="video" column="video" />
|
||||
<result property="help" column="help" />
|
||||
<result property="resource" column="resource" />
|
||||
<result property="createName" column="create_name" />
|
||||
<result property="createTime" column="create_time" />
|
||||
@ -35,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBsGoodsVo">
|
||||
select id, name, cover, technical_type_id, design_type_id, price, introduction, details, resource, create_id, create_time from bs_goods
|
||||
select id, name, cover, technical_type_id, design_type_id, price, introduction, details, resource, create_id, create_time, video, help from bs_goods
|
||||
</sql>
|
||||
|
||||
<select id="selectBsGoodsList" parameterType="BsGoods" resultMap="BsGoodsResult">
|
||||
@ -68,6 +72,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="price != null">price,</if>
|
||||
<if test="introduction != null">introduction,</if>
|
||||
<if test="details != null">details,</if>
|
||||
<if test="video != null">video,</if>
|
||||
<if test="help != null">help,</if>
|
||||
<if test="resource != null">resource,</if>
|
||||
<if test="createId != null">create_id,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
@ -81,6 +87,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="introduction != null">#{introduction},</if>
|
||||
<if test="details != null">#{details},</if>
|
||||
<if test="video != null">#{video},</if>
|
||||
<if test="help != null">#{help},</if>
|
||||
<if test="resource != null">#{resource},</if>
|
||||
<if test="createId != null">#{createId},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
@ -97,6 +105,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="price != null">price = #{price},</if>
|
||||
<if test="introduction != null">introduction = #{introduction},</if>
|
||||
<if test="details != null">details = #{details},</if>
|
||||
<if test="video != null">video = #{video},</if>
|
||||
<if test="help != null">help = #{help},</if>
|
||||
<if test="resource != null">resource = #{resource},</if>
|
||||
<if test="createId != null">create_id = #{createId},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
@ -129,6 +139,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
bg.price,
|
||||
bg.introduction,
|
||||
bg.details,
|
||||
bg.video,
|
||||
bg.help,
|
||||
bg.resource,
|
||||
bg.create_time,
|
||||
bg.design_type_id,
|
||||
@ -150,6 +162,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="price != null and price != ''"> AND bg.price = #{price} </if>
|
||||
<if test="introduction != null and introduction != ''"> AND bg.introduction = #{introduction} </if>
|
||||
<if test="details != null and details != ''"> AND bg.details = #{details} </if>
|
||||
<if test="video != null and video != ''"> AND bg.video = #{video} </if>
|
||||
<if test="help != null and help != ''"> AND bg.help = #{help} </if>
|
||||
<if test="resource != null and resource != ''"> AND bg.resource = #{resource} </if>
|
||||
<if test="technicalTypeId != null and technicalTypeId != ''"> AND bg.technical_type_id = #{technicalTypeId} </if>
|
||||
<if test="designTypeId != null and designTypeId != ''"> AND bg.design_type_id = #{designTypeId} </if>
|
||||
|
@ -129,4 +129,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select payStatus from bs_order where
|
||||
<if test="orderNo != null"> order_no = #{orderNo} </if>
|
||||
</select>
|
||||
|
||||
<select id="userGetOrder" parameterType="String" resultMap="BsOrderResult">
|
||||
select order_no,channel,transaction_id,pay_time,goods_name,goodsmin,price,create_time from bs_order where order_no = #{orderNo} and payStatus = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -1,5 +1,5 @@
|
||||
# 页面标题
|
||||
VUE_APP_TITLE = 若依管理系统
|
||||
VUE_APP_TITLE = 毕设
|
||||
|
||||
# 开发环境配置
|
||||
ENV = 'development'
|
||||
|
@ -1,5 +1,5 @@
|
||||
# 页面标题
|
||||
VUE_APP_TITLE = 若依管理系统
|
||||
VUE_APP_TITLE = 毕设
|
||||
|
||||
# 生产环境配置
|
||||
ENV = 'production'
|
||||
|
@ -1,5 +1,5 @@
|
||||
# 页面标题
|
||||
VUE_APP_TITLE = 若依管理系统
|
||||
VUE_APP_TITLE = 毕设
|
||||
|
||||
NODE_ENV = production
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ruoyi",
|
||||
"version": "3.8.8",
|
||||
"description": "若依管理系统",
|
||||
"description": "毕设",
|
||||
"author": "若依",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
@ -60,6 +60,7 @@
|
||||
"vue-meta": "2.4.0",
|
||||
"vue-qr": "^4.0.9",
|
||||
"vue-router": "3.4.9",
|
||||
"vue-ueditor-wrap": "^2.5.6",
|
||||
"vuedraggable": "2.24.3",
|
||||
"vuex": "3.6.0"
|
||||
},
|
||||
|
@ -65,3 +65,11 @@ export function getPayStatus(orderNo) {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 用户根据订单编号查询订单详细
|
||||
export function userGetOrder(orderNo) {
|
||||
return request({
|
||||
url: '/system/order/userGet/' + orderNo,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -49,8 +49,7 @@ export default {
|
||||
axios({
|
||||
method: 'get',
|
||||
url: url,
|
||||
responseType: 'blob',
|
||||
headers: { 'Authorization': 'Bearer ' + getToken() }
|
||||
responseType: 'blob'
|
||||
}).then((res) => {
|
||||
const isBlob = blobValidate(res.data);
|
||||
if (isBlob) {
|
||||
@ -66,6 +65,7 @@ export default {
|
||||
downloadLoadingInstance.close();
|
||||
})
|
||||
},
|
||||
|
||||
saveAs(text, name, opts) {
|
||||
saveAs(text, name, opts);
|
||||
},
|
||||
|
@ -102,6 +102,20 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品视频" align="center" prop="video" >
|
||||
<template slot-scope="scope">
|
||||
<div class="introduction" :title="scope.row.video">
|
||||
{{ scope.row.video }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="帮助" align="center" prop="help" >
|
||||
<template slot-scope="scope">
|
||||
<div class="introduction" :title="scope.row.help">
|
||||
{{ scope.row.help }}
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品资源" align="center" prop="resource" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
@ -161,6 +175,12 @@
|
||||
<el-form-item label="商品详情" prop="details">
|
||||
<editor v-model="form.details" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品视频" prop="video">
|
||||
<editor v-model="form.video" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="帮助" prop="help">
|
||||
<editor v-model="form.help" :min-height="192"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品资源" prop="resource">
|
||||
<file-upload v-model="form.resource"/>
|
||||
</el-form-item>
|
||||
@ -218,6 +238,8 @@ export default {
|
||||
price: null,
|
||||
introduction: null,
|
||||
details: null,
|
||||
video: null,
|
||||
help: null,
|
||||
resource: null,
|
||||
technicalName: null,
|
||||
designName: null,
|
||||
@ -234,6 +256,8 @@ export default {
|
||||
price: null,
|
||||
introduction: null,
|
||||
details: null,
|
||||
video: null,
|
||||
help: null,
|
||||
resource: null,
|
||||
technicalName: null,
|
||||
designName: null,
|
||||
@ -256,24 +280,6 @@ export default {
|
||||
technicalTypeMapping: {},
|
||||
designTypeMapping: {},
|
||||
|
||||
field101Options: [{
|
||||
"label": "Java",
|
||||
"value": 1
|
||||
}, {
|
||||
"label": "PHP",
|
||||
"value": 2
|
||||
}],
|
||||
field102Options: [{
|
||||
"label": "购物",
|
||||
"value": 1
|
||||
}, {
|
||||
"label": "音乐",
|
||||
"value": 2
|
||||
}],
|
||||
formData: {
|
||||
field101: '',
|
||||
field102: '',
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -308,6 +314,8 @@ export default {
|
||||
price: null,
|
||||
introduction: null,
|
||||
details: null,
|
||||
video: null,
|
||||
help: null,
|
||||
resource: null,
|
||||
createId: null,
|
||||
createTime: null
|
||||
|
@ -37,9 +37,23 @@
|
||||
<el-row>
|
||||
<el-col :span="20">
|
||||
<el-card class="details-card">
|
||||
<h2>{{ goods.name }}</h2>
|
||||
<h1 style="text-align: center">{{ goods.name }}</h1>
|
||||
<el-image
|
||||
style="width: 100%; height: 100%"
|
||||
:src="`http://127.0.0.1:40506${goods.cover}`"
|
||||
:fit="cover"></el-image>
|
||||
</el-card>
|
||||
|
||||
<div class="menu-div">
|
||||
<el-button type="primary" @click="setFuText(1)">项目详情</el-button>
|
||||
<el-button type="primary" @click="setFuText(2)">视频介绍</el-button>
|
||||
<el-button type="primary" @click="setFuText(3)">注意事项</el-button>
|
||||
</div>
|
||||
|
||||
<el-card class="details-card">
|
||||
<h2 style="text-align: center;">{{ goods.name }}</h2>
|
||||
<span>{{ goods.introduction }}</span>
|
||||
<div class="box" v-html="goods.details" @click="showImage($event)"></div>
|
||||
<div class="box" v-html="fuText" @click="showImage($event)"></div>
|
||||
<el-image-viewer
|
||||
v-if="dialogVisible"
|
||||
:on-close="closeImage"
|
||||
@ -61,9 +75,12 @@
|
||||
</div>
|
||||
</el-card>
|
||||
<el-card class="right-card">
|
||||
<h3>价格: ¥{{ goods.price }}</h3>
|
||||
<el-button type="primary">立即购买</el-button>
|
||||
<el-button type="success">加入收藏</el-button>
|
||||
<div class="contact-title">联系客服</div>
|
||||
<div class="contact-butdiv">
|
||||
<el-button type="success" icon="el-icon-weixin" class="contact-button" @click="handleContactClick">
|
||||
点击联系帮助
|
||||
</el-button></div>
|
||||
<div class="contact-info">项目安装或其他问题可咨询客服</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -126,6 +143,8 @@ export default {
|
||||
//图片预览相关
|
||||
url: '',
|
||||
dialogVisible: false,
|
||||
|
||||
fuText:null
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
@ -136,6 +155,7 @@ export default {
|
||||
this.getGood(this.goodsId);
|
||||
this.getTnList()
|
||||
this.getDnList()
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
@ -143,6 +163,7 @@ export default {
|
||||
getGood(id) {
|
||||
getGoods(id).then(response => {
|
||||
this.goods = response.data;
|
||||
this.fuText = this.goods.details
|
||||
console.log('good',response)
|
||||
});
|
||||
},
|
||||
@ -179,83 +200,19 @@ export default {
|
||||
// window.location.href = baseURL + "/common/download?fileName=" + encodeURI(fileName) + "&delete=" + true;
|
||||
// },
|
||||
|
||||
|
||||
// /** 下载文件 */
|
||||
// downloadFile(fileUrl) {
|
||||
// console.log('文件路径:', fileUrl);
|
||||
// if (!fileUrl) {
|
||||
// this.$message.error('文件路径为空,无法下载');
|
||||
// return;
|
||||
// }
|
||||
// if (!fileUrl.startsWith('http')) {
|
||||
// fileUrl = 'http://127.0.0.1:8080' + fileUrl;
|
||||
// }
|
||||
// axios({
|
||||
// url: fileUrl,
|
||||
// method: 'GET',
|
||||
// responseType: 'blob'
|
||||
// }).then(response => {
|
||||
// const blob = new Blob([response.data], { type: 'application/octet-stream' });
|
||||
// const link = document.createElement('a');
|
||||
// link.href = URL.createObjectURL(blob);
|
||||
// link.download = fileUrl.split('/').pop();
|
||||
// link.click();
|
||||
// URL.revokeObjectURL(link.href);
|
||||
// }).catch(error => {
|
||||
// console.error('下载文件出错:', error);
|
||||
// this.$message.error('下载文件出现错误,请联系管理员!');
|
||||
// });
|
||||
// }
|
||||
/** 下载文件 */
|
||||
downloadFile(fileUrl) {
|
||||
console.log('文件路径:', fileUrl);
|
||||
if (!fileUrl) {
|
||||
this.$message.error('文件路径为空,无法下载');
|
||||
return;
|
||||
setFuText(index){
|
||||
if(index === 1){
|
||||
this.fuText = this.goods.details
|
||||
}
|
||||
if (!fileUrl.startsWith('http')) {
|
||||
fileUrl = 'http://127.0.0.1:40506' + fileUrl;
|
||||
if(index === 2) {
|
||||
this.fuText = '<p>测试video</p>'
|
||||
}
|
||||
if(index === 3) {
|
||||
this.fuText = '<p>测试help</p>'
|
||||
}
|
||||
|
||||
axios({
|
||||
url: fileUrl,
|
||||
method: 'GET',
|
||||
responseType: 'blob'
|
||||
}).then(response => {
|
||||
const blob = new Blob([response.data], { type: 'application/octet-stream' });
|
||||
|
||||
// 生成新的文件名
|
||||
const originalFileName = fileUrl.split('/').pop();
|
||||
const timestamp = new Date().toISOString().replace(/[:.-]/g, '');
|
||||
const newFileName = `${timestamp}_${originalFileName}`;
|
||||
|
||||
// 检查浏览器是否支持 showSaveFilePicker API
|
||||
if (window.showSaveFilePicker) {
|
||||
// 使用 showSaveFilePicker API 让用户选择保存路径
|
||||
window.showSaveFilePicker({ suggestedName: newFileName }).then(handle => {
|
||||
handle.createWritable().then(writer => {
|
||||
writer.write(blob);
|
||||
writer.close();
|
||||
}).catch(error => {
|
||||
console.error('创建文件写入器失败:', error);
|
||||
this.$message.error('创建文件写入器失败,请联系管理员!');
|
||||
});
|
||||
}).catch(error => {
|
||||
|
||||
});
|
||||
} else {
|
||||
// 使用传统的 a 标签下载文件
|
||||
const link = document.createElement('a');
|
||||
link.href = URL.createObjectURL(blob);
|
||||
link.download = newFileName;
|
||||
link.click();
|
||||
URL.revokeObjectURL(link.href);
|
||||
}
|
||||
}).catch(error => {
|
||||
console.error('下载文件出错:', error);
|
||||
this.$message.error('下载文件出现错误,请联系管理员!');
|
||||
});
|
||||
},
|
||||
|
||||
//图片预览相关
|
||||
showImage (e) {
|
||||
if (e.target.tagName == 'IMG') {
|
||||
@ -445,4 +402,68 @@ export default {
|
||||
max-width:100%;
|
||||
|
||||
}
|
||||
.contact-box {
|
||||
width: 250px;
|
||||
padding: 20px;
|
||||
border: 1px solid #ddd;
|
||||
background-color: #f5f5f5;
|
||||
text-align: center;
|
||||
font-family: Arial, sans-serif;
|
||||
}
|
||||
|
||||
.contact-title {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
color: red;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.contact-button {
|
||||
display: inline-block;
|
||||
padding: 10px 20px;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.contact-butdiv {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.contact-info {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
::v-deep .el-icon-weixin {
|
||||
background: url('../../../assets/images/moren.png') no-repeat center;
|
||||
font-size: 12px;
|
||||
background-size: cover;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
display: inline-block; /* 确保图标作为一个块级元素显示 */
|
||||
line-height: 24px; /* 使文本垂直居中 */
|
||||
text-align: center; /* 使文本水平居中 */
|
||||
}
|
||||
::v-deep .el-icon-weixin:before {
|
||||
content: "替";
|
||||
font-size: 12px;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.menu-div {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-right: 20px;
|
||||
margin-top: 20px;
|
||||
width: 1000px;
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
|
@ -103,7 +103,7 @@
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="no-data" style="text-align: center; margin-top: 150px;">
|
||||
<p>暂无数据</p>
|
||||
<el-empty :image-size="200"></el-empty>
|
||||
</div>
|
||||
</template>
|
||||
</el-row>
|
||||
|
@ -38,23 +38,23 @@
|
||||
<el-table v-if="orderMsgList.length > 0 && orderMsgList[0] !== undefined" :data="orderMsgList">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="订单号" align="center" prop="orderNo" />
|
||||
<el-table-column label="商品名称" align="center" prop="goodsName" />
|
||||
<el-table-column label="订单价格" align="center" prop="price" />
|
||||
<el-table-column label="支付方式" align="center" prop="channel" >
|
||||
<template slot-scope="scope">
|
||||
{{ getPaymentMethod(scope.row.channel) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付时间" align="center" prop="payTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" align="center" prop="goodsName" />
|
||||
<el-table-column label="订单价格" align="center" prop="price" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="支付时间" align="center" prop="payTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.payTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@ -75,9 +75,10 @@
|
||||
|
||||
<script>
|
||||
import {getGoods} from "@/api/system/goods";
|
||||
import {getOrderByOrderNo, listOrder} from "@/api/system/order";
|
||||
import {parseTime} from "../../../utils/ruoyi";
|
||||
import {userGetOrder} from "@/api/system/order";
|
||||
import {parseTime} from "@/utils/ruoyi";
|
||||
import axios from "axios";
|
||||
import downloadUtil from "@/plugins/download";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -97,11 +98,12 @@ export default {
|
||||
orderNo: [{required: true, message: '请输入订单号', trigger: 'blur'}],
|
||||
},
|
||||
loading: true,
|
||||
showEmptyMessage: false, // 控制提示信息的显示
|
||||
showEmptyMessage: false,
|
||||
// 商品表格数据
|
||||
goods: [],
|
||||
// 商品表资源地址
|
||||
goodsResource: null,
|
||||
fileName: null,
|
||||
};
|
||||
},
|
||||
|
||||
@ -110,9 +112,9 @@ export default {
|
||||
/** 查询订单列表 */
|
||||
getOrder() {
|
||||
this.loading = true;
|
||||
getOrderByOrderNo(this.queryParams.orderNo).then(response => {
|
||||
this.orderMsgList.push(response.data);
|
||||
this.showEmptyMessage = this.orderMsgList.length === 0 || this.orderMsgList[0] === undefined; // 根据数据更新提示信息
|
||||
userGetOrder(this.queryParams.orderNo).then(response => {
|
||||
this.orderMsgList.push(response.data);
|
||||
this.showEmptyMessage = this.orderMsgList.length === 0 || this.orderMsgList[0] === undefined;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
@ -121,20 +123,20 @@ export default {
|
||||
this.$refs.queryForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.orderMsgList = [];
|
||||
this.showEmptyMessage = false; // 点击查询时先隐藏提示信息
|
||||
this.getOrder(); // 只有当表单通过校验时才调用获取订单的方法
|
||||
this.showEmptyMessage = false;
|
||||
this.getOrder();
|
||||
|
||||
} else {
|
||||
console.log('表单校验失败!');
|
||||
return false; // 表单校验不通过,不发送请求
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.$refs.queryForm.resetFields(); // 调用 resetFields 方法重置表单
|
||||
this.orderMsgList = []; // 清空订单信息
|
||||
this.showEmptyMessage = false; // 隐藏提示信息
|
||||
this.$refs.queryForm.resetFields();
|
||||
this.orderMsgList = [];
|
||||
this.showEmptyMessage = false;
|
||||
},
|
||||
getPaymentMethod(channel) {
|
||||
switch (channel) {
|
||||
@ -152,8 +154,9 @@ export default {
|
||||
getGoods(id).then(response => {
|
||||
// this.goods = response.data;
|
||||
this.goodsResource = response.data.resource;
|
||||
this.fileName = response.data.name;
|
||||
if(this.goodsResource !== null){
|
||||
this.downloadFile(this.goodsResource)
|
||||
this.downloadFile()
|
||||
}else{
|
||||
this.$message.error('文件不存在,请联系管理员!');
|
||||
}
|
||||
@ -162,7 +165,16 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
/** 下载文件 */
|
||||
downloadFile() {
|
||||
const fileUrl = this.goodsResource;
|
||||
const name = this.fileName;
|
||||
const timestamp = new Date().toISOString().replace(/[-:T]/g, '').split('.')[0];
|
||||
const fileNameWithTimestamp = `${name}_${timestamp}`;
|
||||
downloadUtil.zip(fileUrl,fileNameWithTimestamp);
|
||||
}
|
||||
|
||||
|
||||
/* /!** 下载文件 *!/
|
||||
downloadFile(fileUrl) {
|
||||
console.log('文件路径:', fileUrl);
|
||||
if (!fileUrl) {
|
||||
@ -170,7 +182,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
if (!fileUrl.startsWith('http')) {
|
||||
fileUrl = 'http://127.0.0.1:8080' + fileUrl;
|
||||
fileUrl = 'http://127.0.0.1:40506' + fileUrl;
|
||||
}
|
||||
|
||||
axios({
|
||||
@ -181,9 +193,10 @@ export default {
|
||||
const blob = new Blob([response.data], { type: 'application/octet-stream' });
|
||||
|
||||
// 生成新的文件名
|
||||
const originalFileName = fileUrl.split('/').pop();
|
||||
const originalFileName = this.goods.name;
|
||||
const timestamp = new Date().toISOString().replace(/[:.-]/g, '');
|
||||
const newFileName = `${timestamp}_${originalFileName}`;
|
||||
console.log('新文件名:', newFileName)
|
||||
|
||||
// 检查浏览器是否支持 showSaveFilePicker API
|
||||
if (window.showSaveFilePicker) {
|
||||
@ -211,11 +224,7 @@ export default {
|
||||
console.error('下载文件出错:', error);
|
||||
this.$message.error('下载文件出现错误,请联系管理员!');
|
||||
});
|
||||
},
|
||||
goHome() {
|
||||
// 实现跳转首页逻辑
|
||||
this.$router.push('/cus');
|
||||
}
|
||||
},*/
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -59,7 +59,7 @@ export default {
|
||||
// 商品表格数据
|
||||
goods: [],
|
||||
goodsId: null, // 用于存储接收的商品ID
|
||||
|
||||
goodsResource: null,
|
||||
orderNo: null,
|
||||
form:{},
|
||||
payUrl: null,
|
||||
@ -81,7 +81,8 @@ export default {
|
||||
getGood(id) {
|
||||
getGoods(id).then(response => {
|
||||
this.goods = response.data;
|
||||
this.imageUrl = `http://127.0.0.1:40506${this.goods.cover}` || this.defaultImage; // 设置图片地址
|
||||
this.imageUrl = `http://127.0.0.1:40506${this.goods.cover}` || this.defaultImage;
|
||||
this.goodsResource = this.goods.resource;
|
||||
this.getOrderNo();
|
||||
console.log('good',response)
|
||||
});
|
||||
@ -101,7 +102,6 @@ export default {
|
||||
this.orderNo = response.data;
|
||||
console.log('订单号',this.orderNo)
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
pay(method) {
|
||||
@ -111,7 +111,7 @@ export default {
|
||||
console.log('res',response)
|
||||
console.log('支付地址',this.payUrl)
|
||||
this.loading = true;
|
||||
this.$router.push({ path: '/payMent', query: { url: this.payUrl, orderNo: this.orderNo } });
|
||||
this.$router.push({ path: '/payMent', query: { id: this.goodsId, url: this.payUrl, orderNo: this.orderNo } });
|
||||
}).catch(error => {
|
||||
console.error('支付失败', error);
|
||||
}).finally(() => {
|
||||
|
@ -22,7 +22,8 @@
|
||||
<img :src="qrCodeUrl" alt="支付二维码" />
|
||||
</div>
|
||||
<div class="payment" v-else-if="payStatus === 1">
|
||||
<p>支付成功,请保留好支付记录,谢谢!</p>
|
||||
<el-button type="primary" @click="downloadFile">下载文件</el-button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="payment">
|
||||
@ -41,6 +42,10 @@
|
||||
<script>
|
||||
import {toDataURL} from 'qrcode'
|
||||
import {getPayStatus} from "@/api/system/order";
|
||||
import axios from "axios";
|
||||
import {getGoods} from "@/api/system/goods";
|
||||
import downloadUtil from '@/plugins/download';
|
||||
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -49,13 +54,19 @@ export default {
|
||||
qrCodeUrl: null,
|
||||
orderNo: null,
|
||||
payStatus:null,
|
||||
goodsResource: null,
|
||||
goodsId: null,
|
||||
goods: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.payUrl = this.$route.query.url;
|
||||
this.orderNo = this.$route.query.orderNo;
|
||||
this.goodsId = this.$route.query.id;
|
||||
this.getGood(this.goodsId);
|
||||
console.log('接收到的支付链接:', this.payUrl);
|
||||
console.log('接收到的订单号:', this.orderNo);
|
||||
console.log('接收到的id:', this.goodsId);
|
||||
this.generateQrCode()
|
||||
this.payStatus = 2;
|
||||
// 启动支付状态检查
|
||||
@ -66,6 +77,14 @@ export default {
|
||||
clearInterval(this.checkInterval);
|
||||
},
|
||||
methods: {
|
||||
/** 查询商品 */
|
||||
getGood(id) {
|
||||
getGoods(id).then(response => {
|
||||
this.goods = response.data;
|
||||
this.goodsResource = this.goods.resource;
|
||||
console.log('good',response)
|
||||
});
|
||||
},
|
||||
async generateQrCode() {
|
||||
if (this.payUrl) {
|
||||
try {
|
||||
@ -79,13 +98,6 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
whilePayStatus(){
|
||||
while(this.payStatus() === 2){
|
||||
getPayStatus(this.orderNo).then(response => {
|
||||
this.payStatus = response.data;
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
checkPayStatus() {
|
||||
this.checkInterval = setInterval(() => {
|
||||
@ -98,9 +110,23 @@ export default {
|
||||
}).catch(error => {
|
||||
console.error('获取支付状态失败:', error);
|
||||
});
|
||||
}, 2000); // 每5秒检查一次支付状态
|
||||
// 每3秒检查一次支付状态
|
||||
}, 3000);
|
||||
},
|
||||
|
||||
downloadFile() {
|
||||
const fileUrl = this.goodsResource;
|
||||
const name = this.goods.name;
|
||||
const timestamp = new Date().toISOString().replace(/[-:T]/g, '').split('.')[0];
|
||||
const fileNameWithTimestamp = `${name}_${timestamp}`;
|
||||
downloadUtil.zip(fileUrl,fileNameWithTimestamp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user