更新
This commit is contained in:
parent
60bb16a34e
commit
af7a76a450
45
api/payment.js
Normal file
45
api/payment.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
import request from "@/utils/request.js";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加购物车
|
||||||
|
*/
|
||||||
|
export function addCart(data) {
|
||||||
|
return request.post(`user/cart/create`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据店铺id 获取店铺信息
|
||||||
|
*/
|
||||||
|
export function getProductInfo(data) {
|
||||||
|
return request.get(`scanPay/product`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单校验
|
||||||
|
*/
|
||||||
|
export function orderCheck(data) {
|
||||||
|
return request.post(`v2/order/check`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成订单
|
||||||
|
*/
|
||||||
|
export function orderPay(data) {
|
||||||
|
return request.post(`v2/order/create`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成二维码
|
||||||
|
*/
|
||||||
|
export function qrcode(data) {
|
||||||
|
return request.get(`scanPay/qrcode`, data);
|
||||||
|
}
|
@ -35,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
getArticleList(){
|
getArticleList(){
|
||||||
getArticleList(25).then(res=>{
|
getArticleList(25).then(res=>{
|
||||||
this.info = res.data.list[0]
|
this.info = res.data.list[1]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
14
pages.json
14
pages.json
@ -109,6 +109,20 @@
|
|||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/payment/get_payment",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "面对面收款",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/payment/settlement",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "支付",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/news_list/index",
|
"path": "pages/news_list/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
@ -9,9 +9,12 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="town_name">{{ street||'定位中' }}</view>
|
<view class="town_name">{{ street||'定位中' }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="display: flex;">
|
||||||
|
<view class="iconfont icon-saoma" @click="scanQRcode" style="color:#fff;margin-right: 20rpx;"> </view>
|
||||||
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
|
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
|
||||||
<view :class="['iconfont','icon-xiaoxi',isFshow?'sitebox':'']" style="color:#fff;"></view>
|
<view :class="['iconfont','icon-xiaoxi',isFshow?'sitebox':'']" style="color:#fff;"></view>
|
||||||
</navigator>
|
</navigator>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
@ -24,9 +27,12 @@
|
|||||||
<view class="iconfont icon-weizhi"></view>
|
<view class="iconfont icon-weizhi"></view>
|
||||||
<view class="town_name">{{ street||'定位中' }}</view>
|
<view class="town_name">{{ street||'定位中' }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view style="display: flex;">
|
||||||
|
<view class="iconfont icon-saoma" @click="scanQRcode" style="color:#fff;margin-right: 20rpx;"> </view>
|
||||||
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
|
<navigator url="/pages/chat/customer_list/index?type=0" hover-class="none">
|
||||||
<view class="iconfont icon-xiaoxi" style="color:#fff;"> </view>
|
<view class="iconfont icon-xiaoxi" style="color:#fff;"> </view>
|
||||||
</navigator>
|
</navigator>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <navigator url="/pages/columnGoods/goods_search/index" hover-class="none"
|
<!-- <navigator url="/pages/columnGoods/goods_search/index" hover-class="none"
|
||||||
class="search_content flex_a_c_j_sb home_search">
|
class="search_content flex_a_c_j_sb home_search">
|
||||||
@ -59,7 +65,7 @@
|
|||||||
</image>
|
</image>
|
||||||
<view class="right">
|
<view class="right">
|
||||||
<image class="top"
|
<image class="top"
|
||||||
@click="navgo(`/pages/nongKe/supply_chain/supplierB?type_id=10,17&street_id=${street_id}&townName=${town}`)"
|
@click="navgo(`/pages/nongKe/supply_chain/supplierB?type_id=10,17,21&street_id=${street_id}&townName=${town}`)"
|
||||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/home_img/home_shichang.webp">
|
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/public/uploads/home_img/home_shichang.webp">
|
||||||
</image>
|
</image>
|
||||||
<image class="bottom"
|
<image class="bottom"
|
||||||
@ -379,6 +385,25 @@
|
|||||||
},
|
},
|
||||||
// #endif
|
// #endif
|
||||||
methods: {
|
methods: {
|
||||||
|
scanQRcode(){
|
||||||
|
uni.scanCode({
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res);
|
||||||
|
if(res.result && res.result.includes('pages/payment/get_payment')){
|
||||||
|
let url = res.result.replace(/.*lihaink.cn/g, '');
|
||||||
|
uni.navigateTo({
|
||||||
|
url: url,
|
||||||
|
fail: () => {
|
||||||
|
Toast('跳转页面失败')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Toast('无效的二维码')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
closeActivityCard() {
|
closeActivityCard() {
|
||||||
this.$refs.activityPopup.close();
|
this.$refs.activityPopup.close();
|
||||||
},
|
},
|
||||||
|
347
pages/payment/get_payment.vue
Normal file
347
pages/payment/get_payment.vue
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
<template>
|
||||||
|
<view class="container" v-if="merchantInfo">
|
||||||
|
<view style="height: var(--status-bar-height);"></view>
|
||||||
|
|
||||||
|
<view class="v-navbar">
|
||||||
|
<u-navbar title="面对面收款" @rightClick="rightClick" :autoBack="true" :fixed="false" bgColor="transparent"
|
||||||
|
leftIconColor="#fff" :titleStyle="{color:'#fff',fontWeight:'bold',fontSize:'32rpx'}">
|
||||||
|
</u-navbar>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="v-desc">
|
||||||
|
<view class="v-desc-main">付款给商家</view>
|
||||||
|
<view class="v-desc-sub">{{merchantInfo.merchant.mer_name}}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 店铺图片 -->
|
||||||
|
<view class="v-shop-img">
|
||||||
|
<u-image :showLoading="true" :src="merchantInfo.merchant.mer_avatar" width="182rpx" height="182rpx"
|
||||||
|
:radius="10" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 付款金额 -->
|
||||||
|
<view class="v-con">
|
||||||
|
<view class="v-con-text">付款金额</view>
|
||||||
|
<view class="v-con-input">
|
||||||
|
<u--input type="number" maxlength="5" fontSize="23" v-model="cartForm.total_amount" placeholder="请输入金额"
|
||||||
|
border="none" placeholderStyle="color:#999;font-size:30rpx">
|
||||||
|
<u--text size="23" color="#303133" text="¥" slot="prefix" margin="0 3px 0 0" type="tips"></u--text>
|
||||||
|
</u-input>
|
||||||
|
</u--input>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="v-wrap" v-if="cartForm.total_amount">
|
||||||
|
<view class="v-wrap-money">
|
||||||
|
<text class="icon">¥</text>
|
||||||
|
<text class="num">{{cartForm.total_amount}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="v-wrap-desc">
|
||||||
|
<view class="v-wrap-desc-main">实物提货券</view>
|
||||||
|
<view class="v-wrap-desc-sub">即买即用</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="v-btn" @click="submitOrder">提交订单</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getProductInfo,
|
||||||
|
addCart,
|
||||||
|
orderCheck
|
||||||
|
} from "@/api/payment.js";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
cartForm: {
|
||||||
|
product_id: '',
|
||||||
|
product_attr_unique: '',
|
||||||
|
cart_num: 1,
|
||||||
|
is_new: 1,
|
||||||
|
product_type: 0,
|
||||||
|
source: 999,
|
||||||
|
total_amount: ''
|
||||||
|
},
|
||||||
|
merchantInfo: '',
|
||||||
|
checkForm: {
|
||||||
|
address_id: '',
|
||||||
|
cart_id: [],
|
||||||
|
consumption_id: '',
|
||||||
|
product_type: 0,
|
||||||
|
source: 999,
|
||||||
|
takes: [],
|
||||||
|
use_coupon: {},
|
||||||
|
use_integral: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
// mer_id
|
||||||
|
this.getProductInfoByMerid();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
// 提交订单
|
||||||
|
submitOrder() {
|
||||||
|
if (!this.cartForm.total_amount) {
|
||||||
|
return this.$util.Tips({
|
||||||
|
title: "请输入付款金额!"
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 订单
|
||||||
|
this.cartForm.product_id = this.merchantInfo.product_id;
|
||||||
|
this.cartForm.product_type = this.merchantInfo.product_type;
|
||||||
|
this.cartForm.product_attr_unique = this.merchantInfo.sku[''].unique;
|
||||||
|
|
||||||
|
|
||||||
|
let that = this;
|
||||||
|
addCart(this.cartForm).then(res => {
|
||||||
|
// 购物车ID
|
||||||
|
this.checkForm.cart_id.push(res.data.cart_id);
|
||||||
|
this.$util.Tips({
|
||||||
|
title: "添加购物车成功!"
|
||||||
|
}, () => {
|
||||||
|
orderCheck(that.checkForm).then(res => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/payment/settlement?cartId=" + this.checkForm
|
||||||
|
.cart_id + "&money=" + this.cartForm.total_amount +
|
||||||
|
"&merName=" + this.merchantInfo.merchant.mer_name
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}).catch(() => {
|
||||||
|
this.$util.Tips({
|
||||||
|
title: "添加购物车失败!"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
getProductInfoByMerid() {
|
||||||
|
let that = this;
|
||||||
|
getProductInfo({
|
||||||
|
mer_id: 31
|
||||||
|
}).then(res => {
|
||||||
|
this.merchantInfo = res.data;
|
||||||
|
}).catch((err) => {
|
||||||
|
that.$util.Tips({
|
||||||
|
title: err.message
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSavePic() {
|
||||||
|
// 获取要保存的图片路径或URL
|
||||||
|
let imageUrl = this.qrcodeUrl; // 这里使用了网络上的图片作为示例
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
var a = document.createElement("a");
|
||||||
|
a.download = imageUrl;
|
||||||
|
a.href = imageUrl;
|
||||||
|
document.body.appendChild(a);
|
||||||
|
a.click();
|
||||||
|
a.remove();
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef H5
|
||||||
|
let that = this;
|
||||||
|
uni.downloadFile({
|
||||||
|
url: imageUrl,
|
||||||
|
success(res) {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
let tempFilePath = res.tempFilePath; // 临时文件路径
|
||||||
|
uni.saveImageToPhotosAlbum({
|
||||||
|
filePath: tempFilePath,
|
||||||
|
success() {
|
||||||
|
return that.$util.Tips({
|
||||||
|
title: '图片已保存至相册!'
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.error('保存失败', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.error('下载失败', res.statusCode);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.error('下载失败', err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
page {
|
||||||
|
background-color: #FCE9B2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
position: relative;
|
||||||
|
background-image: url("https://lihai001.oss-cn-chengdu.aliyuncs.com/def/c582c202402291601584806.webp");
|
||||||
|
background-size: 100% auto;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
padding-top: 88rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
|
||||||
|
.v-navbar {
|
||||||
|
margin-bottom: 54rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-desc {
|
||||||
|
margin-left: 30rpx;
|
||||||
|
margin-bottom: 124rpx;
|
||||||
|
|
||||||
|
.v-desc-main {
|
||||||
|
margin-bottom: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 42rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-desc-sub {
|
||||||
|
font-weight: 500;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-qrcode {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 158rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-btn {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 690rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
box-shadow: 0rpx 3rpx 12rpx 1rpx rgba(255, 94, 12, 0.32);
|
||||||
|
border-radius: 55rpx 55rpx 55rpx 55rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
margin-right: 6rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #FF5E0C;
|
||||||
|
line-height: 16rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-style: normal;
|
||||||
|
text-transform: none;
|
||||||
|
margin-top: 2rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-shop-img {
|
||||||
|
position: absolute;
|
||||||
|
top: 196rpx;
|
||||||
|
right: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-con {
|
||||||
|
position: relative;
|
||||||
|
width: 710rpx;
|
||||||
|
height: 1166rpx;
|
||||||
|
background: linear-gradient(180deg, #FEB992 0%, #FFFFFF 31%, #FFFFFF 100%);
|
||||||
|
border-radius: 20rpx 20rpx 0rpx 0rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
box-shadow: 0 -4rpx 0px 0px #fff;
|
||||||
|
padding: 53rpx 30rpx 0 30rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
.v-con-text {
|
||||||
|
margin-bottom: 60rpx;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #2E2E2E;
|
||||||
|
line-height: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/deep/.u-text__value--tips {
|
||||||
|
color: #2E2E2E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-con-input {
|
||||||
|
margin-bottom: 83rpx;
|
||||||
|
padding: 0 0 40rpx 12rpx;
|
||||||
|
border-bottom: 1rpx solid #D6D6D6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-wrap {
|
||||||
|
position: relative;
|
||||||
|
width: 666rpx;
|
||||||
|
height: 210rpx;
|
||||||
|
background-image: url("https://lihai001.oss-cn-chengdu.aliyuncs.com/def/2f9c2202402291652415355.webp");
|
||||||
|
background-size: 100% 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
|
.v-wrap-money {
|
||||||
|
position: absolute;
|
||||||
|
top: 70rpx;
|
||||||
|
left: 36rpx;
|
||||||
|
color: #FF5E0C;
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
font-size: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.num {
|
||||||
|
font-size: 46rpx;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-wrap-desc {
|
||||||
|
position: absolute;
|
||||||
|
top: 67rpx;
|
||||||
|
left: 230rpx;
|
||||||
|
|
||||||
|
.v-wrap-desc-main {
|
||||||
|
margin-bottom: 16rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #2E2E2E;
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-wrap-desc-sub {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #2E2E2E;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.v-btn {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 96rpx;
|
||||||
|
width: 650rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
line-height: 100rpx;
|
||||||
|
background: #FF8056;
|
||||||
|
box-shadow: 0rpx 3rpx 3rpx 1rpx rgba(255, 94, 12, 0.4);
|
||||||
|
border-radius: 55rpx 55rpx 55rpx 55rpx;
|
||||||
|
border: 1rpx solid #FF8056;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #FFFFFF;
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: .8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
1919
pages/payment/settlement.vue
Normal file
1919
pages/payment/settlement.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -20,9 +20,9 @@
|
|||||||
<view class="r_content">
|
<view class="r_content">
|
||||||
<view class="r_name">{{item.type_cn}}</view>
|
<view class="r_name">{{item.type_cn}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="r_btn">
|
<!-- <view class="r_btn">
|
||||||
查看
|
查看
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -55,6 +55,7 @@
|
|||||||
uni.navigateBack();
|
uni.navigateBack();
|
||||||
},
|
},
|
||||||
navgo(item){
|
navgo(item){
|
||||||
|
return ;
|
||||||
if(item.type==1) uni.navigateTo({
|
if(item.type==1) uni.navigateTo({
|
||||||
url: '/pages/newActivity/subsidy/subsidy2'
|
url: '/pages/newActivity/subsidy/subsidy2'
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user