Browse Source

订单结算页面

master
wanghongjun 2 years ago
parent
commit
8a94565540
  1. 25
      api/goods.js
  2. 16
      pages.json
  3. 263
      pages/goods/payment/orderPayment.vue
  4. 4
      pages/user/mycertinfo/orgverify.vue
  5. 1
      store/modules/user.js

25
api/goods.js

@ -11,6 +11,9 @@ const api = {
souser:"tes/api/Goods/searchUsers",
sogoods: "AgencyAddress/order/searchGoods",
addShoppingCaUrl: "AgencyAddress/order/addShoppingCa",
createOrder: "AgencyAddress/order/createOrder",
paymentListUrl: "Paymentlist/certiaudit/listIndet",
certificationPay: "PayCallBack/order/certificationPay",
}
// 商品列表
@ -48,6 +51,7 @@ export const souser = (data) => {
return request.post(api.souser, data )
}
// 加入购物车
export const addShoppingCa = (data) => {
return request.post(
api.addShoppingCaUrl +
@ -56,3 +60,24 @@ export const addShoppingCa = (data) => {
'&use_years=' + data.use_years
)
}
// 立即购买
export const createOrder = (data) => {
return request.post(
api.createOrder +
'?goods_isli=' + data.goods_isli +
'&is_car=' + data.is_car +
'&user_isli=' + data.user_isli +
'&use_years=' + data.use_years
)
}
// 缴费订单列表
export const paymentList = (data) => {
return request.get(api.paymentListUrl,data)
}
// 缴费订单列表
export const certificationPay = (paramStr) => {
return request.post(api.certificationPay + paramStr,{})
}

16
pages.json

@ -355,6 +355,22 @@
"navigationBarTitleText" : "文化数字内容",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/user/shopcart/index",
"style" :
{
"navigationBarTitleText" : "购物车",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/goods/payment/orderPayment",
"style" :
{
"navigationBarTitleText" : "订单结算",
"enablePullDownRefresh" : false
}
}
],
"globalStyle": {

263
pages/goods/payment/orderPayment.vue

@ -0,0 +1,263 @@
<template>
<view class="container">
<view class="item-pay">
<view class="item-pay-con">
<view class="item-pay-con-ti">选择支付方式</view>
<button class="item-pay-con-bu" :class="{'item-pay-con-bu-show': payType === items.value}" v-for="items in payTypeArr" @click="changePayType(items.value)">{{items.title}}</button>
</view>
<view class="item-pay-con">
<view class="item-pay-con-ti">
认证缴费订单
</view>
<view class="item-pay-con-tab">
<uni-table ref="table" :loading="loading" border stripe emptyText="暂无更多数据">
<uni-tr>
<uni-th width="140" align="center">订单号</uni-th>
<uni-th width="120" align="center">姓名</uni-th>
<uni-th align="center">订单金额</uni-th>
</uni-tr>
<uni-tr v-for="(item, index) in tableList" :key="index">
<uni-td>{{ item.pay_no }}</uni-td>
<uni-td>
<view class="name">认证缴费订单</view>
</uni-td>
<uni-td align="center">{{ item.address }}</uni-td>
</uni-tr>
</uni-table>
<view class="uni-pagination-box"><uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="change" /></view>
</view>
</view>
</view>
<view class="item-pay">
<image class="item-pay-img" v-if="is_show_img" :src="pay_image"></image>
<text class="item-pay-prompt" v-if="is_show_img">请扫码支付</text>
<button class="item-pay-sub" :disabled="isDisabled" @click="handlerPay">确认支付</button>
</view>
</view>
</template>
<script>
import * as GoodsApi from '@/api/goods'
import uniTable from "@/uni_modules/uni-table/components/uni-table/uni-table"
import uniTr from "@/uni_modules/uni-table/components/uni-tr/uni-tr"
import uniTh from "@/uni_modules/uni-table/components/uni-th/uni-th"
import uniTd from "@/uni_modules/uni-table/components/uni-td/uni-td"
import uniPagination from "@/uni_modules/uni-pagination/components/uni-pagination/uni-pagination"
export default {
name: "payment",
components: {
'uni-table': uniTable,
'uni-tr': uniTr,
'uni-th': uniTh,
'uni-td': uniTd,
'uni-pagination': uniPagination,
},
data () {
return {
tableList: [],
payTypeArr: [
{
title: '网银支付',
value: 15
},{
title: '支付宝',
value: 12
},
],
payType: 15,
loading: false,
selectedIndexs: [],
pageSize: 10, //
pageCurrent: 1, //
total: 0, //
good_money: 0, //
isDisabled: false, //
is_show_img: false, //
pay_image: '', //
}
},
onLoad() {
this.selectedIndexs = []
this.getTableList()
},
methods: {
//
changePayType(val) {
this.payType = val
},
//
change(e) {
this.$refs.table.clearSelection()
this.selectedIndexs.length = 0
this.getData(e.current)
},
//
getTableList(pageNo = 1) {
const app = this
let param = {
userid : uni.getStorageSync("accountId"),
isok : 2,
}
return new Promise((resolve, reject) => {
GoodsApi.paymentList(param).then(res => {
if (res.resultCode === "00000000") {
app.tableList = res.data
//app.good_money = res.data[0].paysum
} else {
app.$error(res.errMsg);
}
resolve()
}).catch(reject)
})
},
//
handlerPay () {
const app = this
let shopnameArr = []
let shop_price_arr = []
app.tableList.forEach((item) => {
shopnameArr.push = item.pay_no
shop_price_arr.push = item.paysum
})
let shopname = shopnameArr.join(',')
let shop_price = shop_price_arr.join(',')
let new_shop_Name = ''
let Merchant_id = uni.getStorageSync("Merchant_id") // id
let accountId = uni.getStorageSync("accountId") // isli
//
let manyMony = 0;
manyMony = (Number(app.good_money * 100)).toFixed(0);
let payment = {
amount: manyMony, //
app_id: Merchant_id, //id
body: "认证缴费订单", //
businesstype: 1001, //1001-2001-
ordernumber: shopname, //
paymenttypeid: app.payType, //1213 15
subpaymenttypeid: app.payType, //1213 15
businesstime: app.getDayTimer(new Date()),
buyer: accountId, //() isli
chargeuptype: 2, //1-2-,
goodsname: "认证缴费订单", //
orderamount: manyMony, //()
payorderid: shopname, //
price: shop_price, //()
seller: accountId, //()
settlementamount: manyMony, //()
settlementtype: 2, //:1-;2-
totalqty: 1 //
}
if (new_shop_Name == "") {
app.isDisabled = true
payment.body = encodeURIComponent(payment.body, "ut-8")
payment.goodsname = encodeURIComponent(payment.goodsname, "ut-8")
//
let paramArr = '';
for (let key in payment) {
paramArr.push(key + '=' + payment[key])
}
let paramStr = '?' + paramArr.join('&')
GoodsApi.certificationPay(paramStr).then(res => {
if (res.resultCode == '00000000') {
if (app.payType != 15) {
app.is_show_img = true
app.pay_image = res.data.qrcodeurl
} else {
app.$success('支付成功')
this.getTableList()
}
}
})
} else {
app.$error(new_shop_Name + "无法购买")
}
},
//
getDayTimer (data) {
let date = new Date(data)
let y = date.getFullYear()
let m = date.getMonth() + 1
m = m < 10 ? ('0' + m) : m
let d = date.getDate()
d = d < 10 ? ('0' + d) : d
let currentdate = y + '-' + m + '-' + d;
let hh = date.getHours()
hh = hh < 10 ? ('0' + hh) : hh
let mm = date.getMinutes()
mm = mm < 10 ? ('0' + mm) : mm
let ss = date.getSeconds()
ss = ss < 10 ? ('0' + ss) : ss
let time = hh + ':' + mm + ':' + ss;
return currentdate + " " + time
},
}
}
</script>
<style lang="scss" scoped>
.container {
width: 100%;
.item-pay {
.item-pay-con {
margin-top: 30rpx;
padding-top: 30rpx;
.item-pay-con-ti {
height: 50rpx;
margin-left: 20rpx;
padding-left: 10px;
border-left: #407ac4 10rpx solid;
display: flex;
align-items: center;
text-align: center;
}
.item-pay-con-bu {
width: 200rpx;
margin-top: 30rpx;
margin-left: 50rpx;
border-radius: 15rpx;
display: inline-block;
border: #e5e5e5 1rpx solid;
background-color: #e5e5e5;
}
.item-pay-con-bu-show {
background-color: #defedc;
}
}
.item-pay-sub {
color: #ffffff;
margin-top: 200rpx;
background-color: #407ac4;
}
.item-pay-img {
width: 200px;
height: 200px;
margin-top: 15%;
margin-left: 25%;
background-color: #eeeeee;
}
.item-pay-prompt {
display: block;
text-align: center;
color: red;
}
}
}
</style>

4
pages/user/mycertinfo/orgverify.vue

@ -1160,7 +1160,11 @@ export default {
})
},
jumpUrl() {
if (this.fee > 0) {
uni.reLaunch({url: "/pages/goods/payment/orderPayment"})
} else {
uni.reLaunch({url: "/pages/user/index"})
}
},
},
}

1
store/modules/user.js

@ -21,6 +21,7 @@ const loginSuccess = (commit, { token, user }, userObj = {}) => {
userType = 2
}
storage.set("userType",userType)
storage.set("Merchant_id",'910000198') //商户id
// 记录到store全局变量
commit('SET_TOKEN', token)
commit('SET_ACCOUNT_ID', user.accountId)

Loading…
Cancel
Save