Showing
2 changed files
with
148 additions
and
1 deletions
| @@ -174,6 +174,10 @@ class Seller extends Common | @@ -174,6 +174,10 @@ class Seller extends Common | ||
| 174 | $mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : ''; | 174 | $mode = !empty($data['mode']) ? implode(',', array_keys($data['mode'])) : ''; |
| 175 | $sms_code = !empty($data['sms_code']) ? $data['sms_code'] : ''; | 175 | $sms_code = !empty($data['sms_code']) ? $data['sms_code'] : ''; |
| 176 | $label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : ''; | 176 | $label = !empty($data['label']) ? implode(',', array_keys($data['label'])) : ''; |
| 177 | + $brand = !empty($data['brand']) ? implode(',', array_keys($data['brand'])) : ''; | ||
| 178 | + $label_1_ = !empty($data['label_1_']) ? implode(',', array_keys($data['label_1_'])) : ''; | ||
| 179 | + $label_2_ = !empty($data['label_2_']) ? implode(',', array_keys($data['label_2_'])) : ''; | ||
| 180 | + $label_3_ = !empty($data['label_3_']) ? implode(',', array_keys($data['label_3_'])) : ''; | ||
| 177 | 181 | ||
| 178 | if($sms_code) | 182 | if($sms_code) |
| 179 | $res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code); | 183 | $res_sms_code= file_get_contents(ON_LINE.'App.SendSMS.SetSellerSmsTemplate&sid='.$data['sellerid'].'&sms_id='.$sms_code); |
| @@ -191,6 +195,26 @@ class Seller extends Common | @@ -191,6 +195,26 @@ class Seller extends Common | ||
| 191 | if($label) | 195 | if($label) |
| 192 | $res_label= file_get_contents(ON_LINE.'App.Seller.setSellerLabel&sid='.$data['sellerid'].'&field='.$label); | 196 | $res_label= file_get_contents(ON_LINE.'App.Seller.setSellerLabel&sid='.$data['sellerid'].'&field='.$label); |
| 193 | 197 | ||
| 198 | + if($brand){ | ||
| 199 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel WHERE sid =".$data['sellerid']); | ||
| 200 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_brand_rel VALUES(".$data['sellerid'].",".$brand.")"); | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + if($label_1_){ | ||
| 204 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 1)"); | ||
| 205 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_1_.")"); | ||
| 206 | + } | ||
| 207 | + | ||
| 208 | + if($label_2_){ | ||
| 209 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 2)"); | ||
| 210 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_2_.")"); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + if($label_3_){ | ||
| 214 | + $del=Db::query("DELETE FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel WHERE sid = ".$data['sellerid']." AND lcid in (SELECT id FROM `xt-member-two-LINE`.xt_dc_dz_seller_label_c WHERE pid = 3)"); | ||
| 215 | + $add=Db::query("INSERT INTO `xt-member-two-LINE`.xt_dc_dz_seller_label_c_rel VALUES(".$data['sellerid'].",".$label_3_.")"); | ||
| 216 | + } | ||
| 217 | + | ||
| 194 | 218 | ||
| 195 | $result['code'] = 1; | 219 | $result['code'] = 1; |
| 196 | $result['msg'] = "配置成功!"; | 220 | $result['msg'] = "配置成功!"; |
| @@ -263,6 +287,34 @@ class Seller extends Common | @@ -263,6 +287,34 @@ class Seller extends Common | ||
| 263 | $label_list = json_decode($label_list,TRUE); | 287 | $label_list = json_decode($label_list,TRUE); |
| 264 | $this->assign('label_list',$label_list['data']); | 288 | $this->assign('label_list',$label_list['data']); |
| 265 | 289 | ||
| 290 | + //商家标签 | ||
| 291 | + //原生: | ||
| 292 | + //$label_c=Db::query("SELECT * from xt-member-two-LINE.xt_dc_dz_seller_label_c"); | ||
| 293 | + $label_c=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c")->select(); | ||
| 294 | + $label_c_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_label_c_rel")->where(array('sid'=>$data['id']))->select(); | ||
| 295 | + //组装数据 | ||
| 296 | + foreach ($label_c as $key => $value) { | ||
| 297 | + foreach ($label_c_rel as $k => $v) { | ||
| 298 | + if($value['id']==$v['lcid']){ | ||
| 299 | + $label_c[$key]['checked'] = 1; | ||
| 300 | + } | ||
| 301 | + } | ||
| 302 | + } | ||
| 303 | + $this->assign('label_c',$label_c); | ||
| 304 | + | ||
| 305 | + //商家品牌 | ||
| 306 | + $brand=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand")->select(); | ||
| 307 | + $brand_rel=Db::table("xt-member-two-LINE.xt_dc_dz_seller_brand_rel")->where(array('sid'=>$data['id']))->select(); | ||
| 308 | + //组装数据 | ||
| 309 | + foreach ($brand as $key => $value) { | ||
| 310 | + foreach ($brand_rel as $k => $v) { | ||
| 311 | + if($value['id']==$v['bid']){ | ||
| 312 | + $brand[$key]['checked'] = 1; | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + } | ||
| 316 | + $this->assign('brand',$brand); | ||
| 317 | + | ||
| 266 | //商户信息 | 318 | //商户信息 |
| 267 | $this->assign ('data',$data); | 319 | $this->assign ('data',$data); |
| 268 | $this->assign ( 'title','商户信息配置' ); | 320 | $this->assign ( 'title','商户信息配置' ); |
| @@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
| 46 | </div> | 46 | </div> |
| 47 | 47 | ||
| 48 | <div class="layui-form-item"> | 48 | <div class="layui-form-item"> |
| 49 | - <label class="layui-form-label">商家标签</label> | 49 | + <label class="layui-form-label">筛选标签</label> |
| 50 | <div class="layui-input-block"> | 50 | <div class="layui-input-block"> |
| 51 | <div class="layui-input-4"> | 51 | <div class="layui-input-4"> |
| 52 | <input type="checkbox" name="label[environmental]" lay-skin="primary" title="环境超好" {if $label_list.environmental==1} checked{/if}> | 52 | <input type="checkbox" name="label[environmental]" lay-skin="primary" title="环境超好" {if $label_list.environmental==1} checked{/if}> |
| @@ -57,6 +57,56 @@ | @@ -57,6 +57,56 @@ | ||
| 57 | </div> | 57 | </div> |
| 58 | 58 | ||
| 59 | <div class="layui-form-item"> | 59 | <div class="layui-form-item"> |
| 60 | + <label class="layui-form-label">商家品牌</label> | ||
| 61 | + <div class="layui-input-block"> | ||
| 62 | + <div class="layui-input-4"> | ||
| 63 | + {foreach $brand as $vo} | ||
| 64 | + <input type="checkbox" class="brand" lay-filter="brand" name="brand[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}> | ||
| 65 | + {/foreach} | ||
| 66 | + </div> | ||
| 67 | + </div> | ||
| 68 | + </div> | ||
| 69 | + | ||
| 70 | + <div class="layui-form-item"> | ||
| 71 | + <label class="layui-form-label">餐厅环境</label> | ||
| 72 | + <div class="layui-input-block"> | ||
| 73 | + <div class="layui-input-4"> | ||
| 74 | + {foreach $label_c as $vo} | ||
| 75 | + {if $vo.pid eq 1} | ||
| 76 | + <input type="checkbox" class="label_1_" lay-filter="label_1_" name="label_1_[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}> | ||
| 77 | + {/if} | ||
| 78 | + {/foreach} | ||
| 79 | + </div> | ||
| 80 | + </div> | ||
| 81 | + </div> | ||
| 82 | + | ||
| 83 | + <div class="layui-form-item"> | ||
| 84 | + <label class="layui-form-label">名人明星</label> | ||
| 85 | + <div class="layui-input-block"> | ||
| 86 | + <div class="layui-input-4"> | ||
| 87 | + {foreach $label_c as $vo} | ||
| 88 | + {if $vo.pid eq 2} | ||
| 89 | + <input type="checkbox" class="label_2_" lay-filter="label_2_" name="label_2_[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}> | ||
| 90 | + {/if} | ||
| 91 | + {/foreach} | ||
| 92 | + </div> | ||
| 93 | + </div> | ||
| 94 | + </div> | ||
| 95 | + | ||
| 96 | + <div class="layui-form-item"> | ||
| 97 | + <label class="layui-form-label">特色服务</label> | ||
| 98 | + <div class="layui-input-block"> | ||
| 99 | + <div class="layui-input-4"> | ||
| 100 | + {foreach $label_c as $vo} | ||
| 101 | + {if $vo.pid eq 3} | ||
| 102 | + <input type="checkbox" class="label_3_" lay-filter="label_3_" name="label_3_[{$vo.id}]" lay-skin="primary" title="{$vo.name}" {if $vo.checked==1} checked{/if}> | ||
| 103 | + {/if} | ||
| 104 | + {/foreach} | ||
| 105 | + </div> | ||
| 106 | + </div> | ||
| 107 | + </div> | ||
| 108 | + | ||
| 109 | + <div class="layui-form-item"> | ||
| 60 | <label class="layui-form-label">模板选择</label> | 110 | <label class="layui-form-label">模板选择</label> |
| 61 | <div class="layui-input-block"> | 111 | <div class="layui-input-block"> |
| 62 | <div class="layui-input-4"> | 112 | <div class="layui-input-4"> |
| @@ -83,6 +133,51 @@ | @@ -83,6 +133,51 @@ | ||
| 83 | <script> | 133 | <script> |
| 84 | layui.use('form', function () { | 134 | layui.use('form', function () { |
| 85 | var form = layui.form, $ = layui.jquery; | 135 | var form = layui.form, $ = layui.jquery; |
| 136 | + | ||
| 137 | + form.on('checkbox(brand)', function (data) { | ||
| 138 | + console.debug(data); | ||
| 139 | + var len=$(".brand:checked").length; | ||
| 140 | + if(len>1){ | ||
| 141 | + $(data.elem).next().attr("class","layui-unselect layui-form-checkbox"); | ||
| 142 | + $(data.elem).prop("checked",false); | ||
| 143 | + layer.msg('最多只能选1项!',{icon:5}); | ||
| 144 | + return false; | ||
| 145 | + } | ||
| 146 | + }) | ||
| 147 | + | ||
| 148 | + form.on('checkbox(label_1_)', function (data) { | ||
| 149 | + console.debug(data); | ||
| 150 | + var len=$(".label_1_:checked").length; | ||
| 151 | + if(len>1){ | ||
| 152 | + $(data.elem).next().attr("class","layui-unselect layui-form-checkbox"); | ||
| 153 | + $(data.elem).prop("checked",false); | ||
| 154 | + layer.msg('最多只能选1项!',{icon:5}); | ||
| 155 | + return false; | ||
| 156 | + } | ||
| 157 | + }) | ||
| 158 | + | ||
| 159 | + form.on('checkbox(label_2_)', function (data) { | ||
| 160 | + console.debug(data); | ||
| 161 | + var len=$(".label_2_:checked").length; | ||
| 162 | + if(len>1){ | ||
| 163 | + $(data.elem).next().attr("class","layui-unselect layui-form-checkbox"); | ||
| 164 | + $(data.elem).prop("checked",false); | ||
| 165 | + layer.msg('最多只能选1项!',{icon:5}); | ||
| 166 | + return false; | ||
| 167 | + } | ||
| 168 | + }) | ||
| 169 | + | ||
| 170 | + form.on('checkbox(label_3_)', function (data) { | ||
| 171 | + console.debug(data); | ||
| 172 | + var len=$(".label_3_:checked").length; | ||
| 173 | + if(len>1){ | ||
| 174 | + $(data.elem).next().attr("class","layui-unselect layui-form-checkbox"); | ||
| 175 | + $(data.elem).prop("checked",false); | ||
| 176 | + layer.msg('最多只能选1项!',{icon:5}); | ||
| 177 | + return false; | ||
| 178 | + } | ||
| 179 | + }) | ||
| 180 | + | ||
| 86 | //根据菜品ID 修改对应菜品的GIF、视频url | 181 | //根据菜品ID 修改对应菜品的GIF、视频url |
| 87 | form.on('submit(submit)', function (data) { | 182 | form.on('submit(submit)', function (data) { |
| 88 | var loading = layer.load(1, {shade: [0.1, '#fff']}); | 183 | var loading = layer.load(1, {shade: [0.1, '#fff']}); |
-
Please register or login to post a comment