feat(M08-D): 补加盟申请与跟进运营
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const { request, clientRequestId } = require('../../utils/api.js')
|
||||
|
||||
Page({
|
||||
data: {
|
||||
form: { city: '', contactName: '', contactPhone: '', message: '' },
|
||||
clientRequestId: '', applicationNo: '', submitting: false, errorMessage: '',
|
||||
},
|
||||
onLoad() { this.setData({ clientRequestId: clientRequestId('franchise') }) },
|
||||
onInput(event) { const field = event.currentTarget.dataset.field; this.setData({ [`form.${field}`]: event.detail.value }) },
|
||||
async submit() {
|
||||
const form = this.data.form
|
||||
if (!form.city.trim() || !form.contactName.trim() || !/^\+?[0-9 -]{6,20}$/.test(form.contactPhone.trim())) {
|
||||
this.setData({ errorMessage: '请填写意向城市、联系人和有效联系电话' }); return
|
||||
}
|
||||
this.setData({ submitting: true, errorMessage: '' })
|
||||
try {
|
||||
const response = await request('/franchise-applications', { method: 'POST', data: {
|
||||
city: form.city.trim(), contactName: form.contactName.trim(),
|
||||
contactPhone: form.contactPhone.trim(), message: form.message.trim(),
|
||||
clientRequestId: this.data.clientRequestId,
|
||||
} })
|
||||
this.setData({ applicationNo: response.data.applicationNo })
|
||||
} catch (error) { this.setData({ errorMessage: error.message || '申请提交失败,请稍后重试' }) }
|
||||
finally { this.setData({ submitting: false }) }
|
||||
},
|
||||
backHome() { wx.reLaunch({ url: '/pages/index/index' }) },
|
||||
})
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"navigationBarTitleText": "加盟合作"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<scroll-view class="page" scroll-y>
|
||||
<view class="container">
|
||||
<view class="hero"><view class="title">加盟合作</view><view class="subtitle">留下您的开店计划,品牌运营人员会尽快与您联系。</view></view>
|
||||
<view wx:if="{{applicationNo}}" class="success"><view class="success-title">申请已提交</view><view>申请编号:{{applicationNo}}</view><view class="muted">重复点击不会产生重复申请。</view><button type="primary" bindtap="backHome">返回首页</button></view>
|
||||
<view wx:else class="form-card">
|
||||
<view class="label">意向城市</view><input data-field="city" value="{{form.city}}" maxlength="64" placeholder="例如:上海市" bindinput="onInput" />
|
||||
<view class="label">联系人</view><input data-field="contactName" value="{{form.contactName}}" maxlength="64" placeholder="请输入联系人姓名" bindinput="onInput" />
|
||||
<view class="label">联系电话</view><input data-field="contactPhone" value="{{form.contactPhone}}" type="number" maxlength="20" placeholder="请输入手机号" bindinput="onInput" />
|
||||
<view class="label">开店计划或留言</view><textarea data-field="message" value="{{form.message}}" maxlength="1000" placeholder="可填写预计开店时间、区域、预算等" bindinput="onInput" />
|
||||
<view wx:if="{{errorMessage}}" class="error">{{errorMessage}}</view>
|
||||
<button type="primary" loading="{{submitting}}" disabled="{{submitting}}" bindtap="submit">提交申请</button>
|
||||
<view class="privacy">提交即表示同意运营人员仅将以上信息用于加盟联系与跟进。</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -0,0 +1,13 @@
|
||||
.page { height: 100vh; background: #f5f6f8; }
|
||||
.container { padding: 32rpx; }
|
||||
.hero { padding: 28rpx 8rpx; }
|
||||
.title { font-size: 44rpx; font-weight: 700; }
|
||||
.subtitle, .muted, .privacy { margin-top: 12rpx; color: #667085; line-height: 1.6; }
|
||||
.form-card, .success { padding: 32rpx; border-radius: 20rpx; background: #fff; }
|
||||
.label { margin: 24rpx 0 12rpx; font-weight: 600; }
|
||||
input, textarea { box-sizing: border-box; width: 100%; padding: 20rpx 22rpx; border: 1rpx solid #d7dbe0; border-radius: 12rpx; background: #fff; }
|
||||
textarea { height: 220rpx; }
|
||||
button { margin-top: 32rpx; }
|
||||
.success-title { margin-bottom: 16rpx; color: #17823b; font-size: 36rpx; font-weight: 700; }
|
||||
.error { margin-top: 20rpx; color: #c73535; }
|
||||
.privacy { font-size: 24rpx; text-align: center; }
|
||||
@@ -96,6 +96,10 @@ Page({
|
||||
wx.navigateTo({ url: '/pages/profile/index' })
|
||||
},
|
||||
|
||||
openFranchise() {
|
||||
wx.navigateTo({ url: '/pages/franchise/apply' })
|
||||
},
|
||||
|
||||
openManager() {
|
||||
wx.navigateTo({ url: '/pages/manager/dashboard' })
|
||||
},
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<view class="quick-actions">
|
||||
<button bindtap="openOrders">我的订单</button>
|
||||
<button bindtap="openProfile">个人中心</button>
|
||||
<button bindtap="openFranchise">加盟合作</button>
|
||||
<button wx:if="{{showManagerEntry}}" type="primary" bindtap="openManager">门店管理</button>
|
||||
<button wx:if="{{showCleanerEntry}}" bindtap="openCleaner">保洁任务</button>
|
||||
</view>
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
|
||||
.quick-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.quick-actions button {
|
||||
flex: 1;
|
||||
flex: 1 1 30%;
|
||||
}
|
||||
|
||||
.city-search {
|
||||
|
||||
Reference in New Issue
Block a user