# 店铺
一、用户申请开店流程
个人、企业申请入驻:实名认证->Paycenter认证通过->申请入驻->平台审核通过
自营店铺:平台后台添加自营店铺
1.申请商家入驻
**实名认证:**
控制器:paycenter/controllers/InfoCtl.php -> certification();
视图:paycenter/views/default/InfoCtl/certification.php
```
<pre class="calibre14">```
<span class="token5">//认证表单提交</span>
$<span class="token1">(</span><span class="token4">'#form'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
<span class="token5">//验证</span>
<span class="token1">.</span><span class="token1">.</span><span class="token1">.</span><span class="token1">.</span><span class="token1">.</span><span class="token1">.</span>
<span class="token1">}</span><span class="token1">,</span>
fields <span class="token1">:</span> <span class="token1">{</span>
<span class="token4">'user_realname'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'user_identity_card'</span><span class="token1">:</span><span class="token4">'required;identity_type'</span><span class="token1">,</span>
<span class="token4">'user_identity_start_time'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'user_identity_end_time'</span><span class="token1">:</span><span class="token4">'times;'</span><span class="token1">,</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">success</span><span class="token1">(</span><span class="token4">"<?=_('操作成功')?>"</span><span class="token1">)</span><span class="token1">;</span>
var from <span class="token">=</span> $<span class="token1">(</span><span class="token4">'#page_from'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span><span class="token1">(</span>from <span class="token">==</span> <span class="token4">'bt'</span><span class="token1">)</span><span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span> <span class="token4">"<?= Yf_Registry::get('url');?>?ctl=Info&met=btinfo"</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span> <span class="token4">"<?= Yf_Registry::get('url');?>?ctl=Info&met=account"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span><span class="token3">typeof</span><span class="token1">(</span>a<span class="token1">.</span>msg<span class="token1">)</span> <span class="token">!=</span> <span class="token4">'undefined'</span><span class="token1">)</span><span class="token1">{</span>
Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span>a<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span><span class="token4">"<?=_('操作失败')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">return</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:editCertification()
```
<pre class="calibre14">```
$User_InfoModel <span class="token">=</span> <span class="token2">new</span> <span class="token3">User_InfoModel</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
$flag <span class="token">=</span> $User_InfoModel<span class="token">-</span><span class="token">></span><span class="token3">editInfo</span><span class="token1">(</span>$user_id<span class="token1">,</span>$edit<span class="token1">)</span><span class="token1">;</span>
```
```
**实名认证以后,需要在平台Paycenter后台认证审核:**
控制器:paycenter\_admin/admin/controllers/paycen/PayInfoCtl.php
视图:paycenter\_admin/admin/views/default/paycen/PayInfoCtl/index.php
(1)个人申请商家入驻(URL参数:apply=1)
控制器:shop/controllers/Seller/Shop/SettledCtl.php -> index();
模型:shop/models/Shop/BaseModel.php、shop/models/Shop/CompanyModel.php
- 签订入驻协议:shop/views/default/Seller/Shop/SettledCtl/step1.php(视图)
- 个人实名信息:shop/views/default/Seller/Shop/SettledCtl/step2.php(视图)
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form_company_info'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
<span class="token5">//验证、ajax</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
tel<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token">^</span><span class="token1">[</span><span class="token6">1</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token">-</span><span class="token6">9</span><span class="token1">]</span><span class="token1">{</span><span class="token6">10</span><span class="token1">}</span>$<span class="token">/</span><span class="token1">,</span><span class="token4">'<?=__('</span>请输入正确的手机号码<span class="token4">')?>'</span><span class="token1">]</span><span class="token1">,</span>
zjtel<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token1">(</span><span class="token">^</span><span class="token6">0</span>\d<span class="token1">{</span><span class="token6">2</span><span class="token1">,</span><span class="token6">3</span><span class="token1">}</span><span class="token1">[</span><span class="token">-</span><span class="token1">]</span><span class="token">?</span>\d<span class="token1">{</span><span class="token6">5</span><span class="token1">,</span><span class="token6">9</span><span class="token1">}</span>$<span class="token1">)</span><span class="token">|</span><span class="token1">(</span><span class="token">^</span><span class="token1">[</span><span class="token6">1</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token">-</span><span class="token6">9</span><span class="token1">]</span><span class="token1">{</span><span class="token6">10</span><span class="token1">}</span>$<span class="token1">)</span><span class="token">/</span><span class="token1">,</span><span class="token4">'<?=__('</span>请输入正确的电话号码<span class="token4">')?>'</span><span class="token1">]</span><span class="token1">,</span>
daima<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token">^</span><span class="token1">[</span>a<span class="token">-</span>zA<span class="token">-</span>Z0<span class="token">-</span><span class="token6">9</span><span class="token1">]</span><span class="token1">{</span><span class="token6">8</span><span class="token1">}</span><span class="token">-</span><span class="token1">[</span>a<span class="token">-</span>zA<span class="token">-</span>Z0<span class="token">-</span><span class="token6">9</span><span class="token1">]</span>$<span class="token">/</span><span class="token1">,</span><span class="token4">'<?=__('</span>请输入正确的组织机构代码<span class="token4">')?>'</span><span class="token1">]</span><span class="token1">,</span>
times<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>element<span class="token1">,</span> params<span class="token1">)</span><span class="token1">{</span>
var start_time <span class="token">=</span> $<span class="token1">(</span><span class="token4">'#start_time'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
var end_time <span class="token">=</span> $<span class="token1">(</span><span class="token4">'#end_time'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span><span class="token1">(</span>start_time<span class="token">></span>end_time <span class="token">&&</span> end_time<span class="token1">)</span><span class="token1">{</span>
<span class="token2">return</span> <span class="token4">'<?=__('</span>不能小于起始时间<span class="token4">')?>'</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token5">//验证规则</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span><span class="token4">"./index.php?ctl=Seller_Shop_Settled&met=index&op=step3"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span><span class="token3">typeof</span><span class="token1">(</span>a<span class="token1">.</span>msg<span class="token1">)</span> <span class="token">==</span> <span class="token4">'undefined'</span> <span class="token">||</span> <span class="token">!</span>a<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">{</span>
Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span><span class="token4">"<?=__('操作失败')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span>a<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">return</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span>
$<span class="token1">(</span><span class="token4">'#btn_apply_company_next'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:addShopCompany()
```
<pre class="calibre14">```
<span class="token2">if</span> <span class="token1">(</span><span class="token">!</span>$shop_info<span class="token1">)</span><span class="token1">{</span>
$flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopCompanyModel<span class="token">-</span><span class="token">></span><span class="token3">addCompany</span><span class="token1">(</span>$shop_company<span class="token1">,</span> TRUE<span class="token1">)</span><span class="token1">;</span>
$shop_base<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> $flag<span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">addBase</span><span class="token1">(</span>$shop_base<span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span> <span class="token1">(</span>$flag1 <span class="token">&&</span> $flag <span class="token">&&</span> $this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">commitDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">)</span>
<span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">200</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'success'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
$this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">rollBackDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
$status <span class="token">=</span> <span class="token6">250</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'failure1'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
<span class="token5">//编辑</span>
$flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopCompanyModel<span class="token">-</span><span class="token">></span><span class="token3">editCompany</span><span class="token1">(</span>$shop_info<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span><span class="token1">,</span> $shop_company<span class="token1">)</span><span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">editBase</span><span class="token1">(</span>$shop_info<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span><span class="token1">,</span> $shop_base<span class="token1">)</span><span class="token1">;</span>
$rs_rows <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token3">check_rs</span><span class="token1">(</span>$flag<span class="token1">,</span> $rs_rows<span class="token1">)</span><span class="token1">;</span>
<span class="token3">check_rs</span><span class="token1">(</span>$flag1<span class="token1">,</span> $rs_rows<span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span> <span class="token1">(</span><span class="token3">is_ok</span><span class="token1">(</span>$rs_rows<span class="token1">)</span> <span class="token">&&</span> $this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">commitDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">200</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'success'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">rollBackDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
$status <span class="token">=</span> <span class="token6">250</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'failure2'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
```
```
- 财务资质信息:shop/views/default/Seller/Shop/SettledCtl/step3.php(视图)
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form_company_info'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
yh<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token">^</span><span class="token1">(</span>\d<span class="token1">{</span><span class="token6">16</span><span class="token1">}</span><span class="token">|</span>\d<span class="token1">{</span><span class="token6">19</span><span class="token1">}</span><span class="token1">)</span>$<span class="token">/</span><span class="token1">,</span><span class="token4">"<?=__('请填写正确的银行账号')?>"</span><span class="token1">]</span><span class="token1">,</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token5">//验证规则</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span><span class="token4">"./index.php?ctl=Seller_Shop_Settled&met=index&op=step4&apply=<?=$apply?>"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token3">alert</span><span class="token1">(</span><span class="token4">"<?=__('操作失败!')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
$<span class="token1">(</span><span class="token4">'#btn_apply_company_next'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:editShopCompany()
```
<pre class="calibre14">```
$flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopCompanyModel<span class="token">-</span><span class="token">></span><span class="token3">editCompany</span><span class="token1">(</span>$shop_id<span class="token1">,</span> $shop_company<span class="token1">)</span><span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">editBase</span><span class="token1">(</span>$shop_id<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_status'</span><span class="token">=</span><span class="token">></span><span class="token6">9</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span>
```
```
- 店铺经营信息:shop/views/default/Seller/Shop/SettledCtl/step4.php(视图)
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form_company_info'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token4">'shop_name'</span><span class="token1">:</span> <span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'shop_grade_id'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'joinin_year'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'shop_class_id'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'shop_class_bind_id'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span><span class="token4">"./index.php?ctl=Seller_Shop_Settled&met=index&op=step5&apply=<?=$apply?>"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token3">alert</span><span class="token1">(</span><span class="token4">"<?=__('操作失败!')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
$<span class="token1">(</span><span class="token4">'#btn_apply_company_next'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:editShopBase()
```
<pre class="calibre14">```
$shopClassBind <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopClassBindModel<span class="token">-</span><span class="token">></span><span class="token3">listByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span><span class="token">=</span><span class="token">></span>$shop_id<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span><span class="token1">(</span>$shopClassBind<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">{</span>
$calss_id <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
foreach <span class="token1">(</span>$shopClassBind<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span> as $val<span class="token1">)</span><span class="token1">{</span>
$calss_id<span class="token1">[</span><span class="token1">]</span> <span class="token">=</span> $val<span class="token1">[</span><span class="token4">'shop_class_bind_id'</span><span class="token1">]</span><span class="token1">;</span>
<span class="token1">}</span>
$this<span class="token">-</span><span class="token">></span>shopClassBindModel<span class="token">-</span><span class="token">></span><span class="token3">removeClassBind</span><span class="token1">(</span>$calss_id<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
foreach <span class="token1">(</span>$product_class_id as $key <span class="token">=</span><span class="token">></span> $value<span class="token1">)</span>
<span class="token1">{</span>
$shop_class<span class="token1">[</span><span class="token4">'product_class_id'</span><span class="token1">]</span> <span class="token">=</span> $value<span class="token1">;</span>
$shop_class<span class="token1">[</span><span class="token4">'commission_rate'</span><span class="token1">]</span> <span class="token">=</span> $commission_rate<span class="token1">[</span>$key<span class="token1">]</span><span class="token1">;</span>
$shop_class<span class="token1">[</span><span class="token4">'shop_class_bind_enable'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">2</span><span class="token1">;</span>
$shop_class<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> $shop_id<span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopClassBindModel<span class="token">-</span><span class="token">></span><span class="token3">addClassBind</span><span class="token1">(</span>$shop_class<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
```
```
(2)企业申请商家入驻(URL参数:apply=2)
控制器:shop/controllers/Seller/Shop/SettledCtl.php -> index();
模型:shop/models/Shop/BaseModel.php、shop/models/Shop/CompanyModel.php
- 签订入驻协议:shop/views/default/Seller/Shop/SettledCtl/step1.php(视图)
- 公司资质信息:shop/views/default/Seller/Shop/SettledCtl/step2.php(视图)
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form_company_info'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
<span class="token5">//验证、ajax</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
tel<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token">^</span><span class="token1">[</span><span class="token6">1</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token">-</span><span class="token6">9</span><span class="token1">]</span><span class="token1">{</span><span class="token6">10</span><span class="token1">}</span>$<span class="token">/</span><span class="token1">,</span><span class="token4">'<?=__('</span>请输入正确的手机号码<span class="token4">')?>'</span><span class="token1">]</span><span class="token1">,</span>
zjtel<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token1">(</span><span class="token">^</span><span class="token6">0</span>\d<span class="token1">{</span><span class="token6">2</span><span class="token1">,</span><span class="token6">3</span><span class="token1">}</span><span class="token1">[</span><span class="token">-</span><span class="token1">]</span><span class="token">?</span>\d<span class="token1">{</span><span class="token6">5</span><span class="token1">,</span><span class="token6">9</span><span class="token1">}</span>$<span class="token1">)</span><span class="token">|</span><span class="token1">(</span><span class="token">^</span><span class="token1">[</span><span class="token6">1</span><span class="token1">]</span><span class="token1">[</span><span class="token6">0</span><span class="token">-</span><span class="token6">9</span><span class="token1">]</span><span class="token1">{</span><span class="token6">10</span><span class="token1">}</span>$<span class="token1">)</span><span class="token">/</span><span class="token1">,</span><span class="token4">'<?=__('</span>请输入正确的电话号码<span class="token4">')?>'</span><span class="token1">]</span><span class="token1">,</span>
daima<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token">^</span><span class="token1">[</span>a<span class="token">-</span>zA<span class="token">-</span>Z0<span class="token">-</span><span class="token6">9</span><span class="token1">]</span><span class="token1">{</span><span class="token6">8</span><span class="token1">}</span><span class="token">-</span><span class="token1">[</span>a<span class="token">-</span>zA<span class="token">-</span>Z0<span class="token">-</span><span class="token6">9</span><span class="token1">]</span>$<span class="token">/</span><span class="token1">,</span><span class="token4">'<?=__('</span>请输入正确的组织机构代码<span class="token4">')?>'</span><span class="token1">]</span><span class="token1">,</span>
times<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>element<span class="token1">,</span> params<span class="token1">)</span><span class="token1">{</span>
var start_time <span class="token">=</span> $<span class="token1">(</span><span class="token4">'#start_time'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
var end_time <span class="token">=</span> $<span class="token1">(</span><span class="token4">'#end_time'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">val</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span><span class="token1">(</span>start_time<span class="token">></span>end_time <span class="token">&&</span> end_time<span class="token1">)</span><span class="token1">{</span>
<span class="token2">return</span> <span class="token4">'<?=__('</span>不能小于起始时间<span class="token4">')?>'</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token5">//验证规则</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span><span class="token4">"./index.php?ctl=Seller_Shop_Settled&met=index&op=step3"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span><span class="token3">typeof</span><span class="token1">(</span>a<span class="token1">.</span>msg<span class="token1">)</span> <span class="token">==</span> <span class="token4">'undefined'</span> <span class="token">||</span> <span class="token">!</span>a<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">{</span>
Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span><span class="token4">"<?=__('操作失败')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
Public<span class="token1">.</span>tips<span class="token1">.</span><span class="token3">error</span><span class="token1">(</span>a<span class="token1">.</span>msg<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">return</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span>
$<span class="token1">(</span><span class="token4">'#btn_apply_company_next'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:addShopCompany()
```
<pre class="calibre14">```
<span class="token2">if</span> <span class="token1">(</span><span class="token">!</span>$shop_info<span class="token1">)</span><span class="token1">{</span>
$flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopCompanyModel<span class="token">-</span><span class="token">></span><span class="token3">addCompany</span><span class="token1">(</span>$shop_company<span class="token1">,</span> TRUE<span class="token1">)</span><span class="token1">;</span>
$shop_base<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> $flag<span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">addBase</span><span class="token1">(</span>$shop_base<span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span> <span class="token1">(</span>$flag1 <span class="token">&&</span> $flag <span class="token">&&</span> $this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">commitDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">)</span>
<span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">200</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'success'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
$this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">rollBackDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
$status <span class="token">=</span> <span class="token6">250</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'failure1'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
<span class="token5">//编辑</span>
$flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopCompanyModel<span class="token">-</span><span class="token">></span><span class="token3">editCompany</span><span class="token1">(</span>$shop_info<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span><span class="token1">,</span> $shop_company<span class="token1">)</span><span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">editBase</span><span class="token1">(</span>$shop_info<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span><span class="token1">,</span> $shop_base<span class="token1">)</span><span class="token1">;</span>
$rs_rows <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token3">check_rs</span><span class="token1">(</span>$flag<span class="token1">,</span> $rs_rows<span class="token1">)</span><span class="token1">;</span>
<span class="token3">check_rs</span><span class="token1">(</span>$flag1<span class="token1">,</span> $rs_rows<span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span> <span class="token1">(</span><span class="token3">is_ok</span><span class="token1">(</span>$rs_rows<span class="token1">)</span> <span class="token">&&</span> $this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">commitDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">200</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'success'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$this<span class="token">-</span><span class="token">></span>messageModel<span class="token">-</span><span class="token">></span>sql<span class="token">-</span><span class="token">></span><span class="token3">rollBackDb</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
$status <span class="token">=</span> <span class="token6">250</span><span class="token1">;</span>
$msg <span class="token">=</span> <span class="token3">__</span><span class="token1">(</span><span class="token4">'failure2'</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
```
```
- 财务资质信息:shop/views/default/Seller/Shop/SettledCtl/step3.php(视图)
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form_company_info'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
yh<span class="token1">:</span><span class="token1">[</span><span class="token">/</span><span class="token">^</span><span class="token1">(</span>\d<span class="token1">{</span><span class="token6">16</span><span class="token1">}</span><span class="token">|</span>\d<span class="token1">{</span><span class="token6">19</span><span class="token1">}</span><span class="token1">)</span>$<span class="token">/</span><span class="token1">,</span><span class="token4">"<?=__('请填写正确的银行账号')?>"</span><span class="token1">]</span><span class="token1">,</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token5">//验证规则</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span><span class="token4">"./index.php?ctl=Seller_Shop_Settled&met=index&op=step4&apply=<?=$apply?>"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token3">alert</span><span class="token1">(</span><span class="token4">"<?=__('操作失败!')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
$<span class="token1">(</span><span class="token4">'#btn_apply_company_next'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:editShopCompany()
```
<pre class="calibre14">```
$flag <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopCompanyModel<span class="token">-</span><span class="token">></span><span class="token3">editCompany</span><span class="token1">(</span>$shop_id<span class="token1">,</span> $shop_company<span class="token1">)</span><span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopBaseModel<span class="token">-</span><span class="token">></span><span class="token3">editBase</span><span class="token1">(</span>$shop_id<span class="token1">,</span> <span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_status'</span><span class="token">=</span><span class="token">></span><span class="token6">9</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span>
```
```
- 店铺经营信息:shop/views/default/Seller/Shop/SettledCtl/step4.php(视图)
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form_company_info'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token4">'shop_name'</span><span class="token1">:</span> <span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'shop_grade_id'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'joinin_year'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'shop_class_id'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'shop_class_bind_id'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span><span class="token4">"./index.php?ctl=Seller_Shop_Settled&met=index&op=step5&apply=<?=$apply?>"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token3">alert</span><span class="token1">(</span><span class="token4">"<?=__('操作失败!')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
$<span class="token1">(</span><span class="token4">'#btn_apply_company_next'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
$<span class="token1">(</span><span class="token4">"#form_company_info"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:editShopBase()
```
<pre class="calibre14">```
$shopClassBind <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopClassBindModel<span class="token">-</span><span class="token">></span><span class="token3">listByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span><span class="token">=</span><span class="token">></span>$shop_id<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span><span class="token1">(</span>$shopClassBind<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">{</span>
$calss_id <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
foreach <span class="token1">(</span>$shopClassBind<span class="token1">[</span><span class="token4">'items'</span><span class="token1">]</span> as $val<span class="token1">)</span><span class="token1">{</span>
$calss_id<span class="token1">[</span><span class="token1">]</span> <span class="token">=</span> $val<span class="token1">[</span><span class="token4">'shop_class_bind_id'</span><span class="token1">]</span><span class="token1">;</span>
<span class="token1">}</span>
$this<span class="token">-</span><span class="token">></span>shopClassBindModel<span class="token">-</span><span class="token">></span><span class="token3">removeClassBind</span><span class="token1">(</span>$calss_id<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
foreach <span class="token1">(</span>$product_class_id as $key <span class="token">=</span><span class="token">></span> $value<span class="token1">)</span>
<span class="token1">{</span>
$shop_class<span class="token1">[</span><span class="token4">'product_class_id'</span><span class="token1">]</span> <span class="token">=</span> $value<span class="token1">;</span>
$shop_class<span class="token1">[</span><span class="token4">'commission_rate'</span><span class="token1">]</span> <span class="token">=</span> $commission_rate<span class="token1">[</span>$key<span class="token1">]</span><span class="token1">;</span>
$shop_class<span class="token1">[</span><span class="token4">'shop_class_bind_enable'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">2</span><span class="token1">;</span>
$shop_class<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> $shop_id<span class="token1">;</span>
$flag1 <span class="token">=</span> $this<span class="token">-</span><span class="token">></span>shopClassBindModel<span class="token">-</span><span class="token">></span><span class="token3">addClassBind</span><span class="token1">(</span>$shop_class<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
```
```
**提交申请,平台审核**
平台审核控制器:shop/controllers/Api/Shop/ManageCtl.php
平台审核视图:shop\_admin/views/default/Shop/ManageCtl/getShoplist.php
JS:shop\_admin/static/default/js/controllers/shop/join/shop\_join\_list.js
**签订合同**
控制器:shop/controllers/Seller/Shop/SettledCtl.php
签订合同及缴费:shop/views/default/Seller/Shop/SettledCtl/step5.php(视图)
```
<pre class="calibre14">```
$<span class="token1">(</span><span class="token4">'#form'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">validator</span><span class="token1">(</span><span class="token1">{</span>
ignore<span class="token1">:</span> <span class="token4">':hidden'</span><span class="token1">,</span>
theme<span class="token1">:</span> <span class="token4">'yellow_right'</span><span class="token1">,</span>
timely<span class="token1">:</span> <span class="token6">1</span><span class="token1">,</span>
stopOnError<span class="token1">:</span> <span class="token6">false</span><span class="token1">,</span>
rules<span class="token1">:</span> <span class="token1">{</span>
<span class="token1">}</span><span class="token1">,</span>
fields<span class="token1">:</span> <span class="token1">{</span>
<span class="token4">'payment_voucher'</span><span class="token1">:</span> <span class="token4">'required;'</span><span class="token1">,</span>
<span class="token4">'payment_voucher_explain'</span><span class="token1">:</span><span class="token4">'required;'</span><span class="token1">,</span>
<span class="token1">}</span><span class="token1">,</span>
valid<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>form<span class="token1">)</span><span class="token1">{</span>
<span class="token5">//表单验证通过,提交表单</span>
$<span class="token1">.</span><span class="token3">ajax</span><span class="token1">(</span><span class="token1">{</span>
url<span class="token1">:</span> ajax_url<span class="token1">,</span>
data<span class="token1">:</span>$<span class="token1">(</span><span class="token4">"#form"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">serialize</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>
success<span class="token1">:</span><span class="token2">function</span><span class="token1">(</span>a<span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>a<span class="token1">.</span>status <span class="token">==</span> <span class="token6">200</span><span class="token1">)</span>
<span class="token1">{</span>
location<span class="token1">.</span>href<span class="token">=</span><span class="token4">"./index.php?ctl=Seller_Shop_Settled&met=index&op=step5&apply=<?=$apply?>"</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">else</span>
<span class="token1">{</span>
<span class="token3">alert</span><span class="token1">(</span><span class="token4">"<?=__('操作失败')?>"</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
$<span class="token1">(</span><span class="token4">'#btn_apply_company_next'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span> <span class="token1">{</span>
$<span class="token1">(</span><span class="token4">"#form"</span><span class="token1">)</span><span class="token1">.</span><span class="token3">submit</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token1">)</span><span class="token1">;</span>
```
```
方法:shopPaystatus()
```
<pre class="calibre14">```
<span class="token5">//添加卖家</span>
$check_seller <span class="token">=</span> $SellerBaseModel<span class="token">-</span><span class="token">></span><span class="token3">getByWhere</span><span class="token1">(</span><span class="token3">array</span><span class="token1">(</span><span class="token4">'shop_id'</span><span class="token">=</span><span class="token">></span>$shop_id<span class="token1">)</span><span class="token1">)</span><span class="token1">;</span>
<span class="token2">if</span><span class="token1">(</span><span class="token">!</span>$check_seller<span class="token1">)</span><span class="token1">{</span>
$seller_base<span class="token1">[</span><span class="token4">'shop_id'</span><span class="token1">]</span> <span class="token">=</span> $shop_id<span class="token1">;</span>
$seller_base<span class="token1">[</span><span class="token4">'user_id'</span><span class="token1">]</span> <span class="token">=</span> Perm<span class="token1">:</span><span class="token1">:</span>$userId<span class="token1">;</span>
$seller_base<span class="token1">[</span><span class="token4">'seller_name'</span><span class="token1">]</span> <span class="token">=</span> Perm<span class="token1">:</span><span class="token1">:</span>$row<span class="token1">[</span><span class="token4">'user_account'</span><span class="token1">]</span><span class="token1">;</span>
$seller_base<span class="token1">[</span><span class="token4">'seller_is_admin'</span><span class="token1">]</span> <span class="token">=</span> <span class="token6">1</span><span class="token1">;</span>
$seller_add <span class="token">=</span> $SellerBaseModel<span class="token">-</span><span class="token">></span><span class="token3">addBase</span><span class="token1">(</span>$seller_base<span class="token1">)</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$seller_add <span class="token">=</span> <span class="token6">true</span><span class="token1">;</span>
<span class="token1">}</span>
```
```
**申请店铺返回上一步**
方法:\_getRpStep()
```
<pre class="calibre14">```
switch <span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'rp'</span><span class="token1">]</span><span class="token1">)</span><span class="token1">{</span>
case <span class="token4">'step0'</span><span class="token1">:</span>
<span class="token5">//1.没有入驻信息,2.支持所有的入驻</span>
case <span class="token4">'step1'</span><span class="token1">:</span>
<span class="token5">//没有入驻信息,仅支持单方面入驻,如果支持所有入驻,就退到step0</span>
<span class="token2">if</span><span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'shop_status'</span><span class="token1">]</span> <span class="token">==</span> <span class="token4">'-1'</span><span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>Web_ConfigModel<span class="token1">:</span><span class="token1">:</span><span class="token3">value</span><span class="token1">(</span><span class="token4">'join_type'</span><span class="token1">)</span> <span class="token">==</span> <span class="token6">3</span><span class="token1">)</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'step0'</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'step1'</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">break</span><span class="token1">;</span>
case <span class="token4">'step2'</span><span class="token1">:</span>
<span class="token5">//1. 企业入驻 2. shop_status in 4,5,6,7,8,9</span>
case <span class="token4">'pstep2'</span><span class="token1">:</span>
<span class="token5">//1. 个人入驻 2. shop_status in 4,5,6,7,8,9</span>
<span class="token2">if</span><span class="token1">(</span><span class="token3">in_array</span><span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'shop_status'</span><span class="token1">]</span><span class="token1">,</span><span class="token3">array</span><span class="token1">(</span><span class="token6">4</span><span class="token1">,</span><span class="token6">5</span><span class="token1">,</span><span class="token6">6</span><span class="token1">,</span><span class="token6">7</span><span class="token1">,</span><span class="token6">8</span><span class="token1">,</span><span class="token6">9</span><span class="token1">)</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'shop_business'</span><span class="token1">]</span> <span class="token">==</span> <span class="token6">1</span><span class="token1">)</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'step2'</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'pstep2'</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">break</span><span class="token1">;</span>
case <span class="token4">'step3'</span><span class="token1">:</span>
<span class="token5">//1. 企业入驻 2. shop_status in 4,5,6,7,8,9</span>
case <span class="token4">'pstep3'</span><span class="token1">:</span>
<span class="token5">//1. 个人入驻 2. shop_status in 4,5,6,7,8,9</span>
<span class="token2">if</span><span class="token1">(</span><span class="token3">in_array</span><span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'shop_status'</span><span class="token1">]</span><span class="token1">,</span><span class="token3">array</span><span class="token1">(</span><span class="token6">4</span><span class="token1">,</span><span class="token6">5</span><span class="token1">,</span><span class="token6">6</span><span class="token1">,</span><span class="token6">7</span><span class="token1">,</span><span class="token6">8</span><span class="token1">,</span><span class="token6">9</span><span class="token1">)</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span>
<span class="token2">if</span><span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'shop_business'</span><span class="token1">]</span> <span class="token">==</span> <span class="token6">1</span><span class="token1">)</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'step3'</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'pstep3'</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">break</span><span class="token1">;</span>
case <span class="token4">'step4'</span><span class="token1">:</span>
<span class="token5">//1. shop_status in 4,5,6,7,8,9</span>
<span class="token2">if</span><span class="token1">(</span><span class="token3">in_array</span><span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'shop_status'</span><span class="token1">]</span><span class="token1">,</span><span class="token3">array</span><span class="token1">(</span><span class="token6">4</span><span class="token1">,</span><span class="token6">5</span><span class="token1">,</span><span class="token6">6</span><span class="token1">,</span><span class="token6">7</span><span class="token1">,</span><span class="token6">9</span><span class="token1">)</span><span class="token1">)</span><span class="token1">)</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'step4'</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">break</span><span class="token1">;</span>
case <span class="token4">'step5'</span><span class="token1">:</span>
<span class="token5">//1. shop_status == 7</span>
<span class="token2">if</span><span class="token1">(</span>$shop_step_info<span class="token1">[</span><span class="token4">'shop_status'</span><span class="token1">]</span> <span class="token">==</span> <span class="token6">7</span><span class="token1">)</span><span class="token1">{</span>
$op <span class="token">=</span> <span class="token4">'step5'</span><span class="token1">;</span>
<span class="token1">}</span><span class="token2">else</span><span class="token1">{</span>
$status <span class="token">=</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token1">}</span>
<span class="token2">break</span><span class="token1">;</span>
default <span class="token1">:</span>
$status <span class="token">=</span> <span class="token6">false</span><span class="token1">;</span>
<span class="token2">break</span><span class="token1">;</span>
<span class="token1">}</span>
```
```
**平台审核店铺**
平台审核控制器:shop/controllers/Api/Shop/ManageCtl.php
平台审核视图:shop\_admin/views/default/Shop/ManageCtl/pay.php
JS:shop\_admin/static/default/js/controllers/shop/join/shop\_Pay\_list.js
2.平台自营店铺
平台添加店铺:
控制器:shop/controllers/Api/Shop/SelfsupportCtl.php
视图:shop\_admin/views/default/Shop/SelfsupportCtl/getShopAddRow.php
3.店铺状态
模型:shop/models/shop/BaseModel.php
参数:shop\_status
0:关闭
1:待审核资料
2:待审核付款
3:开店成功
4:审核未通过
```
<pre class="calibre15">```
public static $shop_status <span class="token">=</span> <span class="token3">array</span><span class="token1">(</span>
<span class="token4">"0"</span> <span class="token">=</span><span class="token">></span> <span class="token4">"关闭"</span><span class="token1">,</span>
<span class="token4">"1"</span> <span class="token">=</span><span class="token">></span> <span class="token4">"待审核信息"</span><span class="token1">,</span>
<span class="token4">"2"</span> <span class="token">=</span><span class="token">></span> <span class="token4">"待审核付款"</span><span class="token1">,</span>
<span class="token4">"3"</span> <span class="token">=</span><span class="token">></span> <span class="token4">"开店成功"</span><span class="token1">,</span>
<span class="token4">"4"</span> <span class="token">=</span><span class="token">></span> <span class="token4">"审核未通过"</span>
<span class="token1">)</span><span class="token1">;</span>
```
```
- 序言
- 系统要求
- 版本更新日志
- 远丰商城技术对接说明
- 开发指导
- 框架内容
- 基础
- 开发规范
- 目录结构
- 架构
- 架构总览
- 数据库
- 数据库连接
- 基本使用
- 缓存
- 配置
- 路由
- 数据字典
- ucenter
- shop
- paycenter
- ucenter_admin
- shop_admin
- paycenter_admin
- 通讯内容
- 商家中心
- 顶部导航栏
- 店铺信息栏
- 店铺及商品提示栏
- 交易提示栏
- 销售情况统计栏
- 单品销量排行栏
- 店铺运营推广栏
- 平台联系方式栏
- 订单物流
- 商品
- 商品列表
- 商品详情
- 商品发布与编辑
- 分销商品
- 关联版式
- 商品规格
- 图片空间
- 淘宝导入
- 订单流程
- 交易订单
- 订单退款/退货
- 促销
- 团购管理
- 加价购
- 限时折扣
- 满即送
- 代金券管理
- 分销
- 店铺
- 店铺设置
- 自销产品供应商
- 实体店铺
- 品牌申请
- 店铺信息
- 消费者保障服务
- 门店账号
- 分销商--产品供应商
- 分销明细
- 批发市场
- 售后服务
- 咨询管理
- 投诉管理
- 退款管理
- 退货管理
- 云方案架构
- 负载集群
- 云存储
- 接口
- Api接口说明
- 品牌
- 商品规格
- 商品类型
- 商品分类
- 商品
- 订单
- 商品/店铺收藏
- 足迹
- 退款及退货
- 商家店铺
- 会员
- 入驻协议
- 订单接口
- 商品接口
- 订单物流接口
- 商家中心接口
- 促销接口
- 快递鸟物流接口
- 代金券接口
- 首页版块
- 团购
- 平台红包
- 限时折扣接口
- 拼团接口
- wap首页模板
- 杂项
- 远程上传图片
- JS
- 银联支付
- 多语言
- 商品评分
- 图片加载
- 买家申请退款退货
- 商家退款退货
- 平台退款退货
- 添加发票
- 提交订单
- 确认订单
- 运费销售区域
- 获取会员地址
- 充值
- 导出XLS
- 商城系统集成
- 多语言实现
- 三级分销推广链接发展推广员
- app.ini.php
- 去分销
- 版本更新
- 物流支持
- 运营人员建议
- 业务逻辑
- 统计结算
- 客服消息
- 账号
- 三级分销
- IM
- 配置
- 平台帐号
- 活动数据表说明