|
@@ -229,7 +229,7 @@
|
|
<span>支付方式</span>
|
|
<span>支付方式</span>
|
|
</div>
|
|
</div>
|
|
<div class="pay-list">
|
|
<div class="pay-list">
|
|
- <div class="pay-item" @click.stop="payId = item.id" :class="payId == item.id ? 'pay-active' : '' " v-for="(item, index) in payList" :key="index">
|
|
|
|
|
|
+ <div class="pay-item" @click.stop="paymentType = item.id" :class="paymentType == item.id ? 'pay-active' : '' " v-for="(item, index) in payList" :key="index">
|
|
<img :src="item.icon" class="pay-icon" />
|
|
<img :src="item.icon" class="pay-icon" />
|
|
<span>{{ item.name }}</span>
|
|
<span>{{ item.name }}</span>
|
|
</div>
|
|
</div>
|
|
@@ -242,41 +242,19 @@
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
<!-- 支付二维码弹出层 -->
|
|
<!-- 支付二维码弹出层 -->
|
|
- <el-dialog width="1000px" class="pay-dialog" :show-close="false" destroy-on-close :visible.sync="payModal">
|
|
|
|
- <div class="pay-modal">
|
|
|
|
- <div class="pay-top">{{ payId == 1 ? '支付宝' : '微信' }}支付</div>
|
|
|
|
- </div>
|
|
|
|
- <div class="code-content">
|
|
|
|
- <div class="code-top">
|
|
|
|
- <div class="code-left">
|
|
|
|
- <div class="l-title">支付金额</div>
|
|
|
|
- <!-- <div class="l-price">预估¥8.80,优惠券抵扣¥2.00</div> -->
|
|
|
|
- </div>
|
|
|
|
- <div class="code-right">¥{{ payAmount }}</div>
|
|
|
|
- </div>
|
|
|
|
- <div class="code-bottom">
|
|
|
|
- <!-- <img src="../../../static/image/alipay.png" class="code-img" /> -->
|
|
|
|
- <div id="qrcode" class="code-img"></div>
|
|
|
|
- <div class="des">请使用手机打开{{ payId == 1 ? '支付宝' : '微信' }}扫描二维码完成支付</div>
|
|
|
|
- <div class="guo-qi" v-if="false">
|
|
|
|
- <span>点击刷新</span>
|
|
|
|
- 重新获取二维码
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- </el-dialog>
|
|
|
|
|
|
+ <qr-code v-if="showCode" @paySuccess="paySuccess" @refreshCode="recharge" @closeCode="showCode = false" ref="code" :payAmount="payAmount" :link="link" :paymentType="paymentType" :orderSn="orderSn"></qr-code>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import moment from "moment";
|
|
import moment from "moment";
|
|
import bus from "../../common/bus.js";
|
|
import bus from "../../common/bus.js";
|
|
-import QRCode from "qrcodejs2";
|
|
|
|
import orderMap from "./orderAMap.vue";
|
|
import orderMap from "./orderAMap.vue";
|
|
import OrderDetail from "./orderDetail.vue";
|
|
import OrderDetail from "./orderDetail.vue";
|
|
import orderTrack from "./orderTrack.vue";
|
|
import orderTrack from "./orderTrack.vue";
|
|
import { mapState } from "vuex";
|
|
import { mapState } from "vuex";
|
|
import sendOrderPopup from "./sendOrderPopup.vue";
|
|
import sendOrderPopup from "./sendOrderPopup.vue";
|
|
|
|
+import qrCode from "../../common/qrCode.vue";
|
|
import {
|
|
import {
|
|
sendValuation,
|
|
sendValuation,
|
|
waimaiprinter,
|
|
waimaiprinter,
|
|
@@ -297,8 +275,7 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
payAmount: 0,
|
|
payAmount: 0,
|
|
- payModal: false, // 二维码弹出层
|
|
|
|
- payId: 1,
|
|
|
|
|
|
+ paymentType: 1, // 1 支付宝 0 微信
|
|
payList: [
|
|
payList: [
|
|
{
|
|
{
|
|
id: 1,
|
|
id: 1,
|
|
@@ -353,6 +330,8 @@ export default {
|
|
orderDetail: {},
|
|
orderDetail: {},
|
|
showDetail: false,
|
|
showDetail: false,
|
|
showTrack: false,
|
|
showTrack: false,
|
|
|
|
+ showCode: false,
|
|
|
|
+ link: "",
|
|
};
|
|
};
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
@@ -364,6 +343,7 @@ export default {
|
|
orderMap,
|
|
orderMap,
|
|
OrderDetail,
|
|
OrderDetail,
|
|
orderTrack,
|
|
orderTrack,
|
|
|
|
+ qrCode,
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
tabNum(newVal, oldVal) {
|
|
tabNum(newVal, oldVal) {
|
|
@@ -395,37 +375,10 @@ export default {
|
|
...mapState(["userInfo"]),
|
|
...mapState(["userInfo"]),
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- getPayInfo(orderSn) {
|
|
|
|
- const _ = this;
|
|
|
|
- let params = {
|
|
|
|
- orderSn,
|
|
|
|
- payType: this.payId,
|
|
|
|
- };
|
|
|
|
- _.addTipTimer = setTimeout(() => {
|
|
|
|
- getPayResult(params).then((res) => {
|
|
|
|
- console.log(res, "查询支付结果");
|
|
|
|
- if (res.data === "success") {
|
|
|
|
- clearTimeout(_.addTipTimer);
|
|
|
|
- _.payModal = false;
|
|
|
|
- _.addTipStatus = false;
|
|
|
|
- bus.$emit("refreshData");
|
|
|
|
- } else {
|
|
|
|
- _.getPayInfo(orderSn);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }, 3000);
|
|
|
|
- },
|
|
|
|
- // 生成二维码
|
|
|
|
- qrcode(link) {
|
|
|
|
- let that = this;
|
|
|
|
- let qrcode = new QRCode("qrcode", {
|
|
|
|
- width: 260,
|
|
|
|
- height: 260, // 高度
|
|
|
|
- text: link, // 二维码内容
|
|
|
|
- // render: 'canvas' , // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
|
|
|
|
- // background: '#f0f', // 背景色
|
|
|
|
- // foreground: '#ff0' // 前景色
|
|
|
|
- });
|
|
|
|
|
|
+ paySuccess() {
|
|
|
|
+ this.showCode = false;
|
|
|
|
+ this.addTipStatus = false;
|
|
|
|
+ bus.$emit("refreshData");
|
|
},
|
|
},
|
|
richMoney() {
|
|
richMoney() {
|
|
let reg = /(^[1-9]\d*$)/g;
|
|
let reg = /(^[1-9]\d*$)/g;
|
|
@@ -437,20 +390,16 @@ export default {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- var idObject = document.getElementById("qrcode");
|
|
|
|
- if (idObject != null) {
|
|
|
|
- idObject.innerHTML = "";
|
|
|
|
- }
|
|
|
|
let params = {
|
|
let params = {
|
|
orderId: this.orderId,
|
|
orderId: this.orderId,
|
|
tipAmount:
|
|
tipAmount:
|
|
this.tipActive == -1 ? this.tipAmount : this.tipList[this.tipActive],
|
|
this.tipActive == -1 ? this.tipAmount : this.tipList[this.tipActive],
|
|
- paymentType: this.payId,
|
|
|
|
|
|
+ paymentType: this.paymentType,
|
|
createType: 1,
|
|
createType: 1,
|
|
};
|
|
};
|
|
tips(params).then((res) => {
|
|
tips(params).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
- if (this.payId == 4) {
|
|
|
|
|
|
+ if (this.paymentType == 4) {
|
|
// 余额支付
|
|
// 余额支付
|
|
this.$message({
|
|
this.$message({
|
|
message: "小费添加成功",
|
|
message: "小费添加成功",
|
|
@@ -459,18 +408,14 @@ export default {
|
|
bus.$emit("refreshData");
|
|
bus.$emit("refreshData");
|
|
this.addTipStatus = false;
|
|
this.addTipStatus = false;
|
|
this.tipAmount = "";
|
|
this.tipAmount = "";
|
|
- this.payModal = false;
|
|
|
|
clearTimeout(this.addTipTimer);
|
|
clearTimeout(this.addTipTimer);
|
|
this.addTipTimer = null;
|
|
this.addTipTimer = null;
|
|
- } else if (this.payId == 1 || this.payId == 2) {
|
|
|
|
|
|
+ } else if (this.paymentType == 1 || this.paymentType == 2) {
|
|
// 支付宝、微信支付
|
|
// 支付宝、微信支付
|
|
this.payAmount = res.data.amount || 0;
|
|
this.payAmount = res.data.amount || 0;
|
|
this.orderSn = res.data.orderSn;
|
|
this.orderSn = res.data.orderSn;
|
|
- this.payModal = true;
|
|
|
|
- this.$nextTick(() => {
|
|
|
|
- this.qrcode(res.data.data);
|
|
|
|
- });
|
|
|
|
- this.getPayInfo(res.data.orderSn);
|
|
|
|
|
|
+ this.link = res.data.data;
|
|
|
|
+ this.showCode = true;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
this.$message({
|
|
this.$message({
|
|
@@ -860,99 +805,6 @@ export default {
|
|
|
|
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
<style lang="scss" scoped="scoped">
|
|
<style lang="scss" scoped="scoped">
|
|
-.pay-dialog {
|
|
|
|
- /deep/ .el-dialog__header {
|
|
|
|
- padding: 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /deep/ .el-dialog__body {
|
|
|
|
- padding: 0px !important;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-.pay-modal {
|
|
|
|
- // border-radius: 16px;
|
|
|
|
- overflow: hidden;
|
|
|
|
-
|
|
|
|
- .pay-top {
|
|
|
|
- height: 80px;
|
|
|
|
- line-height: 80px;
|
|
|
|
- text-align: center;
|
|
|
|
- font-size: 22px;
|
|
|
|
- font-family: PingFang SC;
|
|
|
|
- font-weight: bold;
|
|
|
|
- color: #ffffff;
|
|
|
|
- background: url(../../../static/image/pay-bg.png) no-repeat;
|
|
|
|
- background-size: 100% 100%;
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-.code-content {
|
|
|
|
- width: 640px;
|
|
|
|
- margin: 40px auto 0;
|
|
|
|
- padding-bottom: 100px;
|
|
|
|
- box-sizing: border-box;
|
|
|
|
-
|
|
|
|
- .code-top {
|
|
|
|
- display: flex;
|
|
|
|
- justify-content: space-between;
|
|
|
|
- align-items: center;
|
|
|
|
- padding: 14px 20px;
|
|
|
|
-
|
|
|
|
- .code-left {
|
|
|
|
- .l-title {
|
|
|
|
- font-size: 14px;
|
|
|
|
- font-family: PingFang SC;
|
|
|
|
- font-weight: bold;
|
|
|
|
- color: #0d1e40;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .l-price {
|
|
|
|
- font-size: 14px;
|
|
|
|
- font-family: PingFang SC;
|
|
|
|
- font-weight: 400;
|
|
|
|
- color: #9ea7b7;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .code-right {
|
|
|
|
- font-size: 24px;
|
|
|
|
- font-family: PingFang SC;
|
|
|
|
- font-weight: 600;
|
|
|
|
- color: #f74141;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .code-bottom {
|
|
|
|
- text-align: center;
|
|
|
|
- padding-top: 30px;
|
|
|
|
-
|
|
|
|
- .code-img {
|
|
|
|
- width: 260px;
|
|
|
|
- height: 260px;
|
|
|
|
- margin: 0 auto;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .des {
|
|
|
|
- font-size: 14px;
|
|
|
|
- font-family: PingFang SC;
|
|
|
|
- font-weight: 400;
|
|
|
|
- color: #0d1e40;
|
|
|
|
- margin: 10px 0 20px 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- .guo-qi {
|
|
|
|
- font-size: 14px;
|
|
|
|
- font-family: PingFang SC;
|
|
|
|
- font-weight: 400;
|
|
|
|
- color: #9ea7b7;
|
|
|
|
-
|
|
|
|
- span {
|
|
|
|
- color: #175199;
|
|
|
|
- cursor: pointer;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
.choose-self {
|
|
.choose-self {
|
|
padding-top: 25px;
|
|
padding-top: 25px;
|
|
border-bottom: 1px solid #eee;
|
|
border-bottom: 1px solid #eee;
|