💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 订单物流 #### 1、已售订单管理 文件路径:shop/controllers/Seller/Trade/OrderCtl.php ###### 1.1、所有订单(physical()) $condition['chain_id'] = 0; ###### 1.2、待付款(getPhysicalNew()) $condi['order_status'] = Order_StateModel::ORDER_WAIT_PAY; $condi['chain_id'] = 0; ###### 1.3、已付款(getPhysicalPay()) $condi['order_status'] = Order_StateModel::ORDER_PAYED; $condi['chain_id'] = 0; ###### 1.4、已发货(getPhysicalSend()) $condi['order_status'] = Order_StateModel::ORDER_WAIT_CONFIRM_GOODS; $condi['chain_id'] = 0; ###### 1.5、已完成(getPhysicalSuccess()) $condi['order_status'] = Order_StateModel::ORDER_FINISH; $condi['chain_id'] = 0; ###### 1.6、已取消(getPhysicalCancel()) $condi['order_status'] = Order_StateModel::ORDER_CANCEL; $condi['chain_id'] = 0; ###### 1.7、回收站(getPhysicalHideOrder()) $condi['order_status'] = Order_StateModel::ORDER_CANCEL; $condi['chain_id'] = 0; ###### 1.8、搜索订单: function formSub(){ $('.search-form').parents('form').submit(); } ###### 1.9、取消订单 $('a[dialog_id="seller_order_cancel_order"]').on('click', function () { var order_id = $(this).data('order_id'),url = SITE_URL + '?ctl=Seller_Trade_Order&met=orderCancel&typ='; $.dialog({ title: '<?=__('取消订单')?>', content: 'url: ' + url + 'e', data: { order_id: order_id }, height: 250, width: 400, lock: true, drag: false, ok: function () { var form_ser = $(this.content.order_cancel_form).serialize(); $.post(url + 'json', form_ser, function (data) { }) } }) }); //获取订单详情,判断订单的当前状态与下单这是否为当前用户 $order_base = $Order_BaseModel->getOne($order_id); if( ($order_base['payment_id'] == PaymentChannlModel::PAY_CONFIRM&& $order_base['order_status'] ==Order_StateModel::ORDER_WAIT_PREPARE_GOODS) //货到付款+等待发货 $order_base['order_status'] == Order_StateModel::ORDER_WAIT_PAY&& $order_base['seller_user_id'] == Perm::$userId) { //加入取消时间 $edit_flag = $Order_BaseModel->editBase($order_id, $condition); //修改订单商品表中的订单状态 $edit_flag1 = $Order_GoodsModel->editGoods($order_goods_id, $edit_row); //退还订单商品的库存 if($order_base['chain_id']!=0){ $edit_flag2 = $Chain_GoodsModel->editGoods($chain_goods_id, $goods_stock); }else{ $edit_flag2 = $Goods_BaseModel->returnGoodsStock($order_goods_id); } //将需要取消的订单号远程发送给Paycenter修改订单状态 //远程修改paycenter中的订单状态 $rs = get_url_with_encrypt($key, sprintf('%s?ctl=Api_Pay_Pay&met=cancelOrder&typ=json', $url), $formvars); //如果是供货商取消进货订单,同时取消买家的订单或减少买家订单的金额 $dist_goods_order = $Order_GoodsModel -> getByWhere(array('order_id' => $dist_order['order_id'])); if(count($dist_goods_order) == 1){ $Order_BaseModel-> editBase($dist_order['order_id'], $condition); $Order_GoodsModel-> editGoods($dist_goods_order[0]['order_goods_id'], $edit_row); $Goods_BaseModel -> returnGoodsStock($dist_goods_order[0]['order_goods_id']); }else{ $Order_BaseModel-> editBase($dist_order['order_id'], $dist_edit_row); $Order_GoodsModel-> editGoods($dist_goods_order[$key]['order_goods_id'], $edit_row); $Goods_BaseModel -> returnGoodsStock($dist_goods_order[$key]['order_goods_id']); } $formvars['order_id'] = $dist_order['order_id']; $rs = get_url_with_encrypt($key, sprintf('%s?ctl=Api_Pay_Pay&met=cancelOrder&typ=json', $url), $formvars); } ###### 1.10、删除订单 window.hideOrder = function (e) { $.dialog({ title: '删除订单', content: '您确定要删除吗?删除后的订单可在回收站找回,或彻底删除! ', height: 100, width: 405, lock: true, drag: false, ok: function () { $.post(SITE_URL + '?ctl=Buyer_Order&met=hideOrder&typ=json',{order_id:e,user:'buyer'},function(data) { }) } }) } //判断订单状态是否是已完成(6)或者已取消(7)状态 if($order_base['order_status'] >= Order_StateModel::ORDER_FINISH) { //判断当前用户是否是卖家 if($order_base['seller_user_id'] == Perm::$userId) { $edit_row['order_shop_hidden'] = Order_BaseModel::IS_SELLER_HIDDEN; } } $flag = $Order_BaseModel->editBase($order_id, $edit_row); ###### 1.11、彻底删除 window.delOrder = function (e) { $.dialog({ title: '删除订单', content: '您确定要永久删除吗?永久删除后您将无法再查看该订单,也无法进行投诉维权,请谨慎操作!', height: 100, width: 610, lock: true, drag: false, ok: function () { $.post(SITE_URL +?'ctl=Buyer_Order&met=hideOrder&typ=json'{order_id:e,user:'buyer',op:'del'},function(data) { } ); } }) } //判断订单状态是否是已完成(6)或者已取消(7)状态 if($order_base['order_status'] >= Order_StateModel::ORDER_FINISH) { //判断当前用户是否是卖家 if($order_base['seller_user_id'] == Perm::$userId) { $edit_row['order_shop_hidden'] = Order_BaseModel::IS_SELLER_REMOVE; } } $flag = $Order_BaseModel->editBase($order_id, $edit_row); ###### 1.12、还原订单 window.restoreOrder = function (e) { $.dialog({ title: '还原删除订单', content: '您确定要还原吗?', height: 100, width: 610, lock: true, drag: false, ok: function () { $.post(SITE_URL + '?ctl=Buyer_Order&met=restoreOrder&typ=json',{order_id:e,user:'buyer'},function(data) { } ); } }) } $edit_row['order_shop_hidden'] = Order_BaseModel::NO_SELLER_HIDDEN; $flag = $Order_BaseModel->editBase($order_id, $edit_row); #### 2、虚拟兑换订单 文件路径:shop/controllers/Seller/Trade/OrderCtl.php ###### 2.1、所有订单(virtual()) $condition['shop_id'] = Perm::$shopId; $condition['order_is_virtual'] = Order_BaseModel::ORDER_IS_VIRTUAL; $condition['order_shop_hidden'] = Order_BaseModel::ORDER_IS_REAL; ###### 2.2、待付款(getVirtualNew()) $condition['shop_id'] = Perm::$shopId; $condition['order_is_virtual'] = Order_BaseModel::ORDER_IS_VIRTUAL; $condition['order_shop_hidden'] = Order_BaseModel::ORDER_IS_REAL; $condition['order_status'] = Order_StateModel::ORDER_WAIT_PAY; ###### 2.3、已发货(getVirtualPay()) $condition['shop_id'] = Perm::$shopId; $condition['order_is_virtual'] = Order_BaseModel::ORDER_IS_VIRTUAL; $condition['order_shop_hidden'] = Order_BaseModel::ORDER_IS_REAL; $condition['order_status'] = Order_StateModel::ORDER_WAIT_CONFIRM_GOODS; ###### 2.4、已完成(getVirtualSuccess()) $condition['shop_id'] = Perm::$shopId; $condition['order_is_virtual'] = Order_BaseModel::ORDER_IS_VIRTUAL; $condition['order_shop_hidden'] = Order_BaseModel::ORDER_IS_REAL; $condition['order_status'] = Order_StateModel::ORDER_FINISH; ###### 2.5、已取消(getVirtualCancel()) $condition['shop_id'] = Perm::$shopId; $condition['order_is_virtual'] = Order_BaseModel::ORDER_IS_VIRTUAL; $condition['order_shop_hidden'] = Order_BaseModel::ORDER_IS_REAL; $condition['order_status'] = Order_StateModel::ORDER_CANCEL; ###### 2.6、回收站(getVirtualHideOrder()) $condition['order_shop_hidden'] = $Order_BaseModel::IS_SELLER_HIDDEN; $condition['shop_id'] = Perm::$shopId; $condition['order_is_virtual'] = Order_BaseModel::ORDER_IS_VIRTUAL; ###### 2.7、校验兑换码(virtualExchange()) $('#_submit').on('click',function(){ exPost(); }); function exPost() { $('#vr_code_waring').html(''); $.getJSON( SITE_URL + '?ctl=Seller_Trade_Order&met=virtualExchange&typ=json&vr_code='+$("#vr_code").val(), null, function(data){ }); } //修改兑换码状态 $update['virtual_code_status'] = Order_GoodsVirtualCodeModel::VIRTUAL_CODE_USED; $update['virtual_code_usetime'] = date('Y-m-d H:i:s', time()); //兑换时间 $result = $this->editCode($virtual_code_id, $update); //判断该笔订单中有多少虚拟商品,如果是最后一笔虚拟商品,则修改订单状态为已完成,将订单金额转到商家账户 $edit_flag = $orderBaseModel->editBase($order_data['order_id'], array('order_status' => Order_StateModel::ORDER_FINISH , 'order_finished_time' => get_date_time())); //远程同步paycenter中的订单状态 $rs = get_url_with_encrypt($key, sprintf('%s?ctl=Api_Pay_Pay&met=confirmOrder&typ=json', $url), $formvars) ###### 2.8、其他 订单搜索、取消订单、删除订单、彻底删除订单、还原订单与上文已售订单管理中一致 #### 3、门店自提订单 文件路径:shop/controllers/Seller/Trade/OrderCtl.php ###### 3.1、所有订单(chain()) $condition['chain_id:!='] = 0; ###### 3.2、待付款(getChainNew()) $condi['order_status'] = Order_StateModel::ORDER_WAIT_PAY; $condi['chain_id:!='] = 0; ###### 3.3、待自提(getChainNotakes()) $condi['order_status'] = Order_StateModel::ORDER_SELF_PICKUP; $condi['chain_id:!='] = 0; ###### 3.4、已完成(getChainSuccess()) $condi['order_status'] = Order_StateModel::ORDER_FINISH; $condi['chain_id:!='] = 0; ###### 3.5、已取消(getChainCancel()) $condi['order_status'] = Order_StateModel::ORDER_CANCEL; $condi['chain_id:!='] = 0; ###### 3.6、回收站(getChainHideOrder()) $condition['order_shop_hidden'] = $Order_BaseModel::IS_SELLER_HIDDEN; $condition['chain_id:!='] = 0; ###### 3.7、其他 订单搜索、取消订单、删除订单、彻底删除订单、还原订单与上文已售订单管理中一致 #### 4、发货 文件路径:shop/controllers/Seller/Trade/DeliverCtl.php ###### 4.1、待发货(deliver()) $condition['order_status:IN'] = array( Order_StateModel::ORDER_PAYED, Order_StateModel::ORDER_WAIT_PREPARE_GOODS ); ###### 4.2、发货(shop/controllers/Seller/Trade/OrderCtl.php,send()) 编辑收货人信息: $('a[dialog_id="edit_buyer_address"]').on('click', function () { var _this = $(this), buyer_address = $('#buyer_address_span').html(); address_data = _this.data(), address_data.order_id = $('#order_id').val(); $.dialog({ title: '<?=__('选择收货地址')?>', content: 'url: ' + SITE_URL + '?ctl=Seller_Trade_Order&met=editBuyerAddress&typ=e', height: 200, width: 550, lock: true, drag: false, data: { address_data: address_data, callback: function ( data ) { } } }) }); $update_data['order_receiver_name'] = request_string('order_receiver_name'); $update_data['order_receiver_address'] = request_string('order_receiver_address'); $update_data['order_receiver_contact'] = request_string('order_receiver_contact'); $flag = $Order_BaseModel->editBase($order_id, $update_data); 编辑我的发货信息: $('a[dialog_id="edit_seller_address"]').on('click', function () { var order_id = $('#order_id').val(), shop_id = $(this).data('shop_id'), url = SITE_URL + '?ctl=Seller_Trade_Order&met=chooseSendAddress&typ='; $.dialog({ title: '<?=__('选择发货地址')?>', content: 'url: ' + url + 'e&shop_id=' + shop_id, height: 400, width: 640, lock: true, drag: false, data: { callback: function ( send_address, win ) { $.post(url + 'json&order_id=' + order_id, { send_address: send_address }, function (data) { }) } } }) }); $update_data['order_seller_name'] = $send_address['order_seller_name']; $update_data['order_seller_address'] = $send_address['order_seller_address']; $update_data['order_seller_contact'] = $send_address['order_seller_contact']; $flag = $Order_BaseModel->editBase($order_id, $update_data); 提交表单: $('a[nc_value]').on('click', function () { $.post(SITE_URL + '?ctl=Seller_Trade_Order&met=send&typ=json', send_data, function (data){ }) }); //判断该笔订单是否是自己的单子 $order_base = $Order_BaseModel->getOne($order_id); //判断账号是否可以发货 $check_send = $this->checkSend($order_base['seller_user_id'],$order_base['shop_id']); //设置发货 //配送时间 收货时间 $edit_flag = $Order_BaseModel->editBase($order_id, $update_data); $order_list = $Order_GoodsModel -> getByWhere(array('order_id' =>$order_base['order_source_id'],'order_goods_source_id' => ''));//查看不是分销商品的订单 if(!empty($order_list) && $order_base['order_source_id']){ foreach ($order_list as $key => $value) { $edit_flag1 = $Order_GoodsModel -> editGoods($key,array('order_goods_source_ship' => $update_data['order_shipping_code'].'-'.$update_data['order_shipping_express_id'])); check_rs($edit_flag1,$rs_row); } } //如果为采购单,改变 "买家<-->分销商" 订单状态 /* 只有订单中不含分销商自己的商品时改变订单状态,如果含有分销商自己的商品, 供货商发货改变订单状态,分销商自己就发不了货了. 所以如果订单中含有分销商自己的商品,只有分销商的商品发货了,才能改变订单状态 */ $dist_flag = $Order_BaseModel->editBase($dist_order['order_id'], $update_data); //买家商品订单表里添加物流单号 $order_goods_id = $Order_GoodsModel->getKeyByWhere(array('order_goods_source_id' => $order_id)); $edit_flag2 = $Order_GoodsModel -> editGoods($order_goods_id,array('order_goods_source_ship' => $update_data['order_shipping_code'].'-'.$update_data['order_shipping_express_id'])); ##### 4.3、发货中(delivering()) 获取订单列表 $Order_BaseModel = new Order_BaseModel(); $condition['order_status'] = Order_StateModel::ORDER_WAIT_CONFIRM_GOODS; $data = $Order_BaseModel->getPhysicalList($condition); foreach ($data['items'] as $key => $val) { if (strtotime($val['order_receiver_date'])) { $data['items'][$key]['order_receiver_date'] = $val['order_receiver_date']; } } 延迟收货 $('a[dialog_id="seller_order_delay_receive"]').on('click', function () { var $this = $(this), order_id = $this.data('order_id'), buyer_name = $this.data('buyer_user_name'), order_receiver_date = $this.data('order_receiver_date'), url = SITE_URL + '?ctl=Seller_Trade_Deliver&met=delayReceive&typ='; $.dialog({ title: '<?=__('延迟收货')?>', content: 'url: ' + url + 'e', data: { order_id: order_id, order_receiver_date: order_receiver_date, buyer_name: buyer_name }, height: 250, width: 500, lock: true, drag: false, ok: function () { } }) }) $order_receiver_date = strtotime($order_receiver_date); $order_receiver_date = strtotime("+$delayDays days", $order_receiver_date); $update['order_receiver_date'] = date('Y-m-d H:i:s', $order_receiver_date); $flag = $Order_BaseModel->editBase($order_id, $update); ##### 4.4、已发货(delivered()) $condition['order_status'] = Order_StateModel::ORDER_FINISH; ##### 4.5、其他 订单搜索、取消订单、删除订单、彻底删除订单、还原订单与上文已售订单管理中一致 #### 5、发货设置 文件路径:shop/controllers/Seller/Trade/DeliverCtl.php ##### 5.1、地址库(deliverSetting()) 获取地址列表: $cond_row['shop_id'] = Perm::$shopId; $data = $this->shopShippingAddressModel->getBaseList($cond_row, array('shipping_address_time' => 'desc'), $page, $rows); 新增/编辑地址: $('#form').validator({ debug:true, ignore: ':hidden', theme: 'yellow_right', timely: 1, stopOnError: false, rules: { phone: [/^1[\d]{10}$/, '<?=__('请输入正确的手机号')?>'] }, fields: { 'shipping_address_contact': 'required;length[2~10]', 'select_1':'required', 'select_2':'required', 'select_3':'required', 'shipping_address_address' : 'required', 'shipping_address_phone':'required;phone' }, valid: function(form){ var me = this; // 提交表单之前,hold住表单,并且在以后每次hold住时执行回调 me.holdSubmit(function(){ Public.tips.error('<?=__('正在处理中')?>...'); }); $.ajax({ url: ajax_url, data: $(form).serialize(), type: "POST", success:function(e){ me.holdSubmit(false); } }); } }); 删除地址: <span class="del"><a data-param="{'ctl':'Seller_Trade_Deliver','met':'delAddress','id':'<?= $val['shipping_address_id'] ?>'}" href="javascript:void(0)"><i class="iconfont icon-lajitong"></i><?=__('删除')?></a></span> 更改默认地址: $('input[name="is_default"]').on('click',function(){ $.get('index.php?ctl=Seller_Trade_Deliver&met=setDefaultAddress&shipping_address_id='+$(this).val(),function(result){}) }); //获取店铺已设置默认地址信息 $data = $this->getByWhere(array('shop_id' => $shop_id,'shipping_address_default' => 1)); if (!empty($data)) { foreach ($data as $key => $val) { //已有默认地址置为0 $this->edit($val['shipping_address_id'], array('shipping_address_default' => 0)); } } //设置新的默认地址 $this->edit($shipping_address_id, $field_row); ##### 5.2、默认物流公司(express) 循环显示所有物流公司 <?php foreach($data['items'] as $key=>$val){ ?> <td class="tl"> <label class="checkbox"><input type="checkbox" <?php if($val['checked']==1) echo "checked"; ?> name="id[]" value="<?=$val['express_id']?>"></label><?=__($val['express_name'])?> </td> <?php if(($key+1)%4==0){ ?></tr><tr><?php } ?> <?php } ?> 保存修改 $('#form').validator({ $.ajax({ url: "index.php?ctl=Seller_Trade_Deliver&met=express&typ=json&op=save", data: $(form).serialize(), type: "POST", success:function(e){ me.holdSubmit(false); } }); }); //获取店铺默认物流公司ID $express_rows = $this->getShopExpressId(array('shop_id' => $shop_id)); //不在已有默认物流公司ID内,插入 $this->add($field); //如果已有ID,不在提交的数组里,删除 $cond_row['shop_id'] = $shop_id; $cond_row['express_id'] = $v; //获取主键值,合并数组 $key_row = $this->getKeyByWhere($cond_row); $del_row = array_merge($del_row, $key_row); ##### 5.3、免运费额度(freightAmount()) 保存修改 $('#form').validator({ $.ajax({ url: "index.php?ctl=Seller_Trade_Deliver&met=freightAmount&op=save&typ=json", data: $(form).serialize(), type: "POST", success:function(e){ me.holdSubmit(false); } }); }); $update_flag = $this->edit($shop_id, array('shop_free_shipping' => request_int('free_shipping'))); ##### 5.4、发货单打印设置(printSetting()) 图片上传 $('#logo_upload').on('click', function () { $.dialog({ title: '<?=__('图片裁剪')?>', content: "url: <?= Yf_Registry::get('url') ?>?ctl=Upload&met=cropperImage&typ=e", data: {width:120,height:120 , callback: callback1 }, // 需要截取图片的宽高比例 width: '800px', lock: true }) }); function callback1( respone , api ) { $('#image_review').attr('src', respone.url); $('.image_review').show(); $('#shop_stamp').attr('value', respone.url); api.close(); } if ( window.isIE8 ) { $('#logo_upload').off('click'); logo_uploadss = new UploadImage({ thumbnailWidth: 200, thumbnailHeight: 60, imageContainer: '#image_review', uploadButton: '#logo_upload', inputHidden: '#shop_stamp' }); } 保存修改: $('#form').validator({ $.ajax({ url: "index.php?ctl=Seller_Trade_Deliver&met=printSetting&op=save&typ=json", data: $(form).serialize(), type: "POST", success:function(e){ me.holdSubmit(false); } }); ); $field_row['shop_print_desc'] = request_string('shop_print_desc'); //打印描述 $field_row['shop_stamp'] = request_string('shop_stamp'); //店铺印章 $flag = $Shop_BaseModel->setPrint($shop_id, $field_row); #### 6、运单模板 文件路径:shop/controllers/Seller/Trade/WaybillCtl.php ##### 6.1、模板绑定(waybillManage()) 设为默认/解绑 $('span[data-action]').on('click', function () { var user_express_id , tpl_id , param = {} , action = $(this).data('action') , url = SITE_URL + '?ctl=Seller_Trade_Waybill&met=operateByManage&typ=json&action=' ; if (action == 'set_default' || action == 'unbind_tpl') { param = { user_express_id: $(this).parent().data('user_express_id'), waybill_tpl_id: $(this).parent().data('waybill_tpl_id') }; url += action; $.post(url, param, function (data) { }) } }) //只能有一条数据为default $shop_express_search['user_is_default'] = Shop_ExpressModel::DEFAULT_TRUE; $shop_express_base = $this->shopExpressModel->getOneByWhere($shop_express_search); $this->shopExpressModel->editExpress($u_express_id, $shop_express_search); $shop_express_search['user_is_default'] = Shop_ExpressModel::DEFAULT_TRUE; $flag = $this->shopExpressModel->editExpress($user_express_id, $shop_express_search); ##### 6.2、选择模板(waybillBind()) 绑定 var user_express_id = <?php if ( !empty($user_express_id) ) { echo $user_express_id; } else { echo 0; }; ?>; $('a[nctype="btn_bind"]').on('click', function () { var waybill_tpl_id = $(this).data('waybill_tpl_id'); $.post(SITE_URL + '?ctl=Seller_Trade_Waybill&met=waybillBind&typ=json', {waybill_tpl_id: waybill_tpl_id, user_express_id: user_express_id}, function (data) { }) }) $waybill_tpl_id = request_int('waybill_tpl_id'); $shop_express_data['waybill_tpl_id'] = $waybill_tpl_id; $flag = $this->shopExpressModel->editExpress($user_express_id, $shop_express_data); ##### 6.3、模板设置(waybillSetting()) 初始化 <?php if ( !empty($shop_express_data['user_tpl_item']) ) { ?> <?php foreach ( $shop_express_data['user_tpl_item'] as $key => $val ) { ?> <?php echo $val; ?>.checked = true; <?php } ?> <?php } ?> 表单提交 $('#form').validator({ theme: 'yellow_right', timely: true, rules: {}, fields: { 'store_waybill_left':'required;range[0.01~9999];', 'store_waybill_top': 'required;range[0.01~9999];', }, valid: function(form){ //表单验证通过,提交表单到服务器 $.post( SITE_URL + "?ctl=Seller_Trade_Waybill&met=waybillSetting&typ=json", $('#form').serialize(), function(data) { }) } }); $express_data['user_tpl_item'] = array_keys($data); $express_data['user_tpl_top'] = request_int('store_waybill_top'); $express_data['user_tpl_left'] = request_int('store_waybill_left'); $flag = $this->shopExpressModel->editExpress($user_express_id, $express_data); ##### 6.4、自建模板(waybillIndex()) 6.4.1、添加模板(addTpl()) 视图文件: $this->view->setMet('waybillAdd'); 提交表单 $.post( SITE_URL + "?ctl=Seller_Trade_Waybill&typ=json&met=" + met, $('#form').serialize(), function(data) { if( data.status == 200 ) { Public.tips({ content: '<?=__('保存成功')?>!', type: 3 }); setTimeout(function () { window.location.href = SITE_URL + '?ctl=Seller_Trade_Waybill&met=waybillIndex&typ=e'; }, 1000); } else { Public.tips({ content: '<?=__('保存失败')?>!', type: 1 }); } }) 6.4.2、编辑模板(editTpl()) 视图文件: $this->view->setMet('waybillAdd'); 表单提交与6.4.1中表单提交一致。 6.4.3、删除模板 $('a[nctype="btn_del"]').on('click', function () { var _this = $(this),waybill_tpl_id = _this.data('waybill_tpl_id'); $.post(SITE_URL + '?ctl=Seller_Trade_Waybill&met=removeTpl&typ=json', {waybill_tpl_id: waybill_tpl_id}, function (data) { }) }) $flag = $this->logisticsWaybillModel->removeTpl($waybill_tpl_id); 6.4.4、测试模板(testTpl()) 视图文件: $this->view->setMet('waybillTest'); 打印运单: $('#btn').on('click', function() { pos(); $('.waybill_back').hide(); $('.control').hide(); window.print(); }); var pos = function () { var top = <?= $waybill_data['waybill_tpl_top']; ?>; var left = <?= $waybill_data['waybill_tpl_left']; ?>; $(".waybill_design").each(function(index) { var offset = $(this).offset(); var offset_top = offset.top + top; var offset_left = offset.left + left; $(this).offset({ top: offset_top, left: offset_left}) }); }; 6.4.5、设计模板(designTpl()) 视图文件: $this->view->setMet('waybillDesign'); 提交表单 $('#submit').on('click', function () { $.post(SITE_URL + '?ctl=Seller_Trade_Waybill&met=designTpl&typ=json', $('#form').serialize(), function (data){ if( data.status == 200 ) { Public.tips({ content: "<?=__('修改成功')?>", type: 3 }); setTimeout(function () { window.location.href = SITE_URL + '?ctl=Seller_Trade_Waybill&met=waybillIndex&typ=e'; }) } else { Public.tips({ content: "<?=__('修改失败')?>", type: 1 }); } }) }) $flag = $this->logisticsWaybillModel->editTpl($waybill_tpl_id, $waybill_edit_data); #### 7、评价管理 文件路径:shop/controllers/Seller/Goods/Evaluation.php 来自买家的评价(evaluation()) $data = $this->goodsEvaluationModel->getEvaluationList($cond_row, $order_row, $page, $rows); 解释: 视图文件 $this->view->setMet('explain'); 表单提交 $("#add_form").ajaxSubmit(function(message){ if(message.status == 200) { location.href="<?=Yf_Registry::get('url')?>?ctl=Seller_Goods_Evaluation&met=evaluation"; } else { Public.tips.error('<?=__('操作失败!')?>'); } }); #### 8、物流工具 文件路径:shop/controllers/Seller/TransportlCtl.php 8.1、运费模板设置(transport()) 视图文件: $this->view->setMet('template'); 数据获取: $data = $this->template($shop_id); 8.2、添加/编辑运费模板(transport()) 数据获取: $data = $this->transport_default($id,$shop_id); 添加规则: $('.trans-line').on('click','.t_addRule',function(){ StartNum +=1; cell = RuleCell.replace(/CurNum/g,StartNum); $(this).parent().parent().find('.tbl-except').find('table').append(cell); }); 编辑规则: $('.trans-line').on('click','a[entype="t_editArea"]',function () { curTransType = 'kd'; //取消所有已选择的checkbox $('#J_CityList').find('input[type="checkbox"]').attr('checked',false).attr('disabled',false); //取消显示所有统计数量 $('#J_CityList').find('.check_num').html(''); //记录当前行的标识n1,n2,n3.... curIndex = $(this).attr('data-group'); //记录当前操作的行,选择完地区会向该区域抛出值 objCurlArea = $('tr[data-group="'+curIndex+'"]').children(1); //记录已选择的所有省及市的value,SelectArea下标为value值,值为true,如江苏省SelectArea[320000]=true,南京市SelectArea[320100]=true SelectArea = new Array(); //取得当前行隐藏域内的city值,放入SelectArea数组中 var expAreas = $('input[name="areas['+curTransType+']['+curIndex.substring(1)+']"]').val(); expAreas = expAreas.split('|||'); expAreas = expAreas[0].split(','); try{ if(expAreas[0] != ''){ for(var v in expAreas){ SelectArea[expAreas[v]] = true; } } //初始化已选中的checkbox $('#J_CityList').find('.district-province').each(function(){ var count = 0; $(this).find('input[type="checkbox"]').each(function(){ if(SelectArea[$(this).val()]==true){ $(this).attr('checked',true); if($(this)[0].className!='J_Province') count++; } }); if (count > 0){ $(this).find('.check_num').html('('+count+')'); } }); //循环每一行,如果一行省都选中,则大区载选中 $('#J_CityList>li').each(function(){ $(this).find('.region_group').attr('checked',true); father = this; $(this).find('.J_Province').each(function(){ if (!$(this).attr('checked')){ $(father).find('.region_group').attr('checked',false); return ; } }); }); }catch(ex){} //其它行已选择的地区,不能再选择了 $(objCurlArea).parent().parent().find('.area-group').each(function(){ if ($(this).next().attr('name') != 'areas['+curTransType+']['+curIndex.substring(1)+']'){ expAreas = $(this).next().val().split('|||'); expAreas = expAreas[0].split(','); //重置SelectArea SelectArea = new Array(); try{ if(expAreas[0] != ''){ for(var v in expAreas){ SelectArea[expAreas[v]] = true; } } //其它行已选中的在这里都置灰 $('#J_CityList').find('input[type="checkbox"]').each(function(){ if(SelectArea[$(this).val()]==true){ $(this).attr('disabled',true).attr('checked',false); } }); //循环每一行,如果一行的省都被disabled,则大区域也disabled $('#J_CityList>li').each(function(){ $(this).find('.region_group').attr('disabled',true); father = this; $(this).find('.J_Province').each(function(){ if (!$(this).attr('disabled')){ $(father).find('.region_group').attr('disabled',false); return ; } }); }); }catch(ex){} } }); //定位弹出层的坐标 $("#dialog_areas").css({'position' : 'absolute','display' : 'block', 'z-index' : '9999','top':'20%','border':'1px solid #E6E6E6'}); $('.ks-ext-mask').css('display','block'); }); 删除一行规则: $('.trans-line').on('click','.t_deleteRule',function (){ curDelNum = $(this).attr('ncNum'); $.dialog.confirm('<?=__('确认删除吗')?>?',function(){ curTransType = 'kd'; obj_parent = $('tr[data-group="'+curDelNum+'"]').parent(); $('tr[data-group="'+curDelNum+'"]').remove(); if ($(obj_parent).find('tr').html() == null){ $(obj_parent).parent().parent().parent().find('.batch').css('display','none'); $(obj_parent).parent().parent().parent().find('.J_ToggleBatch').css('display','none'); $(obj_parent).parent().parent().parent().find('.batch').next().find('span').css('display','none'); }else{ //如果该配送方式,地区都不为空,隐藏地区的提示层 isRemove = true; $('div[data-delivery="'+curTransType+'"]').find('input[type="hidden"]').each(function(){ if ($(this).val()==''){ isRemove = false;return false; } }); if (isRemove == true){ $('div[data-delivery="'+curTransType+'"]').find('span[error_type="area"]').css('display','none'); } } }); }); 表单提交: var form_data = $('#transport_form').serialize(); var url = "<?=Yf_Registry::get('url')?>?ctl=Seller_Transport&met=transportSubmit&typ=json"; $.post(url,form_data,function(resp){ if(resp.status == 200){ window.location.href = "<?=Yf_Registry::get('url')?>?ctl=Seller_Transport&met=transport&typ=e"; }else{ Public.tips({type: 1, content: resp.msg}); } },'json'); //修改模板 $res_info = $Transport_TemplateModel->templateAdd($template_data); //添加模板 $res_info = $Transport_TemplateModel->templateModify($template_id,$template_data); //批量删除规则 $flag2 = $Transport_RuleModel->delAllRule($template_id); //批量添加规则 foreach ($transport[$type] as $key=>$value){ $flag = $Transport_RuleModel->addRule($rule_data); } 8.3、删除模板 <span class="del"><a data-param="{'ctl':'Seller_Transport','met':'delTemplate','id':'<?=$value['id']?>'}" href="javascript:void(0)"><i class="iconfont icon-lajitong"></i><?=__('删除')?></a></span> $flag = $Transport_TemplateModel->templateDel($transport_template_id,$shop_id); #### 9、售卖区域 文件路径:shop/controllers/Seller/TransportlCtl.php 9.1、售卖区域模板设置(tplarea()) 视图文件: $this->view->setMet('transportArea'); 数据获取: $data = $this->transport_area($shop_id); 9.2、添加/编辑售卖区域模板(act=area) 视图文件: $this->view->setMet('area'); 自定义中循环生成区域地址: <?php foreach($val['city'] as $citykey => $cityval){?> <li><label class="checkbox city"> <input <?php if($data['data']['area_ids_arr'] && in_array($cityval['district_id'],$data['data']['area_ids_arr'])){?>checked="checked"<?php }?> type="checkbox" name="city[]" data-province="<?=($val['district_id'])?>" value="<?=($cityval['district_id'])?>" /><?=($cityval['district_name'])?> </label></li> <?php }?> 表单提交路径: var ajax_url = '<?= Yf_Registry::get('url') ?>?ctl=Seller_Transport&met=areaSubmit&typ=json'; //全国 $area_ids = 0; //非全国 $province_ids = is_array($area_province) && $area_province ? implode(',', $area_province) : ''; $area_ids = trim($city_ids.','.$province_ids,','); $result = $Transport_AreaModel->areaAdd($data); 11.9.3、删除模板 <span class="del"><a data-param="{'ctl':'Seller_Transport','met':'delArea','id':'<?=$value['id']?>'}" ><i class="iconfont icon-lajitong"></i><?=__('删除')?></a></span> $flag = $Transport_AreaModel->typeDel($type_id,$shop_id);