feat(uniapp_v2): 二开功能迁移与小程序主包优化

- 从 uniapp 迁移 HJF 页面、API、组件及用户/订单相关改动
- queue、assets 使用独立分包以降低主包体积
- 修复首页单根节点与支付结果页 v-if 链
- 关闭 HjfDemoPanel 全局注册;uniNoticeBar 注释 $getAppWebview 避免 __webviewId__ 报错
- 配置域名与 manifest 应用名称;cache/store 防御性处理

Made-with: Cursor
This commit is contained in:
apple
2026-03-26 12:16:01 +08:00
parent c84aeda062
commit 8e17762510
742 changed files with 184117 additions and 0 deletions

View File

@@ -0,0 +1,335 @@
<template>
<view class="warp">
<view class="w-full fixed-lt z-20" :style="{ 'padding-top': sysHeight + 'px' }">
<view class="h-80 px-20 flex-between-center">
<text class="iconfont icon-ic_leftarrow fs-40 text--w111-000" @tap="pageBack"></text>
</view>
</view>
<view class="header-top relative">
<image :src="headerBg" mode=""></image>
<!-- <view class="rule-btn w-124 flex-center fs-24 text--w111-fff" :style="{ top: 100 + sysHeight + 'px' }" @tap="goRecord">申请记录</view> -->
</view>
<view class="bg-v-gradient pl-20 pr-20 pb-24 relative">
<view class="bg--w111-fff rd-24rpx content-box">
<view class="fs-30 fw-500 lh-42rpx">请填写以下信息</view>
<view class="cell flex-between-center mt-64">
<view class="fs-28 lh-40rpx">用户昵称</view>
<view class="fs-28 text-right">{{ form.nickname }}</view>
</view>
<view class="cell flex-between-center mt-64">
<view class="fs-28 lh-40rpx">用户ID</view>
<view class="fs-28 text-right">{{ form.uid }}</view>
</view>
<view class="cell flex-between-center mt-64">
<view class="fs-28 lh-40rpx">分销员姓名</view>
<input type="text" v-model="form.real_name" placeholder="请输入分销员姓名" placeholder-class="text--w111-ccc" class="fs-28 text-right" />
</view>
<view class="cell flex-between-center mt-64">
<view class="fs-28 lh-40rpx">手机号</view>
<input type="number" v-model="form.phone" placeholder="请输入手机号" placeholder-class="text--w111-ccc" class="fs-28 text-right" />
</view>
<view v-if="brokerageApplyPhoneVerify" class="cell flex-between-center mt-64">
<view class="fs-28 lh-40rpx">验证码</view>
<view class="flex-y-center">
<input type="number" v-model="form.code" placeholder="请输入验证码" placeholder-class="text--w111-ccc" class="fs-28 text-right" />
<button class="code-btn w-168 h-56 flex-center fs-24 ml-20" :disabled="disabled" @tap="code">{{ text }}</button>
</view>
</view>
<view class="cell mt-64">
<view class="fs-28 lh-40rpx">申请说明</view>
<view class="text--w111-ccc mt-12">
{{ brokerage_apply_explain }}
</view>
</view>
<view class="flex-y-center mt-100rpx mb-24">
<text class="iconfont fs-30" :class="isSelect ? 'icon-a-ic_CompleteSelect' : 'icon-ic_unselect'" @tap="proviceSelect"></text>
<text class="fs-24 text--w111-999 pl-12">已阅读并同意</text>
<text class="fs-24 font-red" @tap="getAgreement">分销说明</text>
</view>
<view class="w-full h-88 rd-44rpx flex-center text--w111-fff fs-28" :class="isSelectStar ? 'bg-red' : 'bg-disabled'" @tap="submitSupply">提交申请</view>
</view>
</view>
<Verify @success="success" :captchaType="captchaType" :imgSize="{ width: '330px', height: '155px' }" ref="verify"></Verify>
<tui-modal :show="showModal" maskClosable custom @cancel="hideModal">
<view class="tui-modal-custom">
<view class="fs-32 fw-500 lh-44rpx text-center">分销说明</view>
<view class="fs-28 text--w111-666 lh-44rpx mt-24 desc-box">
<!-- #ifdef MP-WEIXIN -->
<rich-text :nodes="supplierAgreement"></rich-text>
<!-- #endif -->
<!-- #ifdef H5 || APP-PLUS -->
<view v-html="supplierAgreement"></view>
<!-- #endif -->
</view>
<view class="w-full h-72 rd-36rpx flex-center bg-red fs-26 text--w111-fff mt-32" @tap="hideModal">知道了</view>
</view>
</tui-modal>
</view>
</template>
<script>
let sysHeight = uni.getWindowInfo().statusBarHeight;
import { toLogin } from '@/libs/login.js';
import { mapGetters } from 'vuex';
import { promoterCreateApi, getCodeApi, registerVerify, userPromoterInfo, getUserAgreement } from '@/api/user.js';
import colors from '@/mixins/color';
import sendVerifyCode from '@/mixins/SendVerifyCode';
import { HTTP_REQUEST_URL, CAPTCHA_TYPE } from '@/config/app';
import Verify from '../components/verify/verify.vue';
import tuiModal from '@/components/tui-modal/index.vue';
export default {
data() {
return {
captchaType: CAPTCHA_TYPE,
sysHeight: sysHeight,
form: {
nickname: '',
uid: '',
phone: '',
code: '',
real_name: ''
},
canvasWidth: '',
canvasHeight: '',
canvasStatus: false,
isSelect: false,
keyCode: '',
id: 0,
showModal: false,
supplierAgreement: '',
tagStyle: {
img: 'width:100%;display:block;'
},
brokerage_apply_explain: ''
};
},
components: {
Verify,
tuiModal
},
mixins: [sendVerifyCode, colors],
watch: {
isLogin: {
handler: function (newV, oldV) {
if (newV) {
// #ifndef MP
this.getOrderProduct();
// #endif
}
},
deep: true
}
},
computed: {
...mapGetters(['isLogin', 'brokerageApplyPhoneVerify']),
isSelectStar() {
if (this.form.nickname && this.form.uid && this.form.phone && this.form.real_name) {
if (this.brokerageApplyPhoneVerify && !this.form.code) {
return false;
}
return true;
}
},
headerBg() {
return HTTP_REQUEST_URL + '/statics/images/promoter_apply.png';
},
mainHeight() {
let { windowHeight } = uni.getWindowInfo();
return windowHeight - 90 - this.sysHeight;
}
},
onLoad(options) {
this.getInfo();
},
methods: {
code() {
if (!this.form.phone)
return this.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.form.phone))
return this.$util.Tips({
title: '请输入正确的手机号码'
});
this.$refs.verify.show();
},
success(data) {
this.$refs.verify.hide();
if (this.brokerageApplyPhoneVerify) {
getCodeApi()
.then((res) => {
this.keyCode = res.data.key;
this.getCode(data);
})
.catch((res) => {
this.$util.Tips({
title: res
});
});
} else {
this.promoterRequest();
}
},
async getCode(data) {
let that = this;
if (!this.form.phone)
return that.$util.Tips({
title: '请填写手机号码'
});
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(this.form.phone))
return this.$util.Tips({
title: '请输入正确的手机号码'
});
await registerVerify({
phone: that.form.phone,
type: 'agent',
key: that.keyCode,
captchaType: CAPTCHA_TYPE,
captchaVerification: data.captchaVerification
})
.then((res) => {
that.$util.Tips({
title: res.msg
});
that.sendCode();
})
.catch((res) => {
this.$refs.verify.refresh();
that.$util.Tips({
title: res
});
});
},
proviceSelect() {
this.isSelect = !this.isSelect;
},
getInfo() {
userPromoterInfo()
.then((res) => {
let data = res.data.user;
this.id = data.id || 0;
this.form.nickname = data.nickname || '';
this.form.uid = data.uid || '';
this.form.phone = data.phone || '';
this.form.real_name = data.real_name || '';
this.supplierAgreement = res.data.agreement.content;
this.brokerage_apply_explain = this.$store.state.app.brokerage_apply_explain;
})
.catch((err) => {
return this.$util.Tips({
title: err
});
});
},
submitSupply() {
if (!this.isSelectStar)
return this.$util.Tips({
title: '请完整填写表单信息'
});
if (!this.isSelect)
return this.$util.Tips({
title: '请阅读并同意协议'
});
if (this.brokerageApplyPhoneVerify) {
this.promoterRequest();
} else {
this.code();
}
},
promoterRequest() {
promoterCreateApi(this.id, this.form)
.then((res) => {
uni.navigateTo({
url: '/pages/users/agent/state?type=promoter&id=' + res.data.id
});
})
.catch((err) => {
return this.$util.Tips({
title: err
});
});
},
pageBack() {
uni.reLaunch({
url: '/pages/user/index'
});
},
goRecord() {
uni.navigateTo({
url: '/pages/users/agent/record'
});
},
getAgreement() {
this.showModal = true;
},
hideModal() {
this.showModal = false;
}
}
};
</script>
<style lang="scss" scoped>
.warp {
background: #ffe5d5;
min-height: 100vh;
.bg-v-gradient {
margin-top: -150rpx;
z-index: 11;
}
}
.header-top {
width: 100%;
height: 552rpx;
image {
width: 100%;
height: 100%;
}
}
.rule-btn {
height: 48rpx;
background: rgba(0, 0, 0, 0.15);
border-radius: 24rpx 0 0 24rpx;
position: absolute;
right: 0;
}
.content-box {
padding: 48rpx 32rpx 40rpx;
}
.code-btn {
border: 1px solid #e93323;
color: #e93323;
border-radius: 28rpx;
}
.upload {
border: 1rpx dashed #ccc;
}
.del-pic {
background-color: #999;
border-radius: 0 16rpx 0 16rpx;
}
.icon-a-ic_CompleteSelect,
.font-red {
color: #e93323;
}
.icon-ic_unselect {
color: #ccc;
}
.bg-red {
background-color: #e93323;
}
.bg-disabled {
background-color: rgba(233, 51, 35, 0.5);
}
.desc-box {
max-height: 700rpx;
overflow-y: auto;
}
.modal-bottom {
height: 136rpx;
border-radius: 0 0 32rpx 32rpx;
background-color: #fff;
}
</style>

