Compare commits

...

2 Commits

Author SHA1 Message Date
woody bbcbd9ef97 feat(shareRegister): 分享注册功能 2025-06-10 14:06:32 +08:00
woody 66558d876f feat(order): 升级单流程改造50% 2025-06-10 09:21:43 +08:00
18 changed files with 981 additions and 377 deletions

View File

@ -1,8 +1,8 @@
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.organizeImports": true
"source.fixAll.eslint": "explicit",
"source.organizeImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[vue]": {

13
App.vue
View File

@ -1,4 +1,3 @@
<script>
import { setToken } from '@/config/auth.js'
export default {
@ -9,7 +8,7 @@ export default {
setToken(options.query?.token)
}
const whiteList = [
// 'pages/shareRegist/index',
'pages/shareRegist/index',
// 'pages/shareRegist/success',
'pages/login/index',
// 'pages/wechatPay/bfPay/',
@ -31,13 +30,13 @@ export default {
</script>
<style lang="scss">
body{
background-color: #f2f2f2;
}
body {
background-color: #f2f2f2;
}
/*每个页面公共css */
@import '@/uni_modules/uview-ui/index.scss';
::v-deep .uni-picker-container{
z-index: 100000!important;
::v-deep .uni-picker-container {
z-index: 100000 !important;
}
</style>

View File

@ -108,7 +108,6 @@ export default {
},
handleProductClick(item) {
//
console.log(item, '....ite?')
this.$emit('product-click', item)
},
handleAddToCart(item) {

View File

@ -6,6 +6,7 @@
<area-product-list
:list="registList"
:title="regist.name"
@product-click="redirectList"
></area-product-list>
</view>
</view>
@ -15,6 +16,7 @@
<area-product-list
:list="upgradeList"
:title="upgrade.name"
@product-click="redirectList"
></area-product-list>
</view>
</view>
@ -24,6 +26,7 @@
<area-product-list
:list="repurchaseList"
:title="repurchase.name"
@product-click="redirectList"
></area-product-list>
</view>
</view>
@ -33,6 +36,7 @@
<area-product-list
:list="rescissionList"
:title="rescission.name"
@product-click="redirectList"
></area-product-list>
</view>
</view>
@ -94,6 +98,11 @@ export default {
}
})
},
redirectList(item) {
uni.navigateTo({
url: `/pages/specialArea/list?specialArea=${item.specialArea}&id=${item.pkId}`,
})
},
},
}
</script>

View File

@ -152,6 +152,13 @@
<script>
import * as api from '@/config/goods'
import {
REGIEST_AREA,
UPGRADE_AREA,
REPURCHASE_AREA,
REISSUE_AREA,
} from '@/util/specialAreaMap'
import { MEMBER_SIGN } from '@/util/common'
export default {
data() {
@ -345,8 +352,9 @@ export default {
})
uni.setStorageSync('allGoods', JSON.stringify(shoppArr))
if (
this.goodsCheck[0].specialArea == 1 ||
this.goodsCheck[0].specialArea == 24
[REGIEST_AREA.id, UPGRADE_AREA.id].includes(
this.goodsCheck[0].specialArea
)
) {
let deleteList = []
shoppArr.forEach(item => {
@ -430,22 +438,6 @@ export default {
})
}
}
} else if (this.goodsCheck[0].specialArea == 31) {
if (this.totalPrice < 1000) {
uni.showToast({
title: '购买商品总价格不能低于1000元',
icon: 'none',
duration: 1500,
})
} else {
uni.navigateTo({
url:
'/pages/other/index?specialArea=' +
this.goodsCheck[0].specialArea +
'&shoppArr=' +
JSON.stringify(shoppArr),
})
}
} else {
uni.navigateTo({
url:

View File

@ -49,3 +49,5 @@ export const getUpgradeLevel = params =>
// 下单前校验
export const validRelation = params =>
http.post('sale/api/retail-order/valid-relation', { params })
// 升级订单

View File

@ -20,7 +20,7 @@ module.exports = vm => {
//#ifdef DEV_SERVER
console.log('DEV_SERVER')
config.baseURL = 'http://192.168.0.100:8080'
config.baseURL = 'http://192.168.0.102:8080'
//#endif
//#ifdef QA_SERVER

22
config/share.js Normal file
View File

@ -0,0 +1,22 @@
const http = uni.$u.http
// 获取分享码
export const getShareCode = params =>
http.get('/member/api/share/share-code', { params })
// 根据短码获取memberCode
export const getMemberCode = code =>
http.get(`/member/api/share/find-share-code/${code}`)
// 获取手机验证码
export const getPhoneCode = params =>
http.get('/member/api/share/share-sms-code', { params })
// 注册
export const getRegister = data =>
http.post('/member/api/share/share-register', data)
// 自动登录
export const autoLogin = data =>
http.post('/retail-member/api/retail-auth/auto-login', data)

7
package-lock.json generated
View File

@ -17,6 +17,7 @@
"js-cookie": "^3.0.5",
"qrcodejs2": "0.0.2",
"swiper": "^3.4.2",
"uqrcodejs": "^4.0.7",
"vue-clipboard2": "^0.3.3",
"vue-i18n": "^9.2.2",
"vue-tree-color": "^2.3.2",
@ -6373,6 +6374,12 @@
"yarn": "*"
}
},
"node_modules/uqrcodejs": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/uqrcodejs/-/uqrcodejs-4.0.7.tgz",
"integrity": "sha512-84+aZmD2godCVI+93lxE3YUAPNY8zAJvNA7xRS7R7U+q57KzMDepBSfNCwoRUhWOfR6eHFoAOcHRPwsP6ka1cA==",
"license": "Apache-2.0"
},
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://mirrors.cloud.tencent.com/npm/uri-js/-/uri-js-4.4.1.tgz",

View File

@ -12,6 +12,7 @@
"js-cookie": "^3.0.5",
"qrcodejs2": "0.0.2",
"swiper": "^3.4.2",
"uqrcodejs": "^4.0.7",
"vue-clipboard2": "^0.3.3",
"vue-i18n": "^9.2.2",
"vue-tree-color": "^2.3.2",

View File

@ -262,10 +262,14 @@
"path": "pages/shareRegist/index",
"style": {
"navigationBarTitleText": "注册",
"navigationBarBackgroundColor": "#F33030",
"app-plus": {
"titleNView": false
}
"navigationBarBackgroundColor": "#fff"
}
},
{
"path": "pages/mine/share/index",
"style": {
"navigationBarTitleText": "个人推广二维码",
"navigationBarBackgroundColor": "#fff"
}
},
{

View File

@ -403,6 +403,13 @@ export default {
menuKey: 'selfHelp',
ifshow: false,
},
{
url: '/pages/mine/share/index',
name: '个人推广',
imgurl: '../../static/images/promotion.svg',
menuKey: 'share',
ifshow: true,
},
{
url: '/pages/userSecure/index',
name: '账号安全',

456
pages/mine/share/index.vue Normal file
View File

@ -0,0 +1,456 @@
<template>
<view class="share-container">
<!-- This is the content that will be shared as an image -->
<view class="share-content" :class="{ 'is-loaded': isLoaded }">
<view class="title">扫码注册</view>
<image
class="qr-code"
:src="qrCodeImage"
mode="aspectFit"
v-if="qrCodeImage"
></image>
<view v-else class="qr-code-placeholder">
<view class="loader"></view>
</view>
<view class="tip">扫描二维码即可完成操作</view>
</view>
<button
class="share-button"
:class="{ 'is-loaded': isLoaded }"
@click="sharePage"
>
保存图片并分享
</button>
<!-- Canvas for generating the share image, positioned off-screen -->
<canvas
canvas-id="shareCanvas"
:style="{
width: canvasWidth + 'px',
height: canvasHeight + 'px',
position: 'fixed',
left: '200%',
}"
/>
</view>
</template>
<script>
import { getShareCode } from '@/config/share'
export default {
name: 'ShareQRCode',
data() {
return {
qrCodeImage: '',
// Set canvas dimensions. It's better to get device screen width for this.
canvasWidth: 375,
canvasHeight: 550,
isLoaded: false,
}
},
onLoad() {
this.handleGetShareCode()
// Get screen width to set canvas width dynamically
uni.getSystemInfo({
success: res => {
this.canvasWidth = res.windowWidth
// Adjust height proportionally or keep it fixed
this.canvasHeight = res.windowWidth * 1.4
},
})
},
onReady() {
// Use a short timeout to ensure the initial render is complete before animation
setTimeout(() => {
this.isLoaded = true
}, 100)
},
methods: {
handleGetShareCode() {
// Don't show loading toast, use the placeholder loader instead
// uni.showLoading({ title: '...' })
getShareCode()
.then(res => {
// The screenshot shows the base64 string is in data.datStr
if (res.code === 200 && res.data && res.data.dataStr) {
this.qrCodeImage = 'data:image/png;base64,' + res.data.dataStr
} else {
uni.showToast({
title: '获取分享码失败',
icon: 'none',
})
}
})
.catch(err => {
console.error('getShareCode error:', err)
uni.showToast({
title: '网络错误,请稍后再试',
icon: 'none',
})
})
},
async sharePage() {
if (!this.qrCodeImage) {
uni.showToast({
title: '二维码尚未生成',
icon: 'none',
})
return
}
uni.showLoading({ title: '正在生成图片...' })
try {
const tempImagePath = await this.base64ToTempFilePath(this.qrCodeImage)
if (!tempImagePath) {
throw new Error('图片处理失败')
}
const ctx = uni.createCanvasContext('shareCanvas', this)
this.drawShareImage(ctx, tempImagePath)
ctx.draw(false, () => {
this.saveCanvasToAlbum()
})
} catch (error) {
uni.hideLoading()
uni.showToast({ title: error.message || '图片生成失败', icon: 'none' })
console.error('sharePage error:', error)
}
},
drawShareImage(ctx, tempImagePath) {
const canvasWidth = this.canvasWidth
const canvasHeight = this.canvasHeight
// White background
ctx.fillStyle = '#FFFFFF'
ctx.fillRect(0, 0, canvasWidth, canvasHeight)
// Title
ctx.setFontSize(22)
ctx.fillStyle = '#1e1e1e'
ctx.textAlign = 'center'
ctx.fillText('扫码注册', canvasWidth / 2, 70)
// QR Code Image
const qrCodeSize = canvasWidth * 0.7
const qrCodeX = (canvasWidth - qrCodeSize) / 2
const qrCodeY = 120
ctx.drawImage(tempImagePath, qrCodeX, qrCodeY, qrCodeSize, qrCodeSize)
// Tip text
ctx.setFontSize(15)
ctx.fillStyle = '#888'
ctx.textAlign = 'center'
ctx.fillText(
'扫描二维码,即可完成操作',
canvasWidth / 2,
qrCodeY + qrCodeSize + 50
)
},
saveCanvasToAlbum() {
uni.canvasToTempFilePath(
{
canvasId: 'shareCanvas',
success: res => {
// #ifdef H5
// For H5, trigger download instead of saving to album
const link = document.createElement('a')
link.href = res.tempFilePath
link.download = `share_qrcode_${Date.now()}.png`
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
uni.hideLoading()
uni.showToast({
title: '图片已开始下载',
icon: 'success',
})
// #endif
// #ifndef H5
// For App and Mini Programs
uni.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: () => {
uni.hideLoading()
uni.showToast({
title: '图片已保存到相册',
icon: 'success',
})
},
fail: err => {
uni.hideLoading()
if (
err.errMsg &&
(err.errMsg.includes('auth deny') ||
err.errMsg.includes('auth denied'))
) {
uni.showModal({
title: '提示',
content: '需要您授权保存相册',
showCancel: false,
success: () => {
uni.openSetting({
success(settingdata) {
if (
settingdata.authSetting['scope.writePhotosAlbum']
) {
uni.showToast({
title: '授权成功,请重试',
icon: 'none',
})
} else {
uni.showToast({
title: '获取权限失败',
icon: 'none',
})
}
},
})
},
})
} else {
uni.showToast({ title: '保存失败', icon: 'none' })
console.error('saveImageToPhotosAlbum fail:', err)
}
},
})
// #endif
},
fail: err => {
uni.hideLoading()
uni.showToast({ title: '图片转换失败', icon: 'none' })
console.error('canvasToTempFilePath fail:', err)
},
},
this
)
},
base64ToTempFilePath(base64) {
return new Promise((resolve, reject) => {
// #ifdef H5
// For H5, we load the base64 into an Image to ensure it's valid,
// but resolve with the base64 string to avoid Uniapp's internal errors
// when its functions expect a string path instead of an Image object.
const image = new Image()
// Resolve CORS issue for QR code from different origin
image.crossOrigin = 'Anonymous'
image.src = base64
image.onload = () => {
// Resolve with the string, not the object.
resolve(base64)
}
image.onerror = err => {
console.error('Failed to load image for canvas on H5', err)
reject(new Error('H5图片加载失败'))
}
// #endif
// #ifndef H5
// For App and Mini Programs, write to a temp file and return the path.
const formattedBase64 = base64.replace(/^data:image\/\w+;base64,/, '')
// Use a standard path for user data directory.
const filePath = `${uni.env.USER_DATA_PATH}/share_${Date.now()}.png`
uni.getFileSystemManager().writeFile({
filePath,
data: formattedBase64,
encoding: 'base64',
success: () => {
resolve(filePath)
},
fail: err => {
console.error('Failed to write temp file', err)
reject(new Error('临时文件写入失败'))
},
})
// #endif
})
},
},
}
</script>
<style lang="scss" scoped>
.share-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40rpx;
background: linear-gradient(to bottom, #e0f7fa 0%, #ffffff 100%);
min-height: 100vh;
box-sizing: border-box;
position: relative;
overflow: hidden;
}
@keyframes float {
0% {
transform: translateY(0px) scale(1);
opacity: 0.7;
}
50% {
transform: translateY(-20px) scale(1.03);
opacity: 1;
}
100% {
transform: translateY(0px) scale(1);
opacity: 0.7;
}
}
.share-container::before,
.share-container::after {
content: '';
position: absolute;
border-radius: 50%;
background: linear-gradient(
to top,
rgba(0, 198, 255, 0.05),
rgba(0, 114, 255, 0.1)
);
z-index: 1;
pointer-events: none;
}
.share-container::before {
width: 400rpx;
height: 400rpx;
top: -150rpx;
left: -150rpx;
animation: float 12s ease-in-out infinite;
}
.share-container::after {
width: 500rpx;
height: 500rpx;
bottom: -200rpx;
right: -200rpx;
animation: float 15s ease-in-out infinite -5s;
}
.share-content {
background: radial-gradient(
circle at 50% 0%,
rgba(220, 235, 255, 0.9),
#ffffff 80%
);
border-radius: 30rpx;
padding: 80rpx 50rpx;
display: flex;
flex-direction: column;
align-items: center;
width: 100%;
box-shadow:
0 16rpx 48rpx rgba(0, 0, 0, 0.1),
inset 0 1px 2px rgba(255, 255, 255, 0.7);
margin-bottom: 60rpx;
position: relative;
z-index: 2;
opacity: 0;
transform: translateY(40rpx);
transition:
transform 0.6s cubic-bezier(0.25, 1, 0.5, 1),
opacity 0.6s ease;
overflow: hidden;
}
.share-content::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 6rpx;
background-image: linear-gradient(90deg, #00c6ff, #0072ff);
opacity: 0.9;
}
.share-content.is-loaded {
opacity: 1;
transform: translateY(0);
}
.title {
font-size: 44rpx;
font-weight: 500;
color: #1e1e1e;
margin-bottom: 60rpx;
}
.qr-code {
width: 450rpx;
height: 450rpx;
margin-bottom: 30rpx;
border-radius: 16rpx;
}
.qr-code-placeholder {
width: 450rpx;
height: 450rpx;
background-color: #f0f2f5;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 30rpx;
border-radius: 16rpx;
}
.loader {
width: 100rpx;
height: 100rpx;
border: 8rpx solid rgba(0, 0, 0, 0.1);
border-left-color: #0072ff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
.tip {
font-size: 30rpx;
color: #888;
}
.share-button {
margin-top: 0;
width: 90%;
background-image: linear-gradient(90deg, #0072ff, #00c6ff);
color: white;
border-radius: 50rpx;
font-size: 34rpx;
height: 100rpx;
line-height: 100rpx;
box-shadow: 0 10rpx 20rpx rgba(0, 114, 255, 0.25);
border: none;
transition:
transform 0.2s ease,
box-shadow 0.2s ease;
z-index: 2;
opacity: 0;
transform: translateY(40rpx);
transition:
transform 0.6s cubic-bezier(0.25, 1, 0.5, 1) 0.1s,
opacity 0.6s ease 0.1s;
}
.share-button.is-loaded {
opacity: 1;
transform: translateY(0);
}
.share-button:active {
transform: translateY(2rpx);
box-shadow: 0 6rpx 12rpx rgba(0, 114, 255, 0.3);
}
</style>

View File

@ -18,7 +18,7 @@
</view> -->
<view class="context">
<u-form :model="form" labelWidth="75" :rules="rules" ref="uForm">
<u-form-item :label="'申请级别'" borderBottom prop="pkGradeVal">
<u-form-item :label="formLevelLabel" borderBottom prop="pkGradeVal">
<u-input
v-model="form.pkGradeVal"
border="none"
@ -26,47 +26,59 @@
disabled
/>
</u-form-item>
<!-- <u-form-item
:label="'自然国家'"
@tap="changeCountry(0)"
<u-form-item
v-show="isRegiest"
:label="'推荐编号'"
required
borderBottom
prop="parent"
>
<view class="disFlex justBwn">
<view class="disFlex">
<img class="countImg" :src="form.pkCountryImg" alt="" />
<view>{{ form.pkCountryLabel }}</view>
</view>
<u-icon name="arrow-right"></u-icon>
</view>
</u-form-item> -->
<!-- @tap="changeCountry(1)" -->
<!-- <u-form-item :label="'结算国家'" borderBottom>
<view class="disFlex justBwn">
<view class="disFlex">
<img class="countImg" :src="form.pkSettleCountryImg" alt="" />
<view>{{ form.pkSettleCountryLabel }}</view>
</view>
<u-icon name="arrow-right"></u-icon>
</view>
</u-form-item> -->
<u-form-item :label="'推荐编号'" required borderBottom prop="parent">
<u-input
v-model="form.parent"
@blur="getValidPcode()"
border="none"
/>
</u-form-item>
<u-form-item :label="'推荐姓名'" borderBottom prop="parentName">
<u-form-item
v-show="isRegiest"
:label="'推荐姓名'"
borderBottom
prop="parentName"
>
<u-input v-model="form.parentName" disabled border="none" />
</u-form-item>
<u-form-item label="会员昵称" required borderBottom prop="memberName">
<u-input :maxlength="40" v-model="form.memberName" border="none" />
<u-form-item
v-if="!isRegiest"
label="会员编号"
required
borderBottom
prop="memberCode"
>
<u-input
:disabled="isRegiest"
:maxlength="40"
v-model="form.memberCode"
border="none"
/>
</u-form-item>
<u-form-item :label="'联系方式'" required borderBottom prop="phone">
<u-form-item label="会员昵称" required borderBottom prop="memberName">
<u-input
:disabled="isRegiest"
:maxlength="40"
v-model="form.memberName"
border="none"
/>
</u-form-item>
<u-form-item
v-show="isRegiest"
:label="'联系方式'"
required
borderBottom
prop="phone"
>
<u-input
v-model="form.phone"
:disabled="isRegiest"
maxlength="11"
type="number"
border="none"
@ -366,14 +378,7 @@
:columns="countryList"
keyName="label"
></u-picker>
<!-- 选择安置位置 -->
<u-picker
:show="isPlace"
@cancel="isPlace = false"
@confirm="surePlace"
:columns="placeList"
keyName="label"
></u-picker>
<!-- 发货方式 -->
<u-picker
:show="isDelivery"
@ -467,19 +472,6 @@ export default {
isDelivery: false,
isBank: false,
isTrans: false,
placeList: [
[
{
id: 1,
label: '安置左区',
},
{
id: 2,
label: '安置右区',
},
],
],
isPlace: false,
countryIndex: 0,
isCountry: false,
userInfo: '',
@ -614,6 +606,14 @@ export default {
selTable: [],
}
},
computed: {
formLevelLabel() {
return this.specialArea == UPGRADE_AREA.id ? '升级级别' : '申请级别'
},
isRegiest() {
return this.specialArea == REGIEST_AREA.id
},
},
onLoad(options) {
const user = uni.getStorageSync('User')
this.pkCountry = user.pkSettleCountry
@ -805,19 +805,31 @@ export default {
// this.allGoodsData.deleteList = deleteList
// console.log(this.shoppingArr, '....allGoodsData')
// return
api
.memLevel({
firstCheck: 0,
specialArea: this.specialArea,
shopList: this.shoppingArr.map(id => {
return {
shoppingId: id,
}
}),
})
.then(res => {
this.form.pkGradeVal = res.data.pkGradeVal
})
const params = {
firstCheck: 0,
specialArea: this.specialArea,
shopList: this.shoppingArr.map(id => {
return {
shoppingId: id,
}
}),
}
if (this.specialArea == UPGRADE_AREA.id) {
params.upgradeMemberCode = this.form.parent
}
api.memLevel(params).then(res => {
if (res.code == 200) {
if (res.data.isEnough) {
this.form.pkGradeVal = res.data.pkGradeVal
} else {
this.form.pkGradeVal = ''
uni.showToast({
title: res.data.msg,
icon: 'none',
})
}
}
})
},
checkAddress() {},
getValidPcode() {

View File

@ -1,97 +1,88 @@
<!--
* @Descripttion:
* @version:
* @Descripttion:
* @version:
* @Author: kBank
* @Date: 2022-11-21 15:11:22
-->
<template>
<view >
<view v-if="!pkCountry" class="content1">
<!-- <view class="index_header">
<view>
<view v-if="!pkCountry" class="content1">
<!-- <view class="index_header">
<view>注册</view>
</view> -->
<!-- <view class="tit" v-if="!pkCountry">{{ '嗨粉扫天下' }}</view> -->
<!-- 海粉 -->
<view class="formed1"
>
<u-form :model="form"
labelWidth="80px"
ref="uForm"
:rules="rules">
<u-form-item label=""
prop="memberCode">
<u-input v-model="form.memberCode"
type="number"
disabled>
<u--text :text="howHeader"
slot="prefix"
margin="0 3px 0 0"
type="tips"></u--text>
</u-input>
</u-form-item>
<u-form-item label=""
prop="memberName">
<u-input v-model="form.memberName"
:placeholder="'请输入会员姓名'" />
</u-form-item>
<u-form-item label=""
prop="phone">
<u-input v-model="form.phone" @blur="setMemberCode"
:placeholder="'请输入联系方式'" type="number" maxlength="20" />
</u-form-item>
<u-form-item label=""
prop="loginPassword">
<u-input :password="isPwd"
:placeholder="'请输入登录密码'"
v-model="form.loginPassword">
<template slot="suffix">
<u-icon name="eye"
@tap="isPwd=!isPwd"
v-if="!isPwd"></u-icon>
<u-icon name="eye-off"
@tap="isPwd=!isPwd"
v-else></u-icon>
</template>
</u-input>
</u-form-item>
<u-form-item label=""
prop="payPassword">
<u-input :password="isPwd2"
:placeholder="'请输入支付密码'"
v-model="form.payPassword">
<template slot="suffix">
<u-icon name="eye"
@tap="isPwd2=!isPwd2"
v-if="!isPwd2"></u-icon>
<u-icon name="eye-off"
@tap="isPwd2=!isPwd2"
v-else></u-icon>
</template>
</u-input>
</u-form-item>
<u-form-item label=""
prop="code">
<u-input v-model="form.code"
:placeholder="'请输入验证码'">
<template slot="suffix">
<view class="getCode"
@tap="getVilCode">{{ getCode }}</view>
</template>
</u-input>
</u-form-item>
</u-form>
<u-button type="success"
class="uBtn"
shape="circle"
color="linear-gradient(to right, #005BAC, #005BAC )"
:loading="isLoading"
:loadingText="'注册中'"
@click="toLogin">{{ '立即注册' }}</u-button>
<view class="title">欢迎注册</view>
<!-- <view class="tit" v-if="!pkCountry">{{ '嗨粉扫天下' }}</view> -->
<!-- 海粉 -->
<view class="formed1">
<u-form :model="form" labelWidth="90px" ref="uForm" :rules="rules">
<u-form-item label="推荐编号" prop="parentCode">
<u-input v-model="form.parentCode" disabled> </u-input>
</u-form-item>
<u-form-item label="会员姓名" prop="memberName">
<u-input
v-model="form.memberName"
:placeholder="'请输入会员姓名'"
/>
</u-form-item>
<u-form-item label="联系方式" prop="phone">
<u-input
v-model="form.phone"
:placeholder="'请输入联系方式'"
type="number"
maxlength="20"
/>
</u-form-item>
<u-form-item label="登录密码" prop="loginPwd">
<u-input
:password="isPwd"
:placeholder="'请输入登录密码'"
v-model="form.loginPwd"
>
<template #suffix>
<u-icon name="eye" @tap="isPwd = !isPwd" v-if="!isPwd"></u-icon>
<u-icon name="eye-off" @tap="isPwd = !isPwd" v-else></u-icon>
</template>
</u-input>
</u-form-item>
<u-form-item label="支付密码" prop="payPwd">
<u-input
:password="isPwd2"
:placeholder="'请输入支付密码'"
v-model="form.payPwd"
>
<template #suffix>
<u-icon
name="eye"
@tap="isPwd2 = !isPwd2"
v-if="!isPwd2"
></u-icon>
<u-icon name="eye-off" @tap="isPwd2 = !isPwd2" v-else></u-icon>
</template>
</u-input>
</u-form-item>
<u-form-item label="验证码" prop="smsCode">
<u-input v-model="form.smsCode" :placeholder="'请输入验证码'">
<template #suffix>
<view class="getCode" @tap="getVilCode">{{ getCode }}</view>
</template>
</u-input>
</u-form-item>
</u-form>
<u-button
type="success"
class="uBtn"
shape="circle"
color="linear-gradient(to right, #005BAC, #005BAC )"
:loading="isLoading"
:loadingText="'注册中'"
@click="toLogin"
>{{ '立即注册' }}</u-button
>
</view>
</view>
</view>
<view v-else class="content">
<!-- <view class="tit" >{{ '海粉扫天下' }}</view>
<view v-else class="content">
<!-- <view class="tit" >{{ '海粉扫天下' }}</view>
<view class="formed"
>
<u-form :model="form"
@ -139,10 +130,10 @@
</view>
</u-form-item>
<u-form-item label=""
prop="loginPassword">
prop="loginPwd">
<u-input :password="isPwd1"
:placeholder="'请输入登录密码'"
v-model="form.loginPassword">
v-model="form.loginPwd">
<template slot="suffix">
<u-icon name="eye"
@tap="isPwd1=!isPwd1"
@ -154,10 +145,10 @@
</u-input>
</u-form-item>
<u-form-item label=""
prop="payPassword">
prop="payPwd">
<u-input :password="isPwd2"
:placeholder="'请输入支付密码'"
v-model="form.payPassword">
v-model="form.payPwd">
<template slot="suffix">
<u-icon name="eye"
@tap="isPwd2=!isPwd2"
@ -184,24 +175,65 @@
:columns="countryList"></u-picker>
</view> -->
</view>
<u-modal
:show="showSuccessModal"
title="注册成功"
:show-cancel-button="true"
cancel-text="复制"
confirm-text="自动登录"
@confirm="onModalConfirm"
@cancel="onModalCancel"
@close="showSuccessModal = false"
>
<view class="slot-content" v-if="successData">
<view class="success-item">
<text class="item-label">会员编号:</text>
<text class="item-value">{{ successData.memberCode }}</text>
</view>
<view class="success-item">
<text class="item-label">会员姓名:</text>
<text class="item-value">{{ successData.memberName }}</text>
</view>
<view class="success-item">
<text class="item-label">联系方式:</text>
<text class="item-value">{{ successData.phone }}</text>
</view>
<view class="success-item">
<text class="item-label">登录密码:</text>
<text class="item-value">{{ successData.loginPassword }}</text>
</view>
<view class="success-item">
<text class="item-label">支付密码:</text>
<text class="item-value">{{ successData.payPassword }}</text>
</view>
</view>
</u-modal>
</view>
<view class="mask" v-if="isTrue">
</view>
</view>
</template>
<script>
import * as api from '@/config/goods'
import {
getMemberCode,
getPhoneCode,
getRegister,
autoLogin,
} from '@/config/share'
export default {
components: {},
data() {
return {
isTrue:false,
isTrue: false,
howHeader: 'HF',
pkParent: '',
form: {
memberName: '',
smsCode: '',
loginPwd: '',
payPwd: '',
parentCode: '',
phone: '',
},
isLoading: false,
getCode: '获取验证码',
@ -214,47 +246,49 @@ export default {
isPwd: true,
isPwd1: true,
isPwd2: true,
showSuccessModal: false,
successData: null,
rules: {
memberCode: [
parentCode: [
{
required: true,
asyncValidator: this.memberCodeRule,
message: '请输入推荐编号',
trigger: ['blur'],
},
],
memberName: [
{
required: true,
message:'请输入会员姓名',
trigger: [ 'blur'],
message: '请输入会员姓名',
trigger: ['blur'],
},
],
phone: [
{
required: true,
message: '请输入联系方式',
trigger: [ 'blur'],
trigger: ['blur'],
},
],
code: [
smsCode: [
{
required: true,
message: '请输入验证码',
trigger: ['blur'],
},
],
loginPassword: [
loginPwd: [
{
required: true,
message: '请输入登录密码',
trigger: ['blur'],
},
],
payPassword: [
payPwd: [
{
required: true,
message: '请输入支付密码',
trigger: [ 'blur'],
trigger: ['blur'],
},
],
},
@ -280,14 +314,14 @@ export default {
trigger: ['change', 'blur'],
},
],
loginPassword: [
loginPwd: [
{
required: true,
message: '请输入登录密码',
trigger: ['change', 'blur'],
},
],
payPassword: [
payPwd: [
{
required: true,
message: '请输入支付密码',
@ -303,11 +337,12 @@ export default {
this.pkCountry = options.country || ''
this.getGenerate()
if (this.pkCountry) {
this.getCountry()
// this.getCountry()
this.form.pkCountry = this.pkCountry
uni.setStorageSync('pkCountry',this.pkCountry)
uni.redirectTo({ url: '/pages/shareArea/hiList?pkParent=' + this.pkParent})
uni.setStorageSync('pkCountry', this.pkCountry)
uni.redirectTo({
url: '/pages/shareArea/hiList?pkParent=' + this.pkParent,
})
// this.$refs.uForm1.setRules(this.rules1)
} else {
//
@ -318,20 +353,16 @@ export default {
},
onShow() {},
methods: {
setMemberCode(){
// this.form.memberCode = this.form.phone
this.$set(this.form,'memberCode',this.form.phone)
},
selCountry(){
selCountry() {
uni.showModal({
title: '提示',
content: '确认更换自然国',
success: (res) => {
if (res.confirm) {
this.isCountry = true
}
},
})
title: '提示',
content: '确认更换自然国',
success: res => {
if (res.confirm) {
this.isCountry = true
}
},
})
},
memberCodeRule(rule, value, callback) {
if (!value) {
@ -340,7 +371,7 @@ export default {
if (value.length < 10 || value.length > 20) {
callback(new Error('请输入10-20位数字'))
} else {
api.validateMember(value).then((res) => {
api.validateMember(value).then(res => {
if (res.code == 200) {
callback()
} else {
@ -351,47 +382,101 @@ export default {
}
},
getHeader() {
api.checkShare().then((res) => {
if(res.code != 200){
this.isTrue = true
}else{
this.isTrue = false
}
getMemberCode(this.pkParent).then(res => {
this.$set(this.form, 'parentCode', res.data)
console.log(this.form)
})
// api.prefix(this.pkParent).then((res) => {
// this.howHeader = res.msg
// })
},
getGenerate() {
api.generate().then((res) => {
api.generate().then(res => {
uni.setStorageSync('mToken', res.msg)
})
},
toLogin() {
this.$refs.uForm.validate().then((res) => {
this.$refs.uForm.validate().then(() => {
this.isLoading = true
api
.regShareMember(
Object.assign({}, this.form, { parent: this.pkParent })
)
.then((res) => {
getRegister(Object.assign({}, this.form, { parentCode: this.pkParent }))
.then(res => {
this.isLoading = false
if (res.code == 200) {
uni.redirectTo({
url:
'/pages/shareRegist/success?allData=' +
JSON.stringify(res.data),
this.successData = res.data
this.showSuccessModal = true
} else {
uni.showToast({
title: res.msg || '注册失败',
icon: 'none',
})
}
})
.catch(() => {
this.isLoading = false
uni.showToast({
title: '注册请求失败',
icon: 'none',
})
})
})
},
onModalConfirm() {
if (this.successData) {
this.handleAutoLogin(this.successData)
}
},
onModalCancel() {
if (this.successData) {
const modalContent = `会员编号: ${this.successData.memberCode}\n会员姓名: ${this.successData.memberName}\n联系方式: ${this.successData.phone}\n登录密码: ${this.successData.loginPassword}\n支付密码: ${this.successData.payPassword}`
uni.setClipboardData({
data: modalContent,
success: function () {
uni.showToast({
title: '复制成功',
icon: 'success',
})
},
})
}
},
handleAutoLogin(loginData) {
autoLogin({
username: loginData.memberCode,
password: loginData.loginPassword,
uuid: loginData.uuid,
})
.then(loginRes => {
if (loginRes.code === 200) {
uni.showToast({
title: '登录成功',
icon: 'success',
duration: 1500,
})
setTimeout(() => {
uni.reLaunch({
url: '/pages/index/index',
})
}, 1500)
} else {
uni.showToast({
title: loginRes.msg || '自动登录失败',
icon: 'none',
})
}
})
.catch(() => {
uni.showToast({
title: '自动登录请求失败',
icon: 'none',
})
})
},
hiLogin() {
this.$refs.uForm1.validate().then((res) => {
this.$refs.uForm1.validate().then(res => {
this.isLoading = true
api
.hiRegister(Object.assign({}, this.form, { pkParent: this.pkParent }))
.then((res) => {
.then(res => {
this.isLoading = false
if (res.code == 200) {
uni.redirectTo({
@ -409,16 +494,16 @@ export default {
this.isCountry = false
},
getCountry() {
api.getCountry().then((res) => {
api.getCountry().then(res => {
this.countryList = [
res.data.map((item) => {
res.data.map(item => {
return {
label: item.shortName,
id: item.pkId,
}
}),
]
this.countryList[0].forEach((item) => {
this.countryList[0].forEach(item => {
if (this.pkCountry == item.id) {
this.form.jsName = item.label
this.form.pkCountryName = item.label
@ -429,12 +514,12 @@ export default {
//
getVilCode() {
this.startTime()
api
.verification({
phone: this.form.phone,
})
.then((res) => {})
.catch((err) => {
getPhoneCode({
phone: this.form.phone,
parentCode: this.pkParent,
})
.then(res => {})
.catch(err => {
this.beginTime = 0
})
},
@ -460,35 +545,37 @@ export default {
</script>
<style lang="scss" scoped>
.content1{
background-image: url('@/static/images/haiRgeiest1.jpg');
background-size: 100%;
background-repeat: no-repeat;
.content1 {
background: linear-gradient(-45deg, #005bac, #0077c2, #0099e0, #00bfff);
background-size: 400% 400%;
animation: gradient 15s ease infinite;
height: 100vh;
overflow: auto;
}
.content{
.content {
background-image: url('@/static/images/huan.jpg');
// background-image: url('@/static/images/regiestBg.jpg');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
background-repeat: no-repeat;
background-position: center;
height: 100vh;
}
.tit{
font-size: 48px;
font-family: PangMenZhengDao-Regular, PangMenZhengDao;
font-weight: 400;
color: #FFFFFF;
text-align: center;
padding-top: 80px;
margin-bottom: 20px;
.title {
font-size: 48rpx;
font-weight: bold;
color: #333;
text-align: center;
padding-top: 120rpx;
padding-bottom: 80rpx;
}
.index_header {
background: #f9f9f9;;
background: #f9f9f9;
height: 330rpx;
font-size: 18px;
font-family: PingFang SC-Semibold, PingFang SC;
font-family:
PingFang SC-Semibold,
PingFang SC;
font-weight: 600;
color: #333333;
text-align: center;
@ -498,14 +585,18 @@ margin-bottom: 20px;
padding: 0 120rpx;
}
.formed1 {
padding: 0 120rpx;
padding-top: 550rpx;
margin: 0 40rpx;
padding: 40rpx 30rpx;
background-color: rgba(255, 255, 255, 0.85);
border-radius: 16rpx;
}
.getCode {
font-size: 10px;
font-family: PingFang SC-Regular, PingFang SC;
font-family:
PingFang SC-Regular,
PingFang SC;
font-weight: 400;
color: #005BAC;
color: #005bac;
}
.uBtn {
margin-top: 120rpx;
@ -519,16 +610,49 @@ margin-bottom: 20px;
border-style: solid;
border-radius: 4px;
padding: 6px 9px;
background: #fff;
}
::v-deep .u-input{
background: #fff;
}
.mask{
::v-deep .u-input {
background: #fff;
}
.mask {
position: fixed;
background: rgba(0,0,0,0.5);
background: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100vh;
top: 0;
}
@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
.slot-content {
padding: 30rpx 20rpx;
font-size: 28rpx;
}
.success-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10rpx 0;
}
.item-label {
color: #606266;
margin-right: 20rpx;
flex-shrink: 0;
}
.item-value {
color: #303133;
word-break: break-all;
text-align: right;
}
</style>

View File

@ -35,5 +35,6 @@ export default {
background: #f2f2f2;
// padding: 0 20rpx;
min-height: 94vh;
padding-bottom: 100rpx;
}
</style>

View File

@ -10,13 +10,6 @@
<view class="index_header">
<view>{{ titLabel }}</view>
</view>
<view class="shareImg" v-if="specialArea == 7" @click="goShare">
<u-icon name="share-square" size="24" color="#005BAC"> </u-icon>
</view>
<view class="shareImg1" v-if="specialArea == 1" @tap="changeCountry">
<img :src="pkCountryImg" alt="" />
<u-icon name="arrow-down" color="#999"></u-icon>
</view>
<u-scroll-list
:indicator="false"
v-if="itemChildren.length > 1"
@ -107,12 +100,6 @@
<view class="pv" v-if="specialArea == 10">
积分可抵扣:{{ item.deductMoney | numberToCurrency }}
</view>
<view
class="pv"
v-if="specialArea == 31 && userInfo.isMakerSpace == 0"
>
业绩:{{ item.waresAchieve | numberToCurrency }}
</view>
<view class="pv" v-if="specialArea == 13">
BV:{{ item.assAchieve | numberToCurrency }}
</view>
@ -181,6 +168,15 @@ import { mapGetters, mapActions } from 'vuex'
import * as api from '@/config/goods'
import clTabbar from '@/components/cl-tabbar.vue'
import selSpaceGoods from '@/components/selSpaceGoods.vue'
import {
REGIEST_AREA,
UPGRADE_AREA,
REPURCHASE_AREA,
REISSUE_AREA,
} from '@/util/specialAreaMap'
import { MEMBER_SIGN } from '@/util/common'
import areaProductList from '@/components/area-product-list/index.vue'
import { getAreaGoods } from '@/config/special-area'
export default {
components: {
@ -221,13 +217,13 @@ export default {
}
},
onLoad(options) {
if (JSON.parse(options.children).length > 0) {
if (JSON.parse(options?.children || '[]').length > 0) {
let arr = []
if (options.childArea) {
this.specialArea = options.childArea
// this.diff = 1
} else {
JSON.parse(options.children).forEach(item => {
JSON.parse(options?.children || '[]').forEach(item => {
if (item.isShow) {
arr.push(item.value)
}
@ -242,40 +238,36 @@ export default {
this.specialArea = options.specialArea
}
this.titLabel = options.label
let tempArr = JSON.parse(options.children)
if (this.specialArea != 18) {
api.menuList().then(res => {
tempArr = tempArr.filter(item =>
res.data.find(ctem => ctem.menuKey == item.name)
)
this.itemChildren = tempArr
})
}
// this.titLabel = options.label
// let tempArr = JSON.parse(options?.children || '[]')
// if (this.specialArea != 18) {
// api.menuList().then(res => {
// tempArr = tempArr.filter(item =>
// res.data.find(ctem => ctem.menuKey == item.name)
// )
// this.itemChildren = tempArr
// })
// }
//
const areaMap = {
[REGIEST_AREA.id]: REGIEST_AREA.name,
[UPGRADE_AREA.id]: UPGRADE_AREA.name,
[REPURCHASE_AREA.id]: REPURCHASE_AREA.name,
[REISSUE_AREA.id]: REISSUE_AREA.name,
}
this.titLabel = areaMap[this.specialArea]
uni.setNavigationBarTitle({
title: this.titLabel,
success: () => {},
success: () => {
console.log(title)
},
})
//
// this.getClassIfy()
this.userInfo = uni.getStorageSync('User')
console.log(
'%c [ this.userInfo ]-242',
'font-size:13px; background:#cb38d2; color:#ff7cff;',
this.userInfo
)
if (this.specialArea == 1) {
if (uni.getStorageSync('pkCountry')) {
this.pkCountry = uni.getStorageSync('pkCountry')
} else {
this.pkCountry = this.userInfo.pkSettleCountry
uni.setStorageSync('pkCountry', this.pkCountry + '')
}
} else {
this.pkCountry = this.userInfo.pkSettleCountry
}
this.pkCountry = this.userInfo.pkCountry || 1
this.setSpecial({
value: this.specialArea,
})
@ -299,7 +291,6 @@ export default {
this.setSmallCarLength(0)
},
beforeDestroy() {
console.log('beforeDestroy........?')
this.setSmallCarLength(0)
},
methods: {
@ -342,18 +333,8 @@ export default {
})
},
setSpecial(item) {
if (item.value == 21) {
// uni.navigateTo({
// url:
// '/pages/specialArea/haIndex?label=' +
// this.titLabel +
// '&specialArea=21&children=' +
// JSON.stringify(this.itemChildren),
// })
} else {
this.specialArea = item.value
this.getClassIfy()
}
this.specialArea = item.value
this.getClassIfy()
},
addCar(item) {
let carList = {
@ -363,29 +344,20 @@ export default {
waresCode: item.waresCode,
productGroup: item.productGroup,
}
if (
item.isMakerGift == 2 &&
(item.specialArea == 1 || item.specialArea == 3)
) {
this.$refs.selSpaceGoods.getData(carList)
} else {
api.addShopping(carList).then(res => {
if (res.code == 200) {
uni.showToast({
title: '购物车添加成功',
icon: 'success',
mask: true,
api.addShopping(carList).then(res => {
if (res.code == 200) {
uni.showToast({
title: '购物车添加成功',
icon: 'success',
mask: true,
})
setTimeout(() => {
this.$store.dispatch('getCarLength', this.specialArea).then(res => {
this.shopCarLength = res.data.smallCount
})
setTimeout(() => {
this.$store
.dispatch('getCarLength', this.specialArea)
.then(res => {
this.shopCarLength = res.data.smallCount
})
}, 200)
}
})
}
}, 200)
}
})
},
getCatLength() {
this.$store.dispatch('getCarLength', this.specialArea).then(res => {
@ -429,37 +401,33 @@ export default {
})
},
getAllGoods(id) {
api
.getAllGoods({
pkCountry: this.pkCountry,
specialArea: Number(this.specialArea),
pkAreaClassify: id ? id : '',
})
.then(res => {
this.goodList = res.data
this.goodList.forEach(item => {
if (item.waresName.length > 11) {
item.waresName = item.waresName.substring(0, 11) + '...'
}
})
getAreaGoods({
pkCountry: this.pkCountry,
specialArea: Number(this.specialArea),
pkAreaClassify: id ? id : '',
}).then(res => {
this.goodList = res.data || []
this.goodList.forEach(item => {
if (item.waresName.length > 11) {
item.waresName = item.waresName.substring(0, 11) + '...'
}
})
})
},
getAllGoods1(id) {
api
.getAllGoods({
pkCountry: this.pkCountry,
specialArea: this.specialArea,
waresName: this.waresName,
pkAreaClassify: id ? id : this.oneId,
})
.then(res => {
this.goodList = res.data
this.goodList.forEach(item => {
if (item.waresName.length > 11) {
item.waresName = item.waresName.substring(0, 11) + '...'
}
})
getAreaGoods({
pkCountry: this.pkCountry,
specialArea: this.specialArea,
waresName: this.waresName,
pkAreaClassify: id ? id : this.oneId,
}).then(res => {
this.goodList = res.data
this.goodList.forEach(item => {
if (item.waresName.length > 11) {
item.waresName = item.waresName.substring(0, 11) + '...'
}
})
})
},
goDetails(item) {
if (item.preSaleStatus != 3 && item.isSale != 1) {

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1749519102102" class="icon" viewBox="128 128 768 768" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4253" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="400"><path d="M435.456 128h-256a51.2 51.2 0 0 0-51.2 51.2v256a51.2 51.2 0 0 0 51.2 51.2h256a51.2 51.2 0 0 0 51.2-51.2v-256a51.2 51.2 0 0 0-51.2-51.2zM435.456 537.6h-256a51.2 51.2 0 0 0-51.2 51.2v256a51.2 51.2 0 0 0 51.2 51.2h256a51.2 51.2 0 0 0 51.2-51.2v-256a51.2 51.2 0 0 0-51.2-51.2zM844.544 128h-256a51.2 51.2 0 0 0-51.2 51.2v256a51.2 51.2 0 0 0 51.2 51.2h256a51.2 51.2 0 0 0 51.2-51.2v-256a51.2 51.2 0 0 0-51.2-51.2zM591.9744 610.9696a24.4736 24.4736 0 0 0-24.5248 24.5248v224.0512a24.576 24.576 0 0 0 49.0496 0v-224.0512a24.576 24.576 0 0 0-24.5248-24.5248zM716.544 680.5504a24.576 24.576 0 0 0-24.5248 24.5248v154.4704a24.576 24.576 0 0 0 49.0496 0v-154.4704a24.576 24.576 0 0 0-24.5248-24.5248zM842.3936 547.0208a24.576 24.576 0 0 0-24.5248 24.5248v288a24.576 24.576 0 0 0 49.0496 0v-288a24.576 24.576 0 0 0-24.5248-24.5248z" p-id="4254" fill="#f52a10"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB