Browse Source

2023-7-24

cmy 1 year ago
parent
commit
6addd86ca2

+ 3 - 0
.gitignore

@@ -0,0 +1,3 @@
+unpackage/debug
+unpackage/dist
+unpackage/resources

+ 28 - 0
api/pi.js

@@ -0,0 +1,28 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team <admin@crmeb.com>
+// +----------------------------------------------------------------------
+
+import request from "@/utils/request.js";
+
+
+export function piPay(data) {
+	return request.post("pi/approve", data);
+}
+
+export function piPaySuccess(data) {
+	return request.post("pi/complete", data);
+}
+
+export function piPayReadSuccess(data) {
+	return request.post("pi/incomplete", data);
+}
+
+export function piPayCancel(data) {
+	return request.post("pi/pi_pay_cancel", data);
+}

+ 1 - 0
index.html

@@ -4,6 +4,7 @@
 		<meta charset="utf-8">
 		<meta http-equiv="X-UA-Compatible" content="IE=edge">
 		<script src="https://sdk.minepi.com/pi-sdk.js"></script>
+		
 		<title>
 			<%= htmlWebpackPlugin.options.title %>
 		</title>

+ 17 - 0
pages.json

@@ -64,6 +64,23 @@
 
 	],
 	"subPackages": [{ // 模块分包
+			"root": "pages/shop",
+			"name": "shop",
+			"pages": [{
+					"path": "becomeShop",
+					"style": {
+						"navigationBarTitleText": "商家入驻",
+						"app-plus": {
+							// #ifdef APP-PLUS
+							"titleNView": {
+								"type": "default"
+							}
+							// #endif
+						}
+					}
+				}
+			]
+		},{ // 模块分包
 			"root": "pages/extension",
 			"name": "extension",
 			"pages": [{

+ 105 - 13
pages/goods/cashier/index.vue

@@ -36,7 +36,6 @@
 		</view>
 		<view v-show="false" v-html="formContent"></view>
 	</view>
-	</view>
 </template>
 
 <script>
@@ -49,8 +48,17 @@
 	import {
 		basicConfig
 	} from '@/api/public.js'
+	import {
+		piPay,
+		piPaySuccess,
+		piPayReadSuccess,
+		piPayCancel
+	} from '@/api/pi.js'
 	//初始化
-	Pi.init({ version: "2.0" })
+	Pi.init({
+		version: "2.0"
+		// ,sandbox: true
+	})
 	export default {
 		components: {
 			countDown,
@@ -94,7 +102,8 @@
 						value: 'friend',
 						title: this.$t(`找微信好友支付`),
 						payStatus: 1,
-					}, {
+					},
+					{
 						"name": this.$t(`PI支付`),
 						"icon": "icon-haoyoudaizhifu",
 						value: 'piPay',
@@ -279,25 +288,106 @@
 					uni.hideLoading();
 					return uni.navigateTo({
 						url: '/pages/users/payment_on_behalf/index?order_id=' + that.orderId + '&spread=' +
-							this.$store.state.app.uid,
+							that.$store.state.app.uid,
 						success: res => {},
 						fail: () => {},
 						complete: () => {}
 					});
 				}
-				if (paytype == 'piPay')
-				{
-					console.log(Pi);
+				if (paytype == 'piPay') {
 					// Authenticate the user, and get permission to request payments from them:
 					const scopes = ['payments'];
-					Pi.authenticate(scopes, (payment)=>{
-						console.log(payment,'payment')
+					Pi.authenticate(scopes, (payment) => {
+						return piPayReadSuccess({
+							payment
+						}).then((res) => {}).catch((res) => {
+							uni.showModal({
+								title: '错误can',
+								content: res,
+								showCancel: false,
+								success: res => {},
+								fail: () => {},
+								complete: () => {}
+							});
+						})
+
 					}).then(function(auth) {
-					  console.log(`Hi there! You're ready to make payments!`);
+						// window.alert('成功auth' + auth)
+						Pi.createPayment({
+							// 支付金额
+							amount: 0.0001,
+							// 支付说明
+							memo: "请求支付", // e.g: "Digital kitten #1234",
+							// 用于保存自己要用的数据,后台查询时可获取到
+							metadata: {
+								tip: '我来支付了'
+							}, // e.g: { kittenId: 1234 }
+						}, {
+							// 请求支付调用
+							onReadyForServerApproval: function(paymentId) {
+								// 请求服务器授权允许支付
+								piPay({
+									paymentId
+								}).then((res) => {
+									// window.alert('成功'+res)
+								}).catch((res) => {
+									uni.showModal({
+										title: '错误pia',
+										content: res,
+										showCancel: false,
+										success: res => {},
+										fail: () => {},
+										complete: () => {}
+									});
+								})
+							},
+							// 请求服务器端支付确认
+							onReadyForServerCompletion: function(paymentId, txid) {
+								piPaySuccess({
+									paymentId,
+									txid
+								}).then((res) => {}).catch((res) => {
+									uni.showModal({
+										title: '错误read',
+										content: res,
+										showCancel: false,
+										success: res => {},
+										fail: () => {},
+										complete: () => {}
+									});
+								})
+							},
+							onCancel: function(paymentId) {
+								piPayCancel({
+									paymentId
+								}).then((res) => {
+									// window.alert('成功'+res)
+								}).catch((res) => {
+									// window.alert('错误can'+res)
+								})
+							},
+							onError: function(error, payment) {
+								uni.showModal({
+									title: '错误',
+									content: error + (payment ? JSON.stringify(payment) : ''),
+									showCancel: false,
+									success: res => {},
+									fail: () => {},
+									complete: () => {}
+								});
+							},
+						});
 					}).catch(function(error) {
-					  console.error(error);
+						uni.showModal({
+							title: '错误',
+							content: error,
+							showCancel: false,
+							success: res => {},
+							fail: () => {},
+							complete: () => {}
+						});
 					});
-				 return 
+					return
 				}
 				orderPay({
 					uni: that.orderId,
@@ -629,6 +719,8 @@
 
 <style lang="scss" scoped>
 	.page {
+		padding-bottom: 200rpx;
+
 		.pay-price {
 			display: flex;
 			justify-content: center;
@@ -803,4 +895,4 @@
 		}
 
 	}
-</style>
+</style>

+ 339 - 0
pages/shop/becomeShop.vue

@@ -0,0 +1,339 @@
+<template>
+	<view class="content">
+		<image class="shop-banner" src="../../static/images/shop-banner.png" mode="widthFix"></image>
+		<view class="enterprise">
+			<view class="enterprise-box">
+				<view class="box-item">
+					<view class="item-left">联系人:</view>
+					<view class="item-right"><input type="text" placeholder="请输入联系人" v-model="nameP" /></view>
+				</view>
+				<view class="box-item">
+					<view class="item-left">联系电话:</view>
+					<view class="item-right"><input type="text" placeholder="请输入联系电话" v-model="phone" /></view>
+				</view>
+			</view>
+			<view class="enterprise-box">
+				<view class="box-item">
+					<view class="item-left">店铺名称:</view>
+					<view class="item-right"><input type="text" placeholder="请输入店铺名" v-model="name" /></view>
+				</view>
+				<view class="box-item" @click="getLocation">
+					<view class="item-left">商家地址:</view>
+					<view class="item-right"><input type="text" placeholder="请选择详细地址" v-model="showaddress" /></view>
+				</view>
+				<view class="box-item">
+					<view class="item-left">服务类目:</view>
+					<view class="item-right"><input type="text" placeholder="请输入您的经营范围" v-model="introduction" /></view>
+				</view>
+			</view>
+			
+			<view class="enterprise-box">
+				<view class="box-item1">
+					<view class="item-left">商户门头:</view>
+					<view class="item-right">
+						<image :src="cardimg" mode="" class="upload-img" @click.stop="imgsub" v-if="cardimg"></image>
+						<image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!cardimg" @click.stop="imgsub"></image>
+					</view>
+				</view>
+			</view>
+			<view class="enterprise-box">
+				<view class="box-item1">
+					<view class="item-left">营业执照:</view>
+					<view class="item-right">
+						<image :src="imgY" mode="" class="upload-img" @click.stop="imgsubY" v-if="imgY"></image>
+						<image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!imgY" @click.stop="imgsubY"></image>
+					</view>
+				</view>
+			</view>
+			<view class="enterprise-box">
+				<view class="box-item">
+					<view class="item-left">环境介绍:</view>
+					<view class="item-right"><input type="text" placeholder="请输入" v-model="introductory" /></view>
+				</view>
+				<view class="box-item1">
+					<view class="item-left">店内照片:</view>
+					<view class="item-right">
+						<image :src="shopImg" mode="" class="upload-img" @click.stop="imgsub" v-if="shopImg"></image>
+						<image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!shopImg" @click.stop="imgsut"></image>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="flex">
+			<view class="">
+				
+			</view>
+			<view class="">
+				我已阅读并同意
+			</view>
+			<view class="shopDetail">
+			《商户入驻协议》
+			</view>
+		</view>
+		
+		
+		
+		<view class="comfirm" @click="comfirm">提交申请</view>
+	</view>
+</template>
+
+<script>
+// import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
+import { mapState, mapMutations } from 'vuex';
+import { upload, apply } from '@/api/order.js';
+export default {
+	// components: {
+	// 	pickerAddress
+	// },
+	computed: {
+		...mapState(['userInfo'])
+	},
+	data() {
+		return {
+			imgY: '', //营业执照
+			checked: false,
+			name: '', //店铺名
+			telphone: '', //商家电话
+			introduction: '', //主营项目
+			introductory: '', //简介
+			Idcard: '', //身份证号码
+			spared: '', //推荐人
+			nameP: '', //联系人
+			phone: '', //联系人电话
+			showaddress: '', //详细地址
+			addressDetail: '', //省市区
+			cardimg: '', //店铺logo
+			latitude: '',
+			longitude: '',
+			shopImg:''//店内图片
+		};
+	},
+	methods: {
+		// 上传门内图片
+		imgsut() {
+			// console.log('上传logo');
+			upload({
+				filename: ''
+			}).then(data => {
+				// console.log('data', data);
+				this.shopImg = data[0].url;
+			});
+		},
+		// 上传门店logo图片
+		imgsub() {
+			// console.log('上传logo');
+			upload({
+				filename: ''
+			}).then(data => {
+				console.log('data', data);
+				this.cardimg = data[0].url;
+			});
+		},
+		// 上传营业执照图片
+		imgsubY() {
+			// console.log('i上传营业执照');
+			upload({
+				filename: ''
+			}).then(data => {
+				this.imgY = data[0].url;
+			});
+		},
+		check() {
+			this.checked = !this.checked;
+		},
+		getLocation() {
+			console.log('选择当前位置');
+			let obj = this;
+			uni.chooseLocation({
+				success: function(res) {
+					console.log('1111:' + res);
+					console.log('位置名称:' + res.name);
+					console.log('详细地址:' + res.address);
+					console.log('纬度:' + res.latitude);
+					console.log('经度:' + res.longitude);
+					obj.latitude = res.latitude;
+					obj.longitude = res.longitude;
+					if (res.address) {
+						obj.showaddress = res.address;
+					} else {
+						obj.showaddress = res.name;
+					}
+				}
+			});
+		},
+		// 选中城市切换
+		onCityClick({ data }) {
+			this.addressDetail = data.join(',');
+		},
+		// 提交申请
+		comfirm() {
+			const obj = this;
+			if (obj.name == '') {
+				obj.$api.msg('请输入店铺名');
+				return;
+			}
+			const reg1 = /^(\+?0?86-?)?1[\d]\d{9}$/;
+			if (!reg1.test(obj.telphone)) {
+				obj.$api.msg('请输入商家电话');
+				return;
+			}
+			if (obj.introduction == '') {
+				obj.$api.msg('请输入您的主营项目');
+				return;
+			}
+			if (obj.introductory == '') {
+				obj.$api.msg('请输入您的商铺简介');
+				return;
+			}
+			if (obj.spared == '') {
+				obj.$api.msg('请输入您的推荐人');
+				return;
+			}
+			if (obj.Idcard == '') {
+				obj.$api.msg('请输入身份证号');
+				return;
+			}
+			if (obj.nameP == '') {
+				obj.$api.msg('请输入联系人');
+				return;
+			}
+			if (obj.adress == '') {
+				obj.$api.msg('请选择详细地址');
+				return;
+			}
+			if (obj.addressDetail == '') {
+				obj.$api.msg('请选择省市区');
+				return;
+			}
+			if (obj.cardimg == '') {
+				obj.$api.msg('请上传店铺LOGO');
+				return;
+			}
+			if (obj.imgY == '') {
+				obj.$api.msg('请上传营业执照');
+				return;
+			}
+			apply({
+				name: obj.name,
+				introduction: obj.introductory,
+				phone: obj.telphone,
+				address: obj.addressDetail,
+				detailed_address: obj.showaddress,
+				image: obj.cardimg,
+				latitude: obj.latitude,
+				longitude: obj.longitude,
+				leader: obj.nameP,
+				id_card: obj.Idcard,
+				job: obj.introduction,
+				cert: obj.imgY,
+				spread_uid: obj.spared
+			})
+				.then(e => {
+					uni.showToast({
+						title: '申请成功,请耐心等待审核',
+						icon: 'success',
+						duration: 2000
+					});
+				})
+				.catch(function(e) {
+					console.log('出错了');
+					console.log(e);
+				});
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+.content {
+}
+.shop-banner{
+	width: 750rpx;
+}
+.enterprise{
+	padding: 30rpx;
+}
+.enterprise-box {
+	background-color: #ffffff;
+	border-radius: 12rpx;
+	width: 100%;
+	margin-bottom: 30rpx;
+	.box-item {
+		display: flex;
+		border-bottom: 1rpx solid #f0f0f0;
+		padding: 32rpx 24rpx;
+		align-items: center;
+		&:nth-last-child(1) {
+			border-bottom: none;
+		}
+	}
+	.item-left {
+		font-size: 28rpx;
+		width: 160rpx;
+		flex-shrink: 0;
+	}
+	.item-right {
+		width: 100%;
+		margin-left: 24rpx;
+		font-size: 28rpx;
+		display: flex;
+		align-items: center;
+		color: #999999;
+		input {
+			font-size: 28rpx;
+		}
+		image {
+			width: 160rpx;
+			height: 160rpx;
+			margin-top: 24rpx;
+			margin-left: 60rpx;
+		}
+	}
+	.box-item1 {
+		display: flex;
+		border-bottom: 1rpx solid #f0f0f0;
+		padding: 32rpx 24rpx;
+		// align-items: center;
+		&:nth-last-child(1) {
+			border-bottom: none;
+		}
+	}
+}
+.comfirm {
+	margin: 20rpx auto 0;
+	width: 750rpx;
+	height: 80rpx;
+	background: #681445;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	color: #ffffff;
+	font-size: 36rpx;
+}
+.comfirm1 {
+	margin: 0 auto;
+	border-radius: 80rpx;
+	width: 650rpx;
+	height: 100rpx;
+	background: #b1b1b1;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	color: #ffffff;
+	font-size: 36rpx;
+}
+.checkbox {
+	font-size: 32rpx;
+	color: #eeeeee;
+	background: #eeeeee;
+	border-radius: 50px;
+}
+.checked {
+	color: #fd4343;
+	background: #ffffff;
+}
+.radio {
+	padding-top: 5rpx;
+	margin-right: 15rpx;
+}
+</style>

+ 6 - 6
pages/user/index.vue

@@ -126,7 +126,7 @@
 							</view>
 						</view>
 						<!-- <view class="sign" @click="goSignIn">签到</view> -->
-						<view class="cardVipA acea-row row-between-wrapper"
+						<!-- <view class="cardVipA acea-row row-between-wrapper"
 							v-if="userInfo.svip_open && member_style==1">
 							<view class="left-box">
 								<view v-if="userInfo.vip_status == 1" class="small">{{$t('永久')}}</view>
@@ -145,8 +145,8 @@
 								</navigator>
 								<text class="iconfont icon-xiangyou"></text>
 							</view>
-						</view>
-						<view class="cardVipB acea-row row-between" v-if="userInfo.svip_open && member_style==3">
+						</view> -->
+						<!-- <view class="cardVipB acea-row row-between" v-if="userInfo.svip_open && member_style==3">
 							<view class="left-box acea-row">
 								<view class="pictrue">
 									<image src="../../static/images/member01.png"></image>
@@ -167,9 +167,9 @@
 								</navigator>
 								<text class="iconfont icon-xiangyou btn"></text>
 							</view>
-						</view>
+						</view> -->
 					</view>
-					<view class="card-vip" v-if="userInfo.svip_open && member_style==2">
+					<!-- <view class="card-vip" v-if="userInfo.svip_open && member_style==2">
 						<view class="left-box">
 							<view class="big">{{$t('会员可享多项权益')}}</view>
 							<view v-if="userInfo.vip_status == 1" class="small">{{$t('永久')}}</view>
@@ -185,7 +185,7 @@
 						<navigator v-else url="/pages/annex/vip_paid/index" hover-class="none" class="btn">
 							{{ userInfo.overdue_time ? $t('立即续费') : $t('立即激活') }}
 						</navigator>
-					</view>
+					</view> -->
 					<view class="order-wrapper" :class="userInfo.svip_open?'':'height'">
 						<view class="order-hd flex">
 							<view class="left">{{$t('订单中心')}}</view>

+ 4 - 4
pages/users/user_spread_user/index.vue

@@ -53,11 +53,11 @@
 					<text class='iconfont icon-tongji'></text>
 					<view>{{$t(`推广人统计`)}}</view>
 				</navigator>
-				<navigator url='/pages/users/user_spread_money/index?type=2' hover-class="none"
+				<!-- <navigator url='/pages/users/user_spread_money/index?type=2' hover-class="none"
 					class='item acea-row row-center-wrapper row-column'>
 					<text class='iconfont icon-qiandai'></text>
 					<view>{{$t(`佣金明细`)}}</view>
-				</navigator>
+				</navigator> -->
 
 				<navigator  v-if="(userInfo.division_open && !userInfo.is_agent && !userInfo.is_division) || !userInfo.division_open" url='/pages/users/promoter-order/index' hover-class="none"
 					class='item acea-row row-center-wrapper row-column'>
@@ -74,11 +74,11 @@
 					<text class='iconfont icon-paihang1'></text>
 					<view>{{$t(`推广人排行`)}}</view>
 				</navigator>
-				<navigator url='/pages/users/commission_rank/index' hover-class="none"
+				<!-- <navigator url='/pages/users/commission_rank/index' hover-class="none"
 					class='item acea-row row-center-wrapper row-column'>
 					<text class='iconfont icon-paihang'></text>
 					<view>{{$t(`佣金排行`)}}</view>
-				</navigator>
+				</navigator> -->
 				<navigator v-if="userInfo.division_open && userInfo.is_agent" url='/pages/users/staff_list/index' hover-class="none"
 					class='item acea-row row-center-wrapper row-column'>
 					<text class='iconfont icon-tuandui'></text>

BIN
static/images/shop-banner.png


BIN
static/images/up-img.png


+ 1 - 1
utils/request.js

@@ -66,7 +66,7 @@ function baseRequest(url, method, data, {
 						confirmText: i18n.t(`我知道了`)
 					});
 				} else
-					reject(res.data.msg || i18n.t(`系统错误`));
+					reject(res.data || i18n.t(`系统错误`));
 			},
 			fail: (msg) => {
 				let data = {