View File

@@ -0,0 +1,215 @@
<template>
<view>
<NavBar textSize="34rpx" :isScrolling="isScrolling" iconColor="#333333" textColor="#333333" :showEmpty="false" showBack></NavBar>
<view class="w-full cover relative" :style="[topCardStyle]">
<text class="full-text fs-26 fw-500">商城消费满{{brokeragePrice}}即可成为分销员</text>
</view>
<view class="w-full cover content-box" :style="[contentBg]">
<view class="cover fuli-card relative px-24" :style="[fuliBg]">
<view class="desc flex-y-center text--w111-fff fs-24 lh-40rpx" @tap="lookInfo">
<text class="iconfont icon-icon_tip fs-24"></text>
<text class="pl-8">分销说明</text>
</view>
<view class="grid-column-4 grid-gap-30rpx">
<view class="w-full h-180 rd-16rpx grid-item flex-col flex-center"
v-for="(item,index) in menus" :key="index">
<view class="w-80 h-80 rd-24rpx bg--w111-fff flex-center">
<image :src="item.pic" class="w-58 h-58"></image>
</view>
<text class="pt-24 fs-24 fw-500 lh-36rpx">{{item.label}}</text>
</view>
</view>
</view>
<view class="relative man-card rd-32rpx bg--w111-fff">
<view class="w-full cover h-152 flex-x-center pt-42" :style="[colorBox]">
<image class="text-pic" :src="imgHost + '/statics/images/promoter/promoter_text.png'" mode="aspectFill"></image>
</view>
<view class="w-full relative px-24 pro-box">
<view class="w-full grid-column-3 grid-gap-24rpx" v-if="hostProduct.length">
<view class="w-full" v-for="item in hostProduct" :key="item.id"
@tap="goDetail(item)">
<easy-loadimage
:image-src="item.image"
width="100%"
height="202rpx"
borderRadius="16rpx"></easy-loadimage>
<view class="w-200 line1 mt-16 mb-10">{{item.store_name}}</view>
<BaseMoney :money="item.price" symbolSize="20" integerSize="36" decimalSize="24" color="#e93323"></BaseMoney>
</view>
</view>
<view v-else>
<emptyPage title="暂无数据哦~"></emptyPage>
</view>
</view>
</view>
<view class="h-200"></view>
</view>
<view class="pb-safe w-full fixed-lb flex-center">
<view class="home-btn cover flex-center text--w111-fff fs-28 fw-500" :style="[btnBgStyle]"
@tap="goHomePage">
<text>进入商城挑选更多商品</text>
<text class="iconfont icon-ic_rightarrow"></text>
</view>
</view>
</view>
</template>
<script>
import { getProductHot } from '@/api/store.js';
import {HTTP_REQUEST_URL} from '@/config/app';
import { mapGetters } from 'vuex';
import { goShopDetail } from '@/libs/order.js'
import NavBar from "@/components/NavBar.vue";
import home from '@/components/home/index.vue';
import emptyPage from '@/components/emptyPage.vue'
let sysHeight = uni.getWindowInfo().statusBarHeight;
export default {
data(){
return {
imgHost: HTTP_REQUEST_URL,
isScrolling: false,
menus:[
{label: '零成本', pic: HTTP_REQUEST_URL + '/statics/images/promoter/promoter_group3.png'},
{label: '高佣金', pic: HTTP_REQUEST_URL + '/statics/images/promoter/promoter_group6.png'},
{label: '持续收入', pic: HTTP_REQUEST_URL + '/statics/images/promoter/promoter_group1.png'},
{label: '佣金提现', pic: HTTP_REQUEST_URL + '/statics/images/promoter/promoter_group2.png'},
],
hotPage:1,
hotLimit:10,
hotScroll: false,
hostProduct: []
}
},
components: { home, NavBar, emptyPage },
computed:{
...mapGetters(['isLogin']),
brokeragePrice(){
return this.$store.state.app.store_brokerage_price
},
topCardStyle(){
return {
height: '646rpx',
backgroundImage: 'url('+this.imgHost+'/statics/images/promoter/promoter_group5.png'+')'
}
},
contentBg(){
return {
height: '1474rpx',
backgroundImage: 'url('+this.imgHost+'/statics/images/promoter/promoter_group4.png'+')'
}
},
fuliBg(){
return {
backgroundImage: 'url('+this.imgHost+'/statics/images/promoter/promoter_card.png'+')'
}
},
colorBox(){
return {
backgroundImage: 'url('+this.imgHost+'/statics/images/promoter/promoter_color1.png'+')'
}
},
btnBgStyle(){
return {
backgroundImage: 'url('+this.imgHost+'/statics/images/promoter/promoter_button.png'+')'
}
}
},
onPageScroll(option) {
uni.$emit('scroll');
if (option.scrollTop > 50) {
this.isScrolling = true;
} else if (option.scrollTop < 50) {
this.isScrolling = false;
}
},
onLoad() {
this.getRecommendList();
},
methods:{
getRecommendList(){
let that = this;
if (that.hotScroll) return
getProductHot(
that.hotPage,
that.hotLimit,
).then(res => {
that.hotPage++
that.hotScroll = res.data.length < that.hotLimit
that.hostProduct = that.hostProduct.concat(res.data)
});
},
goDetail(item){
goShopDetail(item, this.uid).catch(res => {
uni.navigateTo({
url: `/pages/goods_details/index?id=${item.id}`
});
});
},
lookInfo(){
uni.navigateTo({
url: '/pages/users/user_distribution_info/index'
})
},
goHomePage(){
uni.switchTab({
url: '/pages/goods_cate/goods_cate'
})
}
},
onReachBottom() {
this.getRecommendList();
}
}
</script>
<style>
page{
background: #FBE7D8;
}
</style>
<style scoped lang="scss">
.cover{
background-size: cover;
}
.full-text{
position: absolute;
bottom: 220rpx;
left: 44rpx;
color: #FF6270;
}
.content-box{
position: relative;
margin-top: -204rpx;
padding-top: 78rpx;
}
.fuli-card{
width: 702rpx;
height: 316rpx;
margin: auto;
padding-top: 105rpx;
.desc{
position: absolute;
top: 24rpx;
right: 40rpx;
}
}
.man-card{
width: 702rpx;
margin: 20rpx auto;
}
.text-pic{
width: 256rpx;
height: 40rpx;
}
.grid-item{
background: #FFF6EF;
border: 2rpx solid #FFF2DE;
color: #6A251F;
}
.pro-box{
top: -38rpx;
}
.home-btn{
width: 480rpx;
height: 80rpx;
margin-bottom: 24rpx;
}
</style>