Browse Source

对接H5支付

master
梁欣 1 year ago
parent
commit
53d2c82764
  1. 2
      core/payment/alipay.js
  2. 1085
      pages/checkout/cashier/index.vue
  3. 14
      pages/goods/list.vue
  4. 4
      pages/index/index.vue
  5. 5
      pages/order/index.vue

2
core/payment/alipay.js

@ -6,7 +6,7 @@ import { PayMethodEnum } from '@/common/enum/payment'
* 发起支付请求 (用于H5) * 发起支付请求 (用于H5)
* @param {Object} option 参数 * @param {Object} option 参数
*/ */
const paymentAsH5 = option => {
export const paymentAsH5 = option => {
const options = { formHtml: '', ...option } const options = { formHtml: '', ...option }
// 跳转到支付宝支付页 // 跳转到支付宝支付页
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {

1085
pages/checkout/cashier/index.vue

File diff suppressed because it is too large

14
pages/goods/list.vue

@ -16,7 +16,10 @@
<view class="sort-item" :class="{ active: sortType === 'all' }" @click="handleSortType('all')"> <view class="sort-item" :class="{ active: sortType === 'all' }" @click="handleSortType('all')">
<text>综合</text> <text>综合</text>
</view> </view>
<view class="sort-item" :class="{ active: sortType === 'sales' }" @click="handleSortType('sales')">
<view class="sort-item" :class="{ active: sortType === 'category' }" @click="changeCategory">
<text>{{ categoryText }}</text>
</view>
<view class="sort-item" :class="{ active: sortType === 'sales' }" @click="handleSortType('sales')">
<text>销量</text> <text>销量</text>
</view> </view>
<view class="sort-item sort-item-price" :class="{ active: sortType === 'price' }" <view class="sort-item sort-item-price" :class="{ active: sortType === 'price' }"
@ -180,7 +183,10 @@
}, },
// 4 // 4
noMoreSize: 4, noMoreSize: 4,
}
},
mainCategoryId: 0, // id
categoryText: '全部分类',
childCategoryList: []
} }
}, },
@ -286,6 +292,10 @@
app.mescroll.resetUpScroll() app.mescroll.resetUpScroll()
}, },
changeCategory(category){
},
// //
handleShowView() { handleShowView() {
const app = this const app = this

4
pages/index/index.vue

@ -399,8 +399,8 @@
console.log('logut') console.log('logut')
}) })
uni.getStorageSync('t_id', options.id)
uni.getStorageSync('t_token', options.token)
uni.setStorageSync('t_id', options.id)
uni.setStorageSync('t_token', options.token)
_this.getUserInfo(options.id, options.token) _this.getUserInfo(options.id, options.token)
} }

5
pages/order/index.vue

@ -401,7 +401,10 @@
content: '确认要取消该订单吗?', content: '确认要取消该订单吗?',
success(o) { success(o) {
if (o.confirm) { if (o.confirm) {
OrderApi.cancel(orderId)
OrderApi.cancel(orderId, {
token: uni.getStorageSync('t_token'),
userId: uni.getStorageSync('t_id'),
})
.then(result => { .then(result => {
// //
app.$toast(result.message) app.$toast(result.message)

Loading…
Cancel
Save