Payment flow refine

This commit is contained in:
Vion 2022-01-23 16:50:49 +08:00
parent 9b4f71074a
commit 8ff86279a0
9 changed files with 83 additions and 53 deletions

View File

@ -82,7 +82,6 @@ export const isexistCart = (id, pet, address) => {
* 删除购物车 * 删除购物车
*/ */
export const deleteCart = ( productCode) => { export const deleteCart = ( productCode) => {
debugger;
var data = { var data = {
productCode productCode
} }

View File

@ -4,9 +4,11 @@ body {
line-height: 1.5; line-height: 1.5;
color: #666; color: #666;
} }
.ts-crumbs { /deep/.el-button--primary {
background-color: #e1001a;
color:#fff;
} }
.rc-menu--xs .rc-screen-reader{ .rc-menu--xs .rc-screen-reader{
left:28%; left:28%;
} }

View File

@ -459,11 +459,11 @@ export default {
font-size: 16px; font-size: 16px;
margin-left: 2px; margin-left: 2px;
width:100%; width:100%;
padding-bottom:.25rem; padding-bottom:.5rem;
background:url("../assets/image/ico-location.png") no-repeat 98% center; background:url("../assets/image/ico-location.png") no-repeat 98% center;
background-size:16px; background-size:16px;
position:relative; position:relative;
top:.5rem; top:.45rem;
padding-left:.875rem; padding-left:.875rem;
} }
.ts-area-picker-mobile{ .ts-area-picker-mobile{

View File

@ -14,6 +14,7 @@
</template> </template>
<script> <script>
import { mapMutations } from "vuex";
export default { export default {
data(){ data(){
return{ return{
@ -39,6 +40,7 @@ export default {
} }
}, },
methods:{ methods:{
...mapMutations(["checkIsLogin"]),
lianxi(item,index){ lianxi(item,index){
if(item.title=='在线客服'){ if(item.title=='在线客服'){
var option = { var option = {
@ -85,10 +87,14 @@ export default {
this.gotop = false this.gotop = false
} }
} }
},
created(){
}, },
mounted(){ mounted(){
//Check login //Check login
let usernot=JSON.parse(localStorage.getItem("userInfo")); this.checkIsLogin();
let usernot = this.$store.state.userInfo;
//console.log(usernot); //console.log(usernot);
if(usernot==null ||usernot==undefined){ if(usernot==null ||usernot==undefined){
this.loginornot=true this.loginornot=true

View File

@ -24,7 +24,9 @@ export default {
'/usersearch/search':'产品搜索', '/usersearch/search':'产品搜索',
'/personal/mypersonal':'个人中心', '/personal/mypersonal':'个人中心',
'/personal/usermember/':'会员权益', '/personal/usermember/':'会员权益',
'/personal/integral/':'积分明细' '/personal/integral/':'积分明细',
'/personal/settlement/':'订单确认',
'/myorder/userrecord/':'购物车'
}, },
}; };
}, },
@ -43,26 +45,29 @@ export default {
}, },
methods: { methods: {
...mapMutations(["changemessage",'selectMenu']), //...mapMutations(["changemessage",'selectMenu']),
build() { build() {
let _self = this; let _self = this;
this.displayData=[]; this.displayData=[];
this.crumbs.forEach(function(ele,index){ if(this.crumbs && this.crumbs.length>0)
let displayObj= {path:'',title:''}; {
if(ele.path) { this.crumbs.forEach(function(ele,index){
displayObj.path = ele.path; let displayObj= {path:'',title:''};
for(let path in _self.nameMapping) { if(ele.path) {
if(ele.path.indexOf(path)>-1) { displayObj.path = ele.path;
displayObj.path = path; for(let path in _self.nameMapping) {
displayObj.title = _self.nameMapping[path]; if(ele.path.indexOf(path)>-1) {
displayObj.path = path;
displayObj.title = _self.nameMapping[path];
}
} }
} }
} if(ele.title) {
if(ele.title) { displayObj.title = ele.title;
displayObj.title = ele.title; }
} _self.displayData.push(displayObj);
_self.displayData.push(displayObj); });
}); }
} }
} }
}; };

View File

@ -1,10 +1,10 @@
<template> <template>
<div> <div>
<div class="rc-header"> <Myheader></Myheader>
<Myheader></Myheader> <div class="rc-top"></div>
</div> <tabs :crumbs="crumbs"></tabs>
<div class="rc-main">
<tabs></tabs> <div class="rc-main rc-max-width--xl">
<div class="cart-list"> <div class="cart-list">
<div class="header"> <div class="header">
<div class="list-left"> <div class="list-left">
@ -114,12 +114,21 @@
import Myheader from "~/components/header.vue"; import Myheader from "~/components/header.vue";
import MyFooter from '~/components/rc-footer.vue' import MyFooter from '~/components/rc-footer.vue'
import tabs from "@/components/tabs.vue"; import tabs from "@/components/tabs.vue";
import { mapMutations } from "vuex";
import { isexistCart, generateOrderWX, deleteCart } from "../../ajax/getData"; import { isexistCart, generateOrderWX, deleteCart } from "../../ajax/getData";
export default { export default {
middleware: "metaTitle", middleware: "metaTitle",
meta: { title: "购物车" }, meta: { title: "购物车" },
data() { data() {
return { return {
crumbs:[
{
path:'/productdetails/productlist/',
},
{
path:'/myorder/userrecord/'
}
],
ordersum: 1, ordersum: 1,
usercheckbox: false, usercheckbox: false,
shopnum: 0, shopnum: 0,
@ -174,26 +183,26 @@ export default {
}, },
mounted() { mounted() {
this.carmessage(); this.carmessage();
this.checkIsLogin();
}, },
components: { components: {
Myheader, Myheader,
tabs, tabs,
MyFooter, MyFooter
}, },
methods: { methods: {
// //
...mapMutations(["checkIsLogin"]),
async carmessage() { async carmessage() {
let user = JSON.parse(localStorage.getItem("userInfo")); let user = this.$store.state.userInfo;
this.userid = user.data.id; this.userid = user.data.id;
let data = await isexistCart(user.data.id); let data = await isexistCart(user.data.id);
this.cartData = data; this.cartData = data;
// this.goldmedal = data; // this.goldmedal = data;
}, },
async userjie(list) { async userjie(list) {
let user = JSON.parse(localStorage.getItem("userInfo")); let user = this.$store.state.userInfo;
console.log(user);
this.userid = user.data.id; this.userid = user.data.id;
let data = await generateOrderWX(list); let data = await generateOrderWX(list);
if (data) { if (data) {
@ -201,7 +210,6 @@ export default {
type: "warning", type: "warning",
message: data.msg, message: data.msg,
}); });
console.log(data);
this.$router.push({ this.$router.push({
path: "/personal/settlement", path: "/personal/settlement",
query: { query: {
@ -209,12 +217,11 @@ export default {
}, },
}); });
} }
console.log(data);
}, },
// //
async deletsmessage(productCode) { async deletsmessage(productCode) {
let user = JSON.parse(localStorage.getItem("userInfo")); let user = this.$store.state.userInfo;
this.userid = user.data.id; this.userid = user.data.id;
let data = await deleteCart( productCode); let data = await deleteCart( productCode);
if (data) { if (data) {
@ -287,7 +294,6 @@ export default {
if (this.ys1 == false) { if (this.ys1 == false) {
this.$nextTick(() => { this.$nextTick(() => {
this.userdelete = "删除"; this.userdelete = "删除";
console.log(this.userdelete);
}); });
} else if (this.ys1 == true) { } else if (this.ys1 == true) {
this.$nextTick(() => { this.$nextTick(() => {
@ -504,10 +510,6 @@ export default {
} }
} }
.rc-main { .rc-main {
width: 92%;
margin: 0 auto;
padding-top: 60px;
max-width: 1400px;
.cart-list { .cart-list {
width: 100%; width: 100%;
border: 1px solid #d7d7d7; border: 1px solid #d7d7d7;
@ -775,8 +777,8 @@ export default {
width: 100%; width: 100%;
} }
ul { ul {
margin-top: -32px; margin-top: -2rem;
margin-left: 140px; margin-left: 9.75rem;
width: 50%; width: 50%;
.del { .del {
display: none; display: none;
@ -796,6 +798,7 @@ export default {
bottom: 0; bottom: 0;
width: 100%; width: 100%;
z-index: 10; z-index: 10;
margin-bottom:0;
.rc-shop { .rc-shop {
display: none; display: none;
} }

View File

@ -10,7 +10,7 @@ ul li ol li em strong i {
.settlement { .settlement {
padding-top: 60px;
} }
@ -465,7 +465,9 @@ ul li ol li em strong i {
display: none; display: none;
border: none; border: none;
padding: 0; padding: 0;
&.show {
display:block;
}
&.active { &.active {
display: block; display: block;
border: none; border: none;

View File

@ -1,9 +1,7 @@
<template> <template>
<div class="settlement"> <div class="settlement">
<Myheader></Myheader> <Myheader></Myheader>
<div class="rc-main"> <div class="rc-top"></div>
<tabs></tabs>
</div>
<div class="rc_contline"></div> <div class="rc_contline"></div>
<div class="rc-main"> <div class="rc-main">
<div class="address-list"> <div class="address-list">
@ -28,7 +26,7 @@
<span>{{ item.address }}</span> <span>{{ item.address }}</span>
</div> </div>
</div> </div>
<div class="mypersonal add"> <div class="mypersonal add" :class="useraddress.length>0?'':'show'">
<div <div
class="my-delivery" class="my-delivery"
@click="addAddress" @click="addAddress"
@ -67,10 +65,12 @@
<span>配送方式:</span> <span>配送方式:</span>
<i>{{ shopprice.price }}</i> <i>{{ shopprice.price }}</i>
</li> </li>
<!--
<li> <li>
<span> 活动促销:</span> <span> 活动促销:</span>
<i>{{ shopprice.distribution }}</i> <i>{{ shopprice.distribution }}</i>
</li> </li>
-->
<li> <li>
<span>商品总价:</span> <span>商品总价:</span>
<i class="red">{{ sumPrice }}</i> <i class="red">{{ sumPrice }}</i>
@ -162,6 +162,14 @@ export default {
meta: { title: "订单结算" }, meta: { title: "订单结算" },
data() { data() {
return { return {
crumbs:[
{
path:'/productdetails/productlist/',
},
{
path:'/personal/settlement'
}
],
goldmedal: [], goldmedal: [],
dialogAddTitle: "", dialogAddTitle: "",
addressstype: null, addressstype: null,
@ -276,7 +284,9 @@ export default {
let orderAddress = this.useraddress.filter((item) => item.isDefault); let orderAddress = this.useraddress.filter((item) => item.isDefault);
let postData = []; let postData = [];
this.goldmedal.forEach((item) => { this.goldmedal.forEach((item) => {
let basePoint = (item.basePoint?item.basePoint:0);
let oneProduct = { let oneProduct = {
basePoint:basePoint,
productName: item.productName, productName: item.productName,
buyCount: item.buyCount, buyCount: item.buyCount,
productId: item.productCode, productId: item.productCode,
@ -354,7 +364,7 @@ export default {
postData[0].orderAddress.addressPhoneNumber, postData[0].orderAddress.addressPhoneNumber,
// wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz", // wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz",
// wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz", // wxPay: "weixin://wxpay/bizpayurl?pr=4RJbokxzz",
wxPay: res.data, wxPay: res.msg,
}; };
this.$router.push({ this.$router.push({
path: "/personal/userpay", path: "/personal/userpay",

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="page_modules"> <div class="page_modules">
<Myheader></Myheader> <Myheader></Myheader>
<div class="rc-top rc-md-up"></div>
<div class="cont_modules"> <div class="cont_modules">
<tabs></tabs>
<el-row class="order_info"> <el-row class="order_info">
<el-col :span="6" class="ph_hidden"> <el-col :span="6" class="ph_hidden">
<ul class="li_inline"> <ul class="li_inline">
@ -19,7 +19,7 @@
<el-col :span="6" class="ready_right"> <el-col :span="6" class="ready_right">
<div class="inline_right"> <div class="inline_right">
<p>付款金额:</p> <p>付款金额:</p>
<p class="price">{{ userPayData.userprice }}</p> <p class="price">{{ userPayData.userprice }}</p>
</div> </div>
<div class="inline_right"> <div class="inline_right">
<p>收货信息:</p> <p>收货信息:</p>
@ -93,16 +93,19 @@ export default {
return { return {
activeIndex: 0, activeIndex: 0,
isSucess: false, isSucess: false,
dialogSuccess: false,
paytype: "微信", paytype: "微信",
userpaystype: [ userpaystype: [
{ {
paytype: "微信", paytype: "微信",
payimage: require("../../assets/pay/wx.png"), payimage: require("../../assets/pay/wx.png"),
}, },
/*
{ {
paytype: "支付宝", paytype: "支付宝",
payimage: require("../../assets/pay/zfb.png"), payimage: require("../../assets/pay/zfb.png"),
}, },
*/
], ],
dialogFail: false, dialogFail: false,
userPayData: {}, userPayData: {},
@ -145,7 +148,7 @@ export default {
// //
async payOrderWX() { async payOrderWX() {
let res = await updateOrderWX(); let res = await updateOrderWX(this.userPayData.orderId);
if (res.success) { if (res.success) {
this.qrtext = '成功加入群的二维码'; this.qrtext = '成功加入群的二维码';
this.dialogSuccess = true; this.dialogSuccess = true;
@ -294,7 +297,7 @@ export default {
} }
} }
.paycord { .paycord {
display: none; //display: none;
} }
} }
</style> </style>