第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:14:48 +08:00
commit 1b923e5cff
1030 changed files with 128016 additions and 0 deletions

View File

@@ -0,0 +1,725 @@
<template>
<view class="user-index">
<view class="page-bg"></view>
<view class="header" :style="'margin-top: ' + statusBarHeight + 'px'"></view>
<view class="main-header">
<image class="bg-image" :src="bgImage" mode="scaleToFill"></image>
<!-- 用户信息 -->
</view>
<view class="main">
<!-- 表单信息 -->
<u--form :model="form" ref="uForm">
<view class="buy-user">
<!-- 表单组件 -->
<view class="form-wrapper">
<u-cell-group :border="false">
<u-cell title="姓名" :isLink="true">
<input slot="value" class="w-input" placeholder="请填写姓名" v-model="form.realName" />
</u-cell>
<u-cell title="手机号" :isLink="true">
<input slot="value" class="w-input" placeholder="请填写手机号码" v-model="form.phone" />
</u-cell>
<u-cell title="所属区域" :isLink="true" @click="onArea">
<input slot="value" class="w-input" placeholder="请选择所属区域" :disabled="true"
v-model="form.area" />
</u-cell>
<u-cell title="服务门店" :isLink="true" @click="onMerchant"
v-if="form.planId != 19 && form.planId != 22 && form.planId != 23 && form.planId != 24 && form.planId != 25 && form.planId != 26">
<input slot="value" class="w-input" :disabled="true" placeholder="请选择服务门店"
v-model="form.merchantName" />
</u-cell>
<u-cell title="门店地址" :isLink="true"
v-if="form.planId == 22 || form.planId == 23 || form.planId == 24 || form.planId == 25 || form.planId == 26">
<input slot="value" class="w-input" placeholder="请输入门店地址" v-model="form.address" />
</u-cell>
<u-cell title="门店类型" :border="false" :isLink="true" :value="form.name">
</u-cell>
</u-cell-group>
</view>
</view>
<u-gap height="3"></u-gap>
<!-- 会员套餐 -->
<view class="buy-user">
<u-cell :title="form.roleName"></u-cell>
<view class="price-box">
<view class="info">
<image :src="form.icon"
mode="aspectFill"></image>
<view class="content">
{{ form.name }}
</view>
</view>
<view class="price" v-for="(item,index) in form.price" :key="index">
<text class="reb">{{ item.price }}</text>
<text class="num">x1</text>
</view>
</view>
</view>
<view class="xieyi">
<u-icon name="checkbox-mark"></u-icon>
购买代表同意爱尚客网
<text>婚介协议</text>
</view>
</u--form>
</view>
<view class="cart">
<view class="cart-info">
<!-- <view style="position: relative;"> -->
<!-- <u-badge class="badge" size="mini" type="error" :is-center="true" :count="totalNum"></u-badge> -->
<!-- <image class="cart-logo" src="../../static/icon/cart4.png"></image> -->
<!-- </view> -->
<view class="total-price">{{ totalPrice }}</view>
<!-- <view class="clear-cart" @click="onClearCart">清空购物车</view> -->
<view class="buy">
<u-button text="立即下单" shape="circle" type="error" class="custom-style" :disabled="disabled"
@click="onBuy">
</u-button>
</view>
</view>
</view>
<!-- 地址选择器 -->
<liu-customize-sel ref="area" @change="chooseSuccess"></liu-customize-sel>
<!-- 选择店铺 -->
<u-picker :show="showMerchant" :columns="merchantList" keyName="label" @confirm="confirmMerchant"
@cancel="showMerchant = false"></u-picker>
</view>
</template>
<script>
import store from '@/store/index.js'
import storage from '@/utils/storage'
import * as UserPlanApi from '@/api/love-user-plan.js'
import * as UserPlanLogApi from '@/api/love-user-plan-log.js'
import * as MerchantApi from '@/api/merchant.js'
import {
getUser
} from '@/api/user.js'
import {
username
} from '@/config.js';
import http from '@/api'
export default {
data() {
return {
merchantList: [],
bgImage: 'data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%221%22%20x1%3D%220%22%20x2%3D%221%22%20y1%3D%220%22%20y2%3D%220%22%20gradientTransform%3D%22matrix(6.123233995736766e-17%2C%201%2C%20-0.36308349769888226%2C%206.123233995736766e-17%2C%200.5%2C%200)%22%3E%3Cstop%20stop-color%3D%22%23101010%22%20stop-opacity%3D%221%22%20offset%3D%220.24%22%3E%3C%2Fstop%3E%3Cstop%20stop-color%3D%22%23160028%22%20stop-opacity%3D%221%22%20offset%3D%221%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%22100%25%22%20height%3D%22100%25%22%20fill%3D%22url(%231)%22%3E%3C%2Frect%3E%3C%2Fsvg%3E',
statusBarHeight: 25,
// 是否已登录
isLogin: false,
disabled: false,
showMerchant: false,
// 系统设置
form: {
area: '',
planId: 0,
priceId: 0,
province: '',
city: '',
region: ''
},
subPayPrice: 0,
city: '',
rules: [],
totalPrice: 0.00
}
},
onLoad(options) {
console.log("options: ", options);
this.form.planId = Number(options.planId)
this.subPayPrice = options.subPayPrice
this.getUserInfo()
this.getOrderInfo()
// 设置navbar标题、颜色options
uni.setNavigationBarColor({
frontColor: '#ffffff',
backgroundColor: '#101010'
})
},
onShow() {},
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
this.$refs.uForm.setRules(this.rules)
},
methods: {
// 跳转页面
navTo(url) {
this.$navTo(url)
},
getUserInfo() {
const {
form
} = this
const app = this
uni.getSystemInfo({
success(data) {
if (data) {
app.statusBarHeight = data.statusBarHeight + 50
}
}
})
getUser().then(res => {
if (res.code == 0 && res.data.username != 'www') {
if (res.data) {
console.log("res.data.phone: ", res.data.phone);
app.form.realName = res.data.nickname
app.form.phone = res.data.phone
}
app.isLogin = true
} else {
app.isLogin = false
app.$push('pages/login/index')
}
})
},
getOrderInfo() {
const app = this
const {
planId
} = this.form
UserPlanApi.getUserPlan(planId).then(result => {
console.log("result: ", result);
app.form = result.data
result.data.price.map(d => {
app.form.priceId = d.id
app.totalPrice = (d.price-app.subPayPrice).toFixed(2)
})
})
},
getMerchant() {
const app = this
MerchantApi.listMerchant({
region: app.form.region
}).then(result => {
let arr = []
app.merchantList = []
result.data.map(d => {
arr.push({
id: d.merchantId,
label: `${d.merchantName} (${d.gradeName})`,
code: d.merchantCode
})
})
console.log("arr: ",arr);
app.merchantList.push(arr)
})
},
onArea() {
this.$refs.area.open()
},
onMerchant() {
this.showMerchant = true
},
confirmMerchant(e) {
const data = e.value[0]
this.form.merchantId = Number(data.id)
this.form.merchantCode = data.code
this.form.merchantName = data.label
this.showMerchant = false
},
//地址选择成功
chooseSuccess(e) {
const app = this
const data = e.value
app.city = data[1].label
app.form.area = `${data[0].label} ${data[1].label} ${data[2].label}`
app.form.province = data[0].label
app.form.city = data[1].label
app.form.region = data[2].label
app.form.merchantName = null
app.form.merchantId = null
app.getMerchant()
},
onBuy() {
const app = this
const {
form,
totalPrice
} = this
if (form.realName == '') {
this.$error('请填写姓名')
return false
}
if (form.phone == '') {
this.$error('请填写手机号码')
return false
}
if (!form.area) {
this.$error('请选择所属区域')
return false
}
if (!form.merchantId && form.planId != 19 && form.planId != 22 && form.planId != 23 && form.planId !=
24 && form.planId != 25 && form.planId != 26) {
this.$error('请选择服务门店')
return false
}
app.disabled = true
UserPlanLogApi.addUserPlanLog({
planId: form.planId,
priceId: form.priceId,
province: form.province,
city: form.city,
region: form.region,
area: form.area,
realName: form.realName,
phone: form.phone,
merchantId: form.merchantId,
merchantCode: form.merchantCode,
merchantName: form.merchantName,
address: form.address,
totalPrice
}).then(res => {
const orderInfo = res.data
if(orderInfo == null){
// 业务逻辑。。。
uni.showModal({
title: '支付成功',
content: '如果状态没更新,请尝试下拉更新',
showCancel: false,
success: function(res) {
if (res.confirm) {
app.showEdit = false
app.disabled = false
uni.navigateBack({
delta: 2
})
}
}
})
return false
}
// 调起微信支付
uni.requestPayment({
provider: orderInfo.provider, // 服务提供商
timeStamp: orderInfo.timeStamp, // 时间戳
nonceStr: orderInfo.nonceStr, // 随机字符串
package: orderInfo.package,
signType: orderInfo.signType, // 签名算法
paySign: orderInfo.paySign, // 签名
success: function(res) {
// 业务逻辑。。。
uni.showModal({
title: '支付成功',
content: '如果状态没更新,请尝试下拉更新',
showCancel: false,
success: function(res) {
if (res.confirm) {
app.showEdit = false
app.disabled = false
uni.navigateBack({
delta: 2
})
}
}
})
},
fail: function(err) {
console.log('支付失败', err);
app.disabled = false
}
});
}).catch(err => {
app.disabled = false
})
}
}
}
</script>
<style lang="scss" scoped>
.user-index {
background-color: #f3f3f3;
height: 100vh;
}
.container {
padding-bottom: 60rpx;
}
.page-bg {
width: 750rpx;
height: calc(100rpx + var(--status-bar-height));
display: block;
background-color: #101010;
position: absolute;
left: 0;
top: 0;
z-index: -100;
}
// 页面头部
.main-header {
// background-color: #FBF7EF;
position: fixed;
top: 0;
width: 100%;
height: 360rpx;
background-size: 100% 100%;
overflow: hidden;
display: flex;
align-items: center;
display: flex;
justify-content: space-between;
.bg-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 0;
}
.star {
position: absolute;
opacity: 0.1;
color: #fff;
}
.star1 {
width: 100rpx;
height: 100rpx;
right: 80rpx;
top: 34rpx;
}
.star2 {
width: 100rpx;
height: 100rpx;
left: 40rpx;
top: 10rpx;
}
.star3 {
width: 70rpx;
height: 70rpx;
left: 130rpx;
top: 70rpx;
}
.user-info {
display: flex;
height: 120rpx;
padding-left: 30rpx;
z-index: 1;
.user-content {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 30rpx;
color: #ffffff;
.nick-name {
font-size: 30rpx;
font-weight: bold;
max-width: 270rpx;
display: flex;
flex-direction: row;
image {
margin-left: 10rpx;
width: 36rpx;
height: 36rpx;
}
}
.user-id {
font-weight: 300;
color: #efefef;
font-size: 24rpx;
}
.mobile {
margin-top: 15rpx;
font-size: 28rpx;
}
.user-grade {
align-self: baseline;
display: flex;
align-items: center;
background: #3c3c3c;
margin-top: 12rpx;
border-radius: 10rpx;
padding: 4rpx 12rpx;
.user-grade_icon .image {
display: block;
width: 32rpx;
height: 32rpx;
}
.user-grade_name {
margin-left: 5rpx;
font-size: 26rpx;
color: #EEE0C3;
}
}
.roles-box {
display: flex;
.login-tips {
margin-top: 12rpx;
margin-right: 6rpx;
font-size: 30rpx;
display: flex;
}
}
}
}
.switch {
display: flex;
color: #ffffff;
flex-direction: column;
justify-content: center;
align-items: center;
padding-right: 50rpx;
z-index: 999;
image {
width: 45rpx;
height: 45rpx;
}
.switch-text {
z-index: 9999;
color: #681752;
}
}
.setting {
color: #cecece;
position: absolute;
right: 2vh;
top: 1vh;
image {
width: 45rpx;
height: 45rpx;
}
}
}
.main {
position: fixed;
top: 80rpx;
left: 25rpx;
z-index: 999;
// 开通会员
.buy-user {
display: flex;
flex-direction: column;
margin: 22rpx auto 22rpx auto;
padding: 22rpx 0;
width: 700rpx;
box-shadow: 0 1rpx 5rpx 0px #eaebec;
border-radius: 24rpx;
background: #fff;
.desc {
padding-top: 5rpx;
padding-left: 32rpx;
font-size: 28rpx;
color: #545454;
}
.asset-right {
width: 170rpx;
border-left: 1rpx solid #eee;
}
.asset-right-item {
text-align: center;
color: #545454;
.item-icon {
font-size: 44rpx;
}
.item-name {
margin-top: 14rpx;
font-size: 28rpx;
}
}
.asset-left-item {
text-align: center;
padding-left: 28rpx;
display: flex;
.item-value {
font-size: 34rpx;
// color: #febd45;
}
.item-name {
color: #545454;
margin-top: 14rpx;
font-size: 24rpx;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin: 30rpx 25rpx 20rpx 0;
}
.buy-user-icon {
width: 40rpx;
margin-bottom: 8rpx;
}
}
}
}
// 退出登录
.my-logout {
display: flex;
justify-content: center;
margin-top: 50rpx;
.logout-btn {
width: 400rpx;
margin: 0 auto;
font-size: 28rpx;
color: #616161;
border-radius: 20rpx;
border: 1px solid #dcdcdc;
padding: 16rpx 0;
text-align: center;
}
}
.price-box {
padding: 30rpx;
display: flex;
justify-content: space-between;
.info {
display: flex;
image {
width: 120rpx;
height: 120rpx;
border-radius: 20rpx;
}
.content {
width: 280rpx;
padding-left: 30rpx;
font-size: 28rpx;
color: #666666;
}
}
.price {
display: flex;
flex-direction: column;
align-items: flex-end;
padding: 0 20rpx;
.reb {
color: #ff0000;
}
.num {
color: #999999;
}
}
}
.xieyi {
width: 500rpx;
font-size: 26rpx;
text-align: center;
display: flex;
margin: 50rpx auto;
color: #999999;
text {
text-decoration: underline;
color: #681752;
}
}
.cart {
position: fixed;
bottom: 25rpx;
z-index: 888;
width: 750rpx;
height: 80rpx;
line-height: 80rpx;
.cart-info {
background: linear-gradient(to bottom, $main-bg, $main-bg2);
width: 700rpx;
margin: auto;
display: flex;
border-radius: 100rpx;
justify-content: space-between;
position: relative;
.cart-logo {
position: absolute;
width: 90rpx;
height: 90rpx;
margin-left: 20rpx;
bottom: 10rpx;
}
.total-price {
padding-left: 30rpx;
font-size: 34rpx;
font-weight: bold;
color: #ffffff;
}
.clear-cart {
color: #ff0000;
}
.buy {
display: flex;
flex-direction: column;
justify-content: center;
.custom-style {
padding: 0 50rpx;
color: #ffffff;
background-color: #ff0000;
// background: linear-gradient(to bottom, $main-bg, $main-bg2);
// background-color: #681752;
border: none;
width: 330rpx;
height: 66rpx;
font-size: 28rpx;
}
}
}
}
.w-input {
width: 400rpx;
text-align: right;
font-size: 25rpx;
color: #606266;
}
</style>

View File

@@ -0,0 +1,366 @@
<template>
<view class="search">
<view class="house">
<view class="list">
<view class="item">
<image class="image" :src="form.files[0].url">
</image>
<view class="info">
<view class="title">{{ form.houseTitle }}</view>
<view class="desc"><text>{{ form.extent }}|{{ form.toward }}</text></view>
<view class="price">{{ form.monthlyRent }}/</view>
</view>
</view>
</view>
</view>
<u-gap></u-gap>
<!-- 提交表单 -->
<view class="user-card">
<u--form :model="form" ref="uForm" :rules="rules" labelPosition="top" :labelStyle="{paddingLeft: '10rpx'}"
label-width="200rpx">
<!-- 表单组件 -->
<view class="form-wrapper">
<u-cell-group :border="false">
<u-form-item prop="realName">
<u-cell title="姓名" :isLink="true">
<u-input slot="value" class="input" v-model="form.realName" inputAlign="right"
maxlength="30" :border="false" placeholder="请输入姓名" />
</u-cell>
</u-form-item>
<u-form-item prop="phone">
<u-cell title="联系电话" :isLink="true">
<u-input slot="value" class="input" v-model="form.phone" inputAlign="right"
maxlength="30" :border="false" placeholder="请填写联系电话" />
</u-cell>
</u-form-item>
<u-form-item prop="expirationTime">
<u-cell title="预约看房时间" :isLink="true" @click="showExpirationTime = true">
<u-input slot="value" class="input" v-model="expirationTime" inputAlign="right"
maxlength="30" :border="false" placeholder="请选择看房时间" />
</u-cell>
</u-form-item>
</u-cell-group>
</view>
</block>
</u--form>
</view>
<view class="float">
<view class="release">
<u-button text="提交预约" type="primary" shape="circle" @click="handleSubmit"></u-button>
</view>
</view>
<!-- 组件 -->
<u-calendar :show="showExpirationTime" @confirm="confirmexpirationTime"></u-calendar>
<!-- <u-datetime-picker ref="datetimePicker" :show="showExpirationTime" v-model="expirationTime" mode="date" @close="closeexpirationTime"
@confirm="confirmexpirationTime" @cancel="closeexpirationTime" :closeOnClickOverlay="true">
</u-datetime-picker> -->
</view>
</template>
<script>
import store from '@/store'
import {
fileUrl
} from '@/config.js'
import {
dateFormat
} from '@/utils/util.js'
import * as HouseInfoApi from '@/api/house-info.js'
import * as HouseReservationApi from '@/api/house-reservation.js'
import * as DictApi from '@/api/dict.js'
export default {
data() {
return {
select: [],
bgColor: '#ffffff',
showExpirationTime: false,
form: {
name: '',
phone: '',
expirationTime: ''
},
// 生日
expirationTime: '',
// 验证规则
rules: {
'name': {
type: 'string',
required: true,
message: '请填写您的姓名',
trigger: ['blur', 'change']
},
'phone': {
type: 'string',
required: true,
message: '请填写您的手机号码',
trigger: ['blur', 'change']
},
'expirationTime': {
type: 'string',
required: true,
message: '请选择预约看房时间',
trigger: ['blur', 'change']
},
},
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.houseId = options.id
this.getHouseInfo()
},
// 必须要在onReady生命周期因为onLoad生命周期组件可能尚未创建完毕
onReady() {
// this.$refs.uForm.setRules(this.rules)
// 微信小程序需要用此写法
// this.$refs.datetimePicker.setFormatter(this.formatter)
},
methods: {
getHouseInfo() {
const app = this
const {
houseId
} = this
HouseInfoApi.getHouseInfo(houseId).then(res => {
app.form = res.data
app.form.files = JSON.parse(res.data.files) || []
app.form.houseLabel = JSON.parse(res.data.houseLabel) || []
// app.form.supporting = JSON.parse(res.data.supporting) || []
}).catch(err => {
app.$error(err.message)
})
},
onSearch() {
this.$push('/sub_pages/member/member', this.where)
},
onBadge(id) {
this.bgColor = '#ff0000'
},
confirmexpirationTime(e) {
this.expirationTime = e[0]
this.form.expirationTime = e[0] + ' 00:00:00'
this.showExpirationTime = false
},
closeexpirationTime() {
this.showExpirationTime = false
},
// 确认修改
async handleSubmit() {
const app = this
const { form } = this
if (app.disabled === true) return
this.$refs.uForm.validate().then(() => {
HouseReservationApi.addHouseReservation(app.form).then(result => {
app.$toast(result.message)
}).catch(err => {
uni.$u.toast(err)
})
}).catch(errors => {
console.log("errors: ",errors);
uni.$u.toast('校验失败')
})
},
}
}
</script>
<style>
page {
background: #f7f8fa;
}
</style>
<style lang="scss" scoped>
.container {}
.search-wrapper {
display: flex;
height: 64rpx;
padding: 20rpx;
background-color: #FFFFFF;
}
// 搜索输入框
.search-input {
width: 80%;
background: #fff;
height: 72rpx;
line-height: 72rpx;
border-radius: 10rpx 0 0 10rpx;
box-sizing: border-box;
overflow: hidden;
.search-input-wrapper {
display: flex;
.left {
display: flex;
width: 60rpx;
justify-content: center;
align-items: center;
.search-icon {
display: block;
color: #b4b4b4;
font-size: 28rpx;
}
}
.right {
flex: 1;
input {
font-size: 28rpx;
height: 72rpx;
line-height: 72rpx;
display: flex;
align-items: center;
.input-placeholder {
color: #aba9a9;
}
}
}
}
}
// 搜索按钮
.search-button {
width: 20%;
box-sizing: border-box;
.button {
height: 64rpx;
font-size: 28rpx;
border-radius: 0 10rpx 10rpx 0;
background: $main-bg;
color: $main-text;
display: flex;
justify-content: center;
align-items: center;
}
}
// 订单合计
.order-total {
margin: 10rpx auto;
font-size: 26rpx;
vertical-align: bottom;
text-align: right;
height: 50rpx;
padding-top: 10rpx;
display: flex;
justify-content: center;
.pay-btn {
display: flex;
.btn {
margin-right: 16rpx;
}
}
.total-price {
display: flex;
align-items: center;
}
.unit {
margin-left: 8rpx;
margin-right: -2rpx;
font-size: 26rpx;
}
.money {
font-size: 28rpx;
color: #ff0000;
}
}
.house {
margin: 30rpx auto;
width: 680rpx;
.btn {
width: 150rpx;
margin: 40rpx 0;
}
.list {
width: 680rpx;
margin: auto;
.item {
border-radius: 30rpx 30rpx 0 0;
box-shadow: 0 3rpx 10rpx 0px #999999;
background-color: #FFFFFF;
margin: 50rpx auto;
position: relative;
.badge {
position: absolute;
left: 30rpx;
top: 30rpx;
}
.image {
width: 680rpx;
height: 360rpx;
border-radius: 30rpx 30rpx 0 0;
}
.info {
padding: 20rpx 20rpx;
display: flex;
flex-direction: column;
.title {
font-size: 40rpx;
}
.desc {
color: #999999;
font-size: 28rpx;
}
.price {
color: #ff0000;
font-size: 30rpx;
}
}
}
}
}
.user-card {
width: 660rpx;
background-color: #FFFFFF;
border-radius: 15rpx;
margin: auto;
padding: 20rpx;
z-index: 100;
}
.float {
width: 750rpx;
display: flex;
justify-content: center;
position: fixed;
bottom: 100rpx;
.release {
width: 500rpx;
opacity: 0.9;
}
}
</style>