初始上传
This commit is contained in:
497
addon/memberrecharge/shop/controller/Memberrecharge.php
Executable file
497
addon/memberrecharge/shop/controller/Memberrecharge.php
Executable file
@@ -0,0 +1,497 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\memberrecharge\shop\controller;
|
||||
|
||||
use addon\memberrecharge\model\MemberRechargeCard as MemberRechargeCardModel;
|
||||
use addon\memberrecharge\model\Memberrecharge as MemberRechargeModel;
|
||||
use addon\memberrecharge\model\MemberrechargeOrder as MemberRechargeOrderModel;
|
||||
use addon\memberrecharge\model\MemberrechargeOrder;
|
||||
use addon\printer\model\PrinterOrder;
|
||||
use app\model\store\Store as StoreModel;
|
||||
use app\shop\controller\BaseShop;
|
||||
use think\App;
|
||||
|
||||
/**
|
||||
* 会员充值
|
||||
*/
|
||||
class Memberrecharge extends BaseShop
|
||||
{
|
||||
public function __construct(App $app = null)
|
||||
{
|
||||
$this->replace = [
|
||||
'MEMBERRECHARGE_CSS' => __ROOT__ . '/addon/memberrecharge/shop/view/public/css',
|
||||
'MEMBERRECHARGE_JS' => __ROOT__ . '/addon/memberrecharge/shop/view/public/js',
|
||||
'MEMBERRECHARGE_IMG' => __ROOT__ . '/addon/memberrecharge/shop/view/public/img',
|
||||
];
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
//套餐字段
|
||||
protected $field = 'recharge_id,recharge_name,cover_img,face_value,buy_price,point,growth,coupon_id,sale_num,create_time,status';
|
||||
|
||||
//开卡字段
|
||||
protected $card_field = 'card_id,recharge_id,card_account,cover_img,face_value,point,growth,coupon_id,buy_price,member_img,nickname,order_id,order_no,from_type,use_status,create_time,use_time';
|
||||
|
||||
//订单字段
|
||||
protected $order_field = 'a.order_id,a.recharge_name,a.recharge_id,a.order_no,a.out_trade_no,a.member_id,a.cover_img,a.face_value,a.buy_price,a.point,a.growth,a.coupon_id,a.price,a.pay_type,a.pay_type_name,a.status,a.create_time,a.pay_time,a.member_img,a.nickname,a.order_from_name,a.order_from,IFNULL(s.store_name,"") as store_name';
|
||||
|
||||
//优惠券字段
|
||||
protected $coupon_field = 'coupon_type_id,coupon_name,money,count,lead_count,max_fetch,at_least,end_time,image,validity_type,fixed_term';
|
||||
|
||||
/**
|
||||
* 充值会员套餐列表
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
$model = new MemberRechargeModel();
|
||||
//获取续签信息
|
||||
if (request()->isJson()) {
|
||||
$status = input('status', '');//套餐状态
|
||||
$condition = [];
|
||||
if ($status) {
|
||||
$condition[] = [ 'status', '=', $status ];
|
||||
}
|
||||
$condition[] = [ 'site_id', '=', $this->site_id ];
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$list = $model->getMemberRechargePageList($condition, $page, $page_size, 'recharge_id desc', $this->field);
|
||||
return $list;
|
||||
} else {
|
||||
$config = $model->getConfig($this->site_id);
|
||||
$config = $config[ 'data' ];
|
||||
$this->assign("config", $config);
|
||||
return $this->fetch('memberrecharge/lists');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加充值套餐
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
if (request()->isJson()) {
|
||||
|
||||
$data = [
|
||||
'site_id' => $this->site_id,
|
||||
'recharge_name' => input('recharge_name', ''),//套餐名称
|
||||
'cover_img' => input('cover_img', ''),//封面
|
||||
'face_value' => input('face_value', ''),//面值
|
||||
'buy_price' => input('buy_price', ''),//价格
|
||||
'point' => input('point', ''),//赠送积分
|
||||
'growth' => input('growth', ''),//赠送成长值
|
||||
'coupon_id' => input('coupon_id', '')//优惠券id
|
||||
];
|
||||
|
||||
$model = new MemberRechargeModel();
|
||||
return $model->addMemberRecharge($data);
|
||||
|
||||
} else {
|
||||
return $this->fetch('memberrecharge/add');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑充值套餐
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$rechargeModel = new MemberRechargeModel();
|
||||
|
||||
$recharge_id = input('recharge_id', '');
|
||||
if (request()->isJson()) {
|
||||
|
||||
$data = [
|
||||
'recharge_name' => input('recharge_name', ''),//套餐名称
|
||||
'cover_img' => input('cover_img', ''),//封面
|
||||
'face_value' => input('face_value', ''),//面值
|
||||
'buy_price' => input('buy_price', ''),//价格
|
||||
'point' => input('point', ''),//赠送积分
|
||||
'growth' => input('growth', ''),//赠送成长值
|
||||
'coupon_id' => input('coupon_id', '')//优惠券id
|
||||
];
|
||||
|
||||
return $rechargeModel->editMemberRecharge(
|
||||
[
|
||||
[ 'recharge_id', '=', $recharge_id ],
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
], $data);
|
||||
|
||||
} else {
|
||||
//获取套餐详情
|
||||
$recharge = $rechargeModel->getMemberRechargeInfo(
|
||||
[
|
||||
[ 'recharge_id', '=', $recharge_id ],
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
],
|
||||
$this->field
|
||||
);
|
||||
if (empty($recharge[ 'data' ])) $this->error('未获取到套餐数据', href_url('memberrecharge://shop/memberrecharge/lists'));
|
||||
$this->assign('recharge', $recharge);
|
||||
return $this->fetch('memberrecharge/edit');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值套餐详情
|
||||
* @return mixed
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$recharge_model = new MemberRechargeModel();
|
||||
|
||||
$recharge_id = input('recharge_id', '');
|
||||
|
||||
//获取套餐详情
|
||||
$info = $recharge_model->getMemberRechargeInfo(
|
||||
[
|
||||
[ 'recharge_id', '=', $recharge_id ],
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
],
|
||||
$this->field
|
||||
)[ 'data' ] ?? [];
|
||||
if (empty($info)) $this->error('未获取到套餐数据', href_url('memberrecharge://shop/memberrecharge/lists'));
|
||||
$this->assign('info', $info);
|
||||
|
||||
return $this->fetch('memberrecharge/detail');
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用充值套餐
|
||||
* @return array
|
||||
*/
|
||||
public function invalid()
|
||||
{
|
||||
$model = new MemberRechargeModel();
|
||||
|
||||
$recharge_id = input('recharge_id', '');
|
||||
|
||||
$data = [ 'status' => 2 ];
|
||||
$condition = [ [ 'recharge_id', '=', $recharge_id ] ];
|
||||
|
||||
$res = $model->editMemberRecharge($condition, $data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启充值套餐
|
||||
* @return array
|
||||
*/
|
||||
public function open()
|
||||
{
|
||||
$model = new MemberRechargeModel();
|
||||
|
||||
$recharge_id = input('recharge_id', '');
|
||||
|
||||
$data = [ 'status' => 1 ];
|
||||
$condition = [ [ 'recharge_id', '=', $recharge_id ] ];
|
||||
|
||||
$res = $model->editMemberRecharge($condition, $data);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除充值套餐
|
||||
* @return mixed
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$model = new MemberRechargeModel();
|
||||
|
||||
$recharge_id = input('recharge_id', '');
|
||||
|
||||
return $model->deleteMemberRecharge([ [ 'recharge_id', '=', $recharge_id ] ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开卡列表
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function cardLists()
|
||||
{
|
||||
$recharge_id = input('recharge_id', '');
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
|
||||
$model = new MemberRechargeCardModel();
|
||||
$condition[] = [ 'site_id', '=', $this->site_id ];
|
||||
$condition[] = [ 'recharge_id', '=', $recharge_id ];
|
||||
//获取续签信息
|
||||
if (request()->isJson()) {
|
||||
$status = input('use_status', '');//使用状态
|
||||
if ($status) {
|
||||
$condition[] = [ 'use_status', '=', $status ];
|
||||
}
|
||||
|
||||
$page = input('page', 1);
|
||||
$list = $model->getMemberRechargeCardPageList($condition, $page, $page_size, 'card_id desc', $this->card_field);
|
||||
return $list;
|
||||
} else {
|
||||
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
|
||||
$list = $model->getMemberRechargeCardPageList($condition, 1, $page_size, 'card_id desc', $this->card_field);
|
||||
$this->assign('list', $list);
|
||||
|
||||
$this->assign('recharge_id', $recharge_id);
|
||||
return $this->fetch('memberrecharge/card_lists');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 开卡详情
|
||||
* @return mixed
|
||||
*/
|
||||
public function cardDetail()
|
||||
{
|
||||
$model = new MemberRechargeCardModel();
|
||||
|
||||
$card_id = input('card_id', '');
|
||||
|
||||
//获取详情
|
||||
$info = $model->getMemberRechargeCardInfo(
|
||||
[ [ 'card_id', '=', $card_id ] ],
|
||||
$this->card_field
|
||||
)[ 'data' ] ?? [];
|
||||
$this->assign('info', $info);
|
||||
|
||||
return $this->fetch('memberrecharge/card_detail');
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单列表
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function orderLists()
|
||||
{
|
||||
$recharge_id = input('recharge_id', 0);
|
||||
$model = new MemberRechargeOrderModel();
|
||||
//获取续签信息
|
||||
if (request()->isJson()) {
|
||||
$page = input('page', 1);
|
||||
$page_size = input('page_size', PAGE_LIST_ROWS);
|
||||
$nickname = input('nickname', '');
|
||||
$start_time = input('start_time', '');
|
||||
$end_time = input('end_time', '');
|
||||
$order_no = input('order_no', '');
|
||||
$store_id = input('store_id', '');
|
||||
|
||||
$condition = [
|
||||
[ 'a.status', '=', 2 ],
|
||||
[ 'a.site_id', '=', $this->site_id ]
|
||||
];
|
||||
|
||||
if ($recharge_id > 0) {
|
||||
$condition[] = [ 'recharge_id', '=', $recharge_id ];
|
||||
}
|
||||
|
||||
if ($nickname) {
|
||||
$condition[] = [ 'a.nickname', 'like', '%' . $nickname . '%' ];
|
||||
}
|
||||
if ($order_no) {
|
||||
$condition[] = [ 'a.order_no', '=', $order_no ];
|
||||
}
|
||||
if ($store_id != '') {
|
||||
$condition[] = [ 'a.store_id', '=', $store_id ];
|
||||
}
|
||||
//支付时间
|
||||
if (!empty($start_time) && empty($end_time)) {
|
||||
$condition[] = [ "a.pay_time", ">=", date_to_time($start_time) ];
|
||||
} elseif (empty($start_time) && !empty($end_time)) {
|
||||
$condition[] = [ "a.pay_time", "<=", date_to_time($end_time) ];
|
||||
} elseif (!empty($start_time) && !empty($end_time)) {
|
||||
$condition[] = [ 'a.pay_time', 'between', [ date_to_time($start_time), date_to_time($end_time) ] ];
|
||||
}
|
||||
$alias = 'a';
|
||||
$join[] = [
|
||||
'store s',
|
||||
's.store_id = a.store_id',
|
||||
'left'
|
||||
];
|
||||
$order = 'a.create_time desc';
|
||||
$list = $model->getMemberRechargeOrderPageList($condition, $page, $page_size, $order, $this->order_field, $alias, $join);
|
||||
return $list;
|
||||
} else {
|
||||
$this->assign('recharge_id', $recharge_id);
|
||||
|
||||
$order_num = $model->getOrderCount([ [ 'site_id', '=', $this->site_id ], [ 'status', '=', 2 ] ], 'order_id')[ 'data' ];
|
||||
$this->assign('order_num', $order_num);
|
||||
|
||||
$order_money = $model->getOrderSum([ [ 'site_id', '=', $this->site_id ], [ 'status', '=', 2 ] ], 'price')[ 'data' ];
|
||||
$this->assign('order_money', $order_money);
|
||||
|
||||
if (addon_is_exit('store') == 1) {
|
||||
$store_model = new StoreModel();
|
||||
$store_list = $store_model->getStoreList([
|
||||
[ 'site_id', '=', $this->site_id ]
|
||||
], 'store_id,store_name')[ 'data' ];
|
||||
$this->assign('store_list', $store_list);
|
||||
}
|
||||
|
||||
$this->assign('printer_addon_is_exit',addon_is_exit('printer'));
|
||||
|
||||
return $this->fetch('memberrecharge/order_lists');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* @return mixed
|
||||
*/
|
||||
public function orderDetail()
|
||||
{
|
||||
$order_id = input('order_id', '');
|
||||
|
||||
$condition = [
|
||||
[ 'a.order_id', '=', $order_id ],
|
||||
[ 'a.site_id', '=', $this->site_id ]
|
||||
];
|
||||
|
||||
$alias = 'a';
|
||||
$join[] = [
|
||||
'store s',
|
||||
's.store_id = a.store_id',
|
||||
'left'
|
||||
];
|
||||
|
||||
$model = new MemberRechargeOrderModel();
|
||||
$info = $model->getMemberRechargeOrderInfo($condition, $this->order_field, $alias, $join)[ 'data' ] ?? [];
|
||||
if (empty($info)) $this->error('未获取到订单数据', href_url('memberrecharge://shop/memberrecharge/order_lists'));
|
||||
$this->assign('info', $info);
|
||||
|
||||
return $this->fetch('memberrecharge/order_detail');
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否开启充值
|
||||
* @return mixed
|
||||
*/
|
||||
public function setConfig()
|
||||
{
|
||||
$model = new MemberRechargeModel();
|
||||
$is_use = input('is_use', 0);
|
||||
$data = [];
|
||||
return $model->setConfig($data, $is_use, $this->site_id);
|
||||
}
|
||||
|
||||
public function exportRecharge()
|
||||
{
|
||||
$recharge_id = input("recharge_id", "");//订单状态
|
||||
|
||||
$condition[] = [ "recharge_id", "=", $recharge_id ];
|
||||
$model = new MemberRechargeCardModel();
|
||||
|
||||
$list = $model->getMemberRechargeCardPageList($condition, 1, 0, 'card_id desc', "*");
|
||||
if (empty($list[ 'data' ][ 'list' ])) {
|
||||
return $this->error("未查询到数据");
|
||||
}
|
||||
|
||||
// 实例化excel
|
||||
$phpExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
|
||||
$phpExcel->getProperties()->setTitle("充值记录");
|
||||
$phpExcel->getProperties()->setSubject("充值记录");
|
||||
// 对单元格设置居中效果
|
||||
$phpExcel->getActiveSheet()->getStyle('A')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('B')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('C')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('D')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('E')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('F')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('G')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('H')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('I')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('J')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('K')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
$phpExcel->getActiveSheet()->getStyle('L')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
|
||||
//单独添加列名称
|
||||
$phpExcel->setActiveSheetIndex(0);
|
||||
$phpExcel->getActiveSheet()->setCellValue('A1', '店铺名称');//可以指定位置
|
||||
$phpExcel->getActiveSheet()->setCellValue('B1', '充值卡号');
|
||||
$phpExcel->getActiveSheet()->setCellValue('C1', '套餐名称');
|
||||
$phpExcel->getActiveSheet()->setCellValue('D1', '面值');
|
||||
$phpExcel->getActiveSheet()->setCellValue('E1', '积分');
|
||||
$phpExcel->getActiveSheet()->setCellValue('F1', '成长值');
|
||||
$phpExcel->getActiveSheet()->setCellValue('G1', '购买金额');
|
||||
$phpExcel->getActiveSheet()->setCellValue('H1', '会员昵称');
|
||||
$phpExcel->getActiveSheet()->setCellValue('I1', '订单编号');
|
||||
$phpExcel->getActiveSheet()->setCellValue('J1', '使用状态');
|
||||
$phpExcel->getActiveSheet()->setCellValue('K1', '创建时间');
|
||||
$phpExcel->getActiveSheet()->setCellValue('L1', '使用时间');
|
||||
//循环添加数据(根据自己的逻辑)
|
||||
foreach ($list[ 'data' ][ 'list' ] as $k => $v) {
|
||||
$i = $k + 2;
|
||||
if ($v[ 'use_status' ] == 1) {
|
||||
$status_name = "未使用";
|
||||
} else {
|
||||
$status_name = "已使用";
|
||||
}
|
||||
|
||||
$phpExcel->getActiveSheet()->setCellValue('A' . $i, $v[ 'site_name' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('B' . $i, $v[ 'card_account' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('C' . $i, $v[ 'recharge_name' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('D' . $i, $v[ 'face_value' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('E' . $i, $v[ 'point' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('F' . $i, $v[ 'growth' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('G' . $i, $v[ 'buy_price' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('H' . $i, $v[ 'nickname' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('I' . $i, ' ' . (string) $v[ 'order_no' ]);
|
||||
$phpExcel->getActiveSheet()->setCellValue('J' . $i, $status_name);
|
||||
$phpExcel->getActiveSheet()->setCellValue('K' . $i, date('Y-m-d', $v[ 'create_time' ]));
|
||||
$phpExcel->getActiveSheet()->setCellValue('L' . $i, date('Y-m-d', $v[ 'use_time' ]));
|
||||
}
|
||||
|
||||
// 重命名工作sheet
|
||||
$phpExcel->getActiveSheet()->setTitle('充值记录');
|
||||
// 设置第一个sheet为工作的sheet
|
||||
$phpExcel->setActiveSheetIndex(0);
|
||||
// 保存Excel 2007格式文件,保存路径为当前路径,名字为export.xlsx
|
||||
$objWriter = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($phpExcel, 'Xlsx');
|
||||
$file = date('Y年m月d日-充值记录表', time()) . '.xlsx';
|
||||
$objWriter->save($file);
|
||||
|
||||
header("Content-type:application/octet-stream");
|
||||
|
||||
$filename = basename($file);
|
||||
header("Content-Disposition:attachment;filename = " . $filename);
|
||||
header("Accept-ranges:bytes");
|
||||
header("Accept-length:" . filesize($file));
|
||||
readfile($file);
|
||||
unlink($file);
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印订单小票
|
||||
* @return array|mixed|void
|
||||
*/
|
||||
public function printTicket()
|
||||
{
|
||||
if (addon_is_exit('printer') == 0) return error('', '未安装打印小票插件');
|
||||
|
||||
if (request()->isJson()) {
|
||||
$order_id = input('order_id', 0);
|
||||
$printer_order_model = new PrinterOrder();
|
||||
$recharge_order = ( new MemberrechargeOrder() )->getMemberRechargeOrderInfo([ [ 'relate_type', '=', 'order' ], [ 'order_id', '=', $order_id ] ], 'order_id')[ 'data' ];
|
||||
if (empty($recharge_order)) return error('', '未获取到充值订单信息');
|
||||
$res = $printer_order_model->printer([
|
||||
'order_id' => $recharge_order[ 'order_id' ],
|
||||
'type' => 'recharge',
|
||||
]);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
237
addon/memberrecharge/shop/view/memberrecharge/add.html
Executable file
237
addon/memberrecharge/shop/view/memberrecharge/add.html
Executable file
@@ -0,0 +1,237 @@
|
||||
<div class="layui-form form-wrap">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>套餐名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="recharge_name" lay-verify="required" autocomplete="off" class="layui-input len-long" maxlength="40">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">封面:</label>
|
||||
<div class="layui-input-block img-upload">
|
||||
<div class="upload-img-block">
|
||||
<div class="upload-img-box">
|
||||
<div class="upload-default" id="img">
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" class="layui-input" name="cover_img" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>面值:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="face_value" lay-verify="required|sum|number" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
<div class="word-aux">
|
||||
<p>注意:实际进入用户账户的余额</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>价格:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" name="buy_price" lay-verify="required|sum|number|numberFill" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
<div class="word-aux">
|
||||
<p>注意:用户实际需支付的金额</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>赠送积分:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="point" lay-verify="required|num|number" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>赠送成长值:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="growth" lay-verify="required|num|number" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">赠送优惠券:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="coupon-item coupon">
|
||||
<div class="discount-cont">
|
||||
<div><a href="javascript:;" class="text-color" id="select_coupon">选择优惠券</a></div>
|
||||
<div class="word-aux" style="margin-left: 0">
|
||||
<p>活动优惠券发放,不受优惠券自身数量和领取数量的限制</p>
|
||||
</div>
|
||||
<div id="coupon_list"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backMemberRechargeList()">返回</button>
|
||||
<a id="coverImgId"></a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="STATIC_JS/coupon_select.js"></script>
|
||||
<script>
|
||||
var coupon_list = '',laytpl;
|
||||
var saveData = null;
|
||||
var totalUploadNum = 0;
|
||||
var completeUploadNum = 0;
|
||||
var upload;
|
||||
|
||||
var coupon_select = new CouponSelect({
|
||||
tableElem:'#coupon_list',
|
||||
selectElem:'#select_coupon',
|
||||
})
|
||||
|
||||
layui.use(['form', 'laytpl'], function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
|
||||
laytpl = layui.laytpl;
|
||||
|
||||
form.render();
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function(value) {
|
||||
if (value < 0 || value % 1 != 0) {
|
||||
return '请输入正整数!';
|
||||
}
|
||||
},
|
||||
number: function (value) {
|
||||
if (value < 0) {
|
||||
return '请输入不小于0的数!'
|
||||
}
|
||||
},
|
||||
numberFill: function (value) {
|
||||
if (value == 0) {
|
||||
return '请输入大于0的数!'
|
||||
}
|
||||
},
|
||||
sum: function (value) {
|
||||
var arrMen = value.split(".");
|
||||
var val = 0;
|
||||
if (arrMen.length == 2) {
|
||||
val = arrMen[1];
|
||||
}
|
||||
if (val.length > 2) {
|
||||
return '保留小数点后两位'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
upload = new Upload({
|
||||
elem: '#img',
|
||||
auto:false,
|
||||
bindAction:'#coverImgId',
|
||||
callback: function(res) {
|
||||
uploadComplete('cover_img', res.data.pic_path);
|
||||
}
|
||||
});
|
||||
|
||||
function uploadComplete(field, pic_path) {
|
||||
saveData.field[field] = pic_path;
|
||||
completeUploadNum += 1;
|
||||
if(completeUploadNum == totalUploadNum){
|
||||
saveFunc();
|
||||
}
|
||||
}
|
||||
|
||||
function saveFunc(){
|
||||
var data = saveData;
|
||||
// 删除图片
|
||||
if(!data.field.cover_img) upload.delete();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/add"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
success: function(res){
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('添加成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续添加'],
|
||||
closeBtn: 0,
|
||||
yes: function(index, layero){
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/lists");
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
form.on('submit(save)', function(data){
|
||||
data.field.coupon_id = coupon_select.getSelectedData().selectedIds.toString();
|
||||
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
saveData = data;
|
||||
var obj = $("img.img_prev[data-prev='1']");
|
||||
totalUploadNum = obj.length;
|
||||
if(totalUploadNum > 0){
|
||||
obj.each(function(){
|
||||
var actionId = $(this).attr('data-action-id');
|
||||
$(actionId).click();
|
||||
})
|
||||
}else{
|
||||
saveFunc();
|
||||
}
|
||||
});
|
||||
|
||||
form.on('submit(coupon-search)', function(data) {
|
||||
couponTable.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
// 选择优惠
|
||||
$('body').off('click', '.coupon-item .layui-form-checkbox').on('click', '.coupon-item .layui-form-checkbox', function(e){
|
||||
if ($(this).prev('[name="discount_type"]').is(':checked')) {
|
||||
$(this).parents('.coupon-item').find('.discount-cont').removeClass('layui-hide');
|
||||
} else {
|
||||
$(this).parents('.coupon-item').find('.discount-cont').addClass('layui-hide');
|
||||
}
|
||||
});
|
||||
|
||||
function backMemberRechargeList() {
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/lists");
|
||||
}
|
||||
function checkInput(obj){
|
||||
$(obj).val(Math.abs($(obj).val()));
|
||||
}
|
||||
</script>
|
||||
102
addon/memberrecharge/shop/view/memberrecharge/card_detail.html
Executable file
102
addon/memberrecharge/shop/view/memberrecharge/card_detail.html
Executable file
@@ -0,0 +1,102 @@
|
||||
<link rel="stylesheet" href="STATIC_CSS/promotion_detail.css">
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">基本信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="promotion-view">
|
||||
<div class="promotion-view-item">
|
||||
<label>卡号:</label>
|
||||
<span>{$info.card_account}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>状态:</label>
|
||||
<span>{$info.use_status == 1 ? '未使用' : '已使用'}</span>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view-item">
|
||||
<label>订单号:</label>
|
||||
<span>{$info.order_no}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>充值用户:</label>
|
||||
<span>{$info.nickname}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>套餐面值:</label>
|
||||
<span>{$info.face_value}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>金额:</label>
|
||||
<span>{$info.buy_price}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>赠送积分:</label>
|
||||
<span>{$info.point}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>赠送成长值:</label>
|
||||
<span>{$info.growth}</span>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view-item">
|
||||
<label>创建时间:</label>
|
||||
<span>{:date('Y-m-d H:i:s', $info.create_time)}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view">
|
||||
<div class="promotion-view-item-line">
|
||||
<label class="promotion-view-item-custom-label">横幅图片:</label>
|
||||
<div class="promotion-view-item-custom-box img-upload">
|
||||
<div class="upload-img-block icon">
|
||||
<div class="upload-img-box">
|
||||
<img layer-src src="{:img($info.cover_img)}" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if !empty($info.coupon_list)}
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">赠送优惠券</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class='promotion-view-list'>
|
||||
<table id="promotion_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
var promotion_list = {if !empty($info.coupon_list)} {:json_encode($info.coupon_list, JSON_UNESCAPED_UNICODE)}{else/}[] {/if};
|
||||
|
||||
layui.use('table', function() {
|
||||
new Table({
|
||||
elem: '#promotion_list',
|
||||
cols: [
|
||||
[{
|
||||
field: 'coupon_name',
|
||||
title: '优惠券',
|
||||
width: '20%',
|
||||
}, {
|
||||
title: '优惠内容',
|
||||
templet: function(data) {
|
||||
if(data.at_least > 0){
|
||||
return '满'+data.at_least+ (data.type == 'discount' ? '打'+data.discount +'折' : '减'+data.money) ;
|
||||
}else{
|
||||
return '无门槛'+ (data.type == 'discount' ? '打'+data.discount+'折' : '减' +data.money);
|
||||
}
|
||||
}
|
||||
}]
|
||||
],
|
||||
data: promotion_list
|
||||
});
|
||||
});
|
||||
</script>
|
||||
170
addon/memberrecharge/shop/view/memberrecharge/card_lists.html
Executable file
170
addon/memberrecharge/shop/view/memberrecharge/card_lists.html
Executable file
@@ -0,0 +1,170 @@
|
||||
<style>
|
||||
.layui-layout-admin .table-tab .layui-tab-title{margin-bottom: 15px;}
|
||||
</style>
|
||||
|
||||
<div class="layui-collapse tips-wrap">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<ul class="layui-colla-content layui-show">
|
||||
<li>领卡客户</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<div class="layui-tab table-tab" lay-filter="use_status">
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="exportRecharge()">导出记录</button>
|
||||
</div>
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" data-status="">全部</li>
|
||||
<li data-status="1">未使用</li>
|
||||
<li data-status="2">已使用</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="charge_list" lay-filter="charge_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 套餐信息 -->
|
||||
<script type="text/html" id="cover_img">
|
||||
<div class="table-tuwen-box">
|
||||
<div class='font-box'>
|
||||
<p class="multi-line-hiding">面值:{{d.face_value}}</p>
|
||||
<p class="multi-line-hiding">价格:{{d.buy_price}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 礼包 -->
|
||||
<script type="text/html" id="libao">
|
||||
<div class="table-tuwen-box">
|
||||
<div class='font-box'>
|
||||
<p class="multi-line-hiding">积分:{{d.point}}</p>
|
||||
<p class="multi-line-hiding">成长值:{{d.growth}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 用户信息 -->
|
||||
<script type="text/html" id="user_info">
|
||||
<div class='table-title'>
|
||||
<div class='title-pic'>
|
||||
<img layer-src src="{{ns.img(d.member_img.split(',')[0])}}" onerror="this.src = '{:img('public/static/img/default_img/head.png')}' "/>
|
||||
</div>
|
||||
<div class='title-content'>
|
||||
<p class="layui-elip">{{d.nickname}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 状态 -->
|
||||
<script type="text/html" id="use_status">
|
||||
{{d.use_status == 1 ? '未使用' : '已使用'}}
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="card_detail">详情</a>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'element'], function() {
|
||||
var table,
|
||||
form = layui.form,
|
||||
element = layui.element;
|
||||
form.render();
|
||||
|
||||
table = new Table({
|
||||
elem: '#charge_list',
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/cardlists"),
|
||||
where:{
|
||||
recharge_id:{$recharge_id}
|
||||
},
|
||||
cols: [
|
||||
[{
|
||||
field:'card_account',
|
||||
title: '充值卡号',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#member_img'
|
||||
}, {
|
||||
field: 'cover_img',
|
||||
title: '套餐信息',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: '#cover_img'
|
||||
}, {
|
||||
title: '赠送礼包',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#libao'
|
||||
}, {
|
||||
field: 'pay_type_name',
|
||||
title: '用户信息',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: '#user_info'
|
||||
}, {
|
||||
field: 'order_no',
|
||||
title: '订单号',
|
||||
unresize: 'false',
|
||||
width: '15%'
|
||||
}, {
|
||||
title: '购买时间',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '使用状态',
|
||||
unresize: 'false',
|
||||
width: '8%',
|
||||
templet: '#use_status'
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align:'right'
|
||||
}]
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
//监听Tab切换
|
||||
element.on('tab(use_status)', function(data) {
|
||||
var status = $(this).attr("data-status");
|
||||
table.reload( {
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'use_status': status
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'card_detail': //编辑
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/carddetail?card_id=" + data.card_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function exportRecharge(){
|
||||
var recharge_id = {$recharge_id};
|
||||
location.href = ns.url("memberrecharge://shop/memberrecharge/exportRecharge?request_mode=download&recharge_id=" + recharge_id);
|
||||
}
|
||||
</script>
|
||||
94
addon/memberrecharge/shop/view/memberrecharge/detail.html
Executable file
94
addon/memberrecharge/shop/view/memberrecharge/detail.html
Executable file
@@ -0,0 +1,94 @@
|
||||
<link rel="stylesheet" href="STATIC_CSS/promotion_detail.css">
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">基本信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="promotion-view">
|
||||
<div class="promotion-view-item">
|
||||
<label>套餐名称:</label>
|
||||
<span>{$info.recharge_name}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>状态:</label>
|
||||
<span>{$info.status == 1 ? '正常' : '关闭'}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>面值:</label>
|
||||
<span>{$info.face_value}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>价格:</label>
|
||||
<span>{$info.buy_price}</span>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view-item">
|
||||
<label>赠送积分:</label>
|
||||
<span>{$info.point}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>赠送成长值:</label>
|
||||
<span>{$info.growth}</span>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view-item">
|
||||
<label>创建时间:</label>
|
||||
<span>{:date('Y-m-d H:i:s', $info.create_time)}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="promotion-view">
|
||||
<div class="promotion-view-item-line">
|
||||
<label class="promotion-view-item-custom-label">横幅图片:</label>
|
||||
<div class="promotion-view-item-custom-box img-upload">
|
||||
<div class="upload-img-block icon">
|
||||
<div class="upload-img-box">
|
||||
<img layer-src src="{:img($info.cover_img)}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{if !empty($info.coupon_list)}
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">赠送优惠券</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class='promotion-view-list'>
|
||||
<table id="promotion_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
var promotion_list = {if !empty($info.coupon_list)} {:json_encode($info.coupon_list, JSON_UNESCAPED_UNICODE)}{else/}[] {/if};
|
||||
|
||||
layui.use('table', function() {
|
||||
new Table({
|
||||
elem: '#promotion_list',
|
||||
cols: [
|
||||
[{
|
||||
field: 'coupon_name',
|
||||
title: '优惠券',
|
||||
width: '20%',
|
||||
}, {
|
||||
title: '优惠内容',
|
||||
templet: function(data) {
|
||||
if(data.at_least > 0){
|
||||
return '满'+data.at_least+ (data.type == 'discount' ? '打'+data.discount +'折' : '减'+data.money) ;
|
||||
}else{
|
||||
return '无门槛'+ (data.type == 'discount' ? '打'+data.discount+'折' : '减' +data.money);
|
||||
}
|
||||
}
|
||||
}]
|
||||
],
|
||||
data: promotion_list
|
||||
});
|
||||
});
|
||||
</script>
|
||||
237
addon/memberrecharge/shop/view/memberrecharge/edit.html
Executable file
237
addon/memberrecharge/shop/view/memberrecharge/edit.html
Executable file
@@ -0,0 +1,237 @@
|
||||
<div class="layui-form form-wrap">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>套餐名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="recharge_name" lay-verify="required" value="{$recharge.data.recharge_name}" autocomplete="off" class="layui-input len-long" maxlength="40">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">封面:</label>
|
||||
<div class="layui-input-inline img-upload">
|
||||
<div class="upload-img-block icon">
|
||||
<div class="upload-img-box {if condition="$recharge.data.cover_img"}hover{/if}">
|
||||
<div class="upload-default" id="img">
|
||||
{if condition="$recharge.data.cover_img"}
|
||||
<div id="preview_img" class="preview_img">
|
||||
<img layer-src src="{:img($recharge.data.cover_img)}" class="img_prev"/>
|
||||
</div>
|
||||
{else/}
|
||||
<div class="upload">
|
||||
<i class="iconfont iconshangchuan"></i>
|
||||
<p>点击上传</p>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="operation">
|
||||
<div>
|
||||
<i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
|
||||
<i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
|
||||
</div>
|
||||
|
||||
<div class="replace_img js-replace">点击替换</div>
|
||||
</div>
|
||||
<input type="hidden" class="layui-input" name="cover_img" value="{$recharge.data.cover_img}" />
|
||||
</div>
|
||||
<!-- <p id="img" class=" {if condition="$recharge.data.cover_img"} replace {else/} no-replace{/if}">替换</p>
|
||||
<input type="hidden" class="layui-input" name="cover_img" value="{$recharge.data.cover_img}" />
|
||||
<i class="del {if condition="$recharge.data.cover_img"}show{/if}">x</i> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--<div class="layui-form-item">-->
|
||||
<!--<label class="layui-form-label">封面:</label>-->
|
||||
<!--<input type="hidden" class="layui-input" name="cover_img" value="{$recharge.data.cover_img}" />-->
|
||||
<!--<div class="layui-input-inline img-upload">-->
|
||||
<!--<div class="upload-img-block icon">-->
|
||||
<!--<div class="upload-img-box" id="redPacket">-->
|
||||
<!--<img src="{:img($recharge.data.cover_img)}" />-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
<input type="hidden" name="recharge_id" value="{$recharge.data.recharge_id}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>面值:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="face_value" lay-verify="required|sum|number" value="{$recharge.data.face_value}" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>价格:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="buy_price" lay-verify="required|sum|number" value="{$recharge.data.buy_price}" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>赠送积分:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="point" lay-verify="required|num|number" value="{$recharge.data.point}" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>赠送成长值:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="growth" lay-verify="required|num|number" value="{$recharge.data.growth}" autocomplete="off" class="layui-input len-short" onblur="checkInput(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">赠送优惠券:</label>
|
||||
<div class="layui-input-block">
|
||||
<div class="coupon-item coupon">
|
||||
<div class="discount-cont">
|
||||
<div><a href="javascript:;" class="text-color" id="select_coupon">选择优惠券</a></div>
|
||||
<div class="word-aux" style="margin-left: 0">
|
||||
<p>活动优惠券发放,不受优惠券自身数量和领取数量的限制</p>
|
||||
</div>
|
||||
<div id="coupon_list"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backMemberRechargeList()">返回</button>
|
||||
<a id="coverImgId"></a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="STATIC_JS/coupon_select.js"></script>
|
||||
<script>
|
||||
var laytpl;
|
||||
var saveData = null;
|
||||
var totalUploadNum = 0;
|
||||
var completeUploadNum = 0;
|
||||
var upload;
|
||||
var coupon_select = new CouponSelect({
|
||||
tableElem:'#coupon_list',
|
||||
selectElem:'#select_coupon',
|
||||
selectedIds:'{$recharge.data.coupon_id}',
|
||||
})
|
||||
|
||||
layui.use(['form', 'laytpl'], function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
laytpl = layui.laytpl;
|
||||
form.render();
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
num: function(value) {
|
||||
if (value < 0 || value % 1 != 0) {
|
||||
return '请输入正整数!';
|
||||
}
|
||||
},
|
||||
number: function (value) {
|
||||
if (value < 0) {
|
||||
return '请输入不小于0的数!'
|
||||
}
|
||||
},
|
||||
sum: function (value) {
|
||||
var arrMen = value.split(".");
|
||||
var val = 0;
|
||||
if (arrMen.length == 2) {
|
||||
val = arrMen[1];
|
||||
}
|
||||
if (val.length > 2) {
|
||||
return '保留小数点后两位'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
upload = new Upload({
|
||||
elem: '#img',
|
||||
auto:false,
|
||||
bindAction:'#coverImgId',
|
||||
callback: function(res) {
|
||||
uploadComplete('cover_img', res.data.pic_path);
|
||||
}
|
||||
});
|
||||
|
||||
function uploadComplete(field, pic_path) {
|
||||
saveData.field[field] = pic_path;
|
||||
completeUploadNum += 1;
|
||||
if(completeUploadNum == totalUploadNum){
|
||||
saveFunc();
|
||||
}
|
||||
}
|
||||
|
||||
function saveFunc(){
|
||||
var data = saveData;
|
||||
// 删除图片
|
||||
if(!data.field.cover_img) upload.delete();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/edit"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
success: function(res){
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function(index, layero){
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/lists");
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
form.on('submit(save)', function(data){
|
||||
data.field.coupon_id = coupon_select.getSelectedData().selectedIds.toString();
|
||||
|
||||
if (repeat_flag) return false;
|
||||
repeat_flag = true;
|
||||
|
||||
saveData = data;
|
||||
var obj = $("img.img_prev[data-prev='1']");
|
||||
totalUploadNum = obj.length;
|
||||
if(totalUploadNum > 0){
|
||||
obj.each(function(){
|
||||
var actionId = $(this).attr('data-action-id');
|
||||
$(actionId).click();
|
||||
})
|
||||
}else{
|
||||
saveFunc();
|
||||
}
|
||||
});
|
||||
form.on('submit(coupon-search)', function(data) {
|
||||
couponTable.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: data.field
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
// 选择优惠
|
||||
$('body').off('click', '.coupon-item .layui-form-checkbox').on('click', '.coupon-item .layui-form-checkbox', function(e){
|
||||
if ($(this).prev('[name="discount_type"]').is(':checked')) {
|
||||
$(this).parents('.coupon-item').find('.discount-cont').removeClass('layui-hide');
|
||||
} else {
|
||||
$(this).parents('.coupon-item').find('.discount-cont').addClass('layui-hide');
|
||||
}
|
||||
})
|
||||
|
||||
function backMemberRechargeList() {
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/lists");
|
||||
}
|
||||
function checkInput(obj){
|
||||
$(obj).val(Math.abs($(obj).val()));
|
||||
}
|
||||
</script>
|
||||
280
addon/memberrecharge/shop/view/memberrecharge/lists.html
Executable file
280
addon/memberrecharge/shop/view/memberrecharge/lists.html
Executable file
@@ -0,0 +1,280 @@
|
||||
<style>
|
||||
.multi-line-hiding .point-left{margin-right: 14px}
|
||||
.layui-layout-admin .table-tab .layui-tab-title{margin-bottom: 15px;}
|
||||
.layui-layout-admin .single-filter-box{padding: 0;}
|
||||
</style>
|
||||
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label sm">开启充值:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="is_use" lay-filter="is_use" value="1" lay-skin="switch" {if !empty($config) && $config.is_use==1 }checked{/if}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 搜索框 -->
|
||||
<div class="single-filter-box">
|
||||
<button class="layui-btn" onclick="add()">添加充值套餐</button>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab" lay-filter="status">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this" data-status="">全部</li>
|
||||
<li data-status="1">正常</li>
|
||||
<li data-status="2">关闭</li>
|
||||
</ul>
|
||||
|
||||
<div class="layui-tab-content">
|
||||
<!-- 列表 -->
|
||||
<table id="charge_list" lay-filter="charge_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 封面 -->
|
||||
<script type="text/html" id="cover_img">
|
||||
<div class="table-title">
|
||||
<!-- <div class="title-pic">-->
|
||||
<!-- <img layer-src src="{{ns.img(d.cover_img.split(',')[0])}}" onerror="this.src = 'SHOP_IMG/goods_empty.gif' "/>-->
|
||||
<!-- </div>-->
|
||||
<div class='title-content'>
|
||||
<p class="multi-line-hiding">面值:{{d.face_value}}</p>
|
||||
<p class="multi-line-hiding">价格:{{d.buy_price}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- 礼包 -->
|
||||
<script type="text/html" id="libao">
|
||||
<p class="multi-line-hiding"><span class="point-left">积分</span>:{{d.point}}</p>
|
||||
<p class="multi-line-hiding">成长值:{{d.growth}}</p>
|
||||
</script>
|
||||
|
||||
<!-- 状态 -->
|
||||
<script type="text/html" id="status">
|
||||
{{d.status == 1 ? '正常' : '关闭'}}
|
||||
</script>
|
||||
|
||||
<!-- 操作 -->
|
||||
<script type="text/html" id="operation">
|
||||
<div class="table-btn">
|
||||
<a class="layui-btn" lay-event="detail">详情</a>
|
||||
<a class="layui-btn" lay-event="card">客户列表</a>
|
||||
<a class="layui-btn" lay-event="del">删除</a>
|
||||
<a class="layui-btn" lay-event="records">充值记录</a>
|
||||
{{# if(d.status == 1){ }}
|
||||
<a class="layui-btn" lay-event="close">关闭</a>
|
||||
{{# }else if(d.status == 2){ }}
|
||||
<a class="layui-btn" lay-event="open">开启</a>
|
||||
{{# } }}
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['form', 'element'], function() {
|
||||
var table,
|
||||
form = layui.form,
|
||||
element = layui.element,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.on('switch(is_use)', function(data) {
|
||||
$.ajax({
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/setConfig"),
|
||||
data: {
|
||||
is_use: (data.elem.checked ? 1 : 0)
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
table = new Table({
|
||||
elem: '#charge_list',
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/lists"),
|
||||
cols: [
|
||||
[{
|
||||
field: 'recharge_name',
|
||||
title: '套餐名称',
|
||||
unresize: 'false',
|
||||
width: '10%'
|
||||
},{
|
||||
title: '套餐信息',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: '#cover_img'
|
||||
}, {
|
||||
field: 'point',
|
||||
title: '礼包信息',
|
||||
unresize: 'false',
|
||||
width: '15%',
|
||||
templet: '#libao'
|
||||
}, {
|
||||
field: 'sale_num',
|
||||
title: '购买数量',
|
||||
unresize: 'false',
|
||||
width: '10%'
|
||||
}, {
|
||||
title: '创建时间',
|
||||
unresize: 'false',
|
||||
width: '20%',
|
||||
templet: function(data) {
|
||||
return ns.time_to_date(data.create_time);
|
||||
}
|
||||
}, {
|
||||
title: '状态',
|
||||
unresize: 'false',
|
||||
width: '10%',
|
||||
templet: '#status'
|
||||
}, {
|
||||
title: '操作',
|
||||
toolbar: '#operation',
|
||||
unresize: 'false',
|
||||
align : 'right'
|
||||
}]
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
//监听Tab切换
|
||||
element.on('tab(status)', function(data) {
|
||||
var status = $(this).attr("data-status");
|
||||
table.reload( {
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
where: {
|
||||
'status': status
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 监听工具栏操作
|
||||
*/
|
||||
table.tool(function(obj) {
|
||||
var data = obj.data;
|
||||
switch (obj.event) {
|
||||
case 'edit': //编辑
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/edit?recharge_id=" + data.recharge_id);
|
||||
break;
|
||||
case 'detail': //详情
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/detail?recharge_id=" + data.recharge_id);
|
||||
break;
|
||||
case 'card': //卡片列表
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/cardlists?recharge_id=" + data.recharge_id);
|
||||
break;
|
||||
case 'records': // 订单列表
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/orderlists?recharge_id=" + data.recharge_id);
|
||||
break;
|
||||
case 'del': //删除
|
||||
deleteMemberRecharge(data.recharge_id);
|
||||
break;
|
||||
case 'close': //关闭
|
||||
invalidMemberRecharge(data.recharge_id);
|
||||
break;
|
||||
case 'open': //开启
|
||||
openMemberRecharge(data.recharge_id);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function deleteMemberRecharge(recharge_id) {
|
||||
layer.confirm('确定要删除该充值套餐吗?', function(index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/delete"),
|
||||
data: {
|
||||
recharge_id: recharge_id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload({
|
||||
page: {
|
||||
curr: 1
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
|
||||
//使失效
|
||||
function invalidMemberRecharge(recharge_id) {
|
||||
|
||||
layer.confirm('确定关闭该充值套餐吗?', function(index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/invalid"),
|
||||
data: {
|
||||
recharge_id: recharge_id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
//使开启
|
||||
function openMemberRecharge(recharge_id) {
|
||||
|
||||
layer.confirm('确定重新开启充值套餐吗?', function(index) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
layer.close(index);
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/open"),
|
||||
data: {
|
||||
recharge_id: recharge_id
|
||||
},
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
layer.msg(res.message);
|
||||
repeat_flag = false;
|
||||
if (res.code == 0) {
|
||||
table.reload();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, function() {
|
||||
layer.close();
|
||||
repeat_flag = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function add() {
|
||||
location.hash = ns.hash("memberrecharge://shop/memberrecharge/add");
|
||||
}
|
||||
</script>
|
||||
107
addon/memberrecharge/shop/view/memberrecharge/order_detail.html
Executable file
107
addon/memberrecharge/shop/view/memberrecharge/order_detail.html
Executable file
@@ -0,0 +1,107 @@
|
||||
<link rel="stylesheet" href="STATIC_CSS/promotion_detail.css">
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">基本信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="promotion-view">
|
||||
<div class="promotion-view-item">
|
||||
<label>订单:</label>
|
||||
<span>{$info.order_no}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>状态:</label>
|
||||
<span>{$info.status == 1 ? '待支付' : '已支付'}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>来源门店:</label>
|
||||
<span>{$info.store_name}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>充值用户:</label>
|
||||
<span>{$info.nickname}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>套餐面值:</label>
|
||||
<span>{$info.face_value}</span>
|
||||
</div>
|
||||
|
||||
<div class="promotion-view-item">
|
||||
<label>金额:</label>
|
||||
<span>{$info.buy_price}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>赠送积分:</label>
|
||||
<span>{$info.point}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>赠送成长值:</label>
|
||||
<span>{$info.growth}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>支付方式:</label>
|
||||
<span>{$info.pay_type_name}</span>
|
||||
</div>
|
||||
<div class="promotion-view-item">
|
||||
<label>支付时间:</label>
|
||||
<span>{:date('Y-m-d H:i:s', $info.pay_time)}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $info.cover_img}
|
||||
<div class="promotion-view" >
|
||||
<div class="promotion-view-item-line">
|
||||
<label class="promotion-view-item-custom-label">横幅图片:</label>
|
||||
<div class="promotion-view-item-custom-box img-upload">
|
||||
<div class="upload-img-block icon">
|
||||
<div class="upload-img-box">
|
||||
<img layer-src src="{:img($info.cover_img)}" >
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if !empty($info.coupon_list)}
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">赠送优惠券</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class='promotion-view-list'>
|
||||
<table id="promotion_list"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<script>
|
||||
var promotion_list = {if !empty($info.coupon_list)} {:json_encode($info.coupon_list.data, JSON_UNESCAPED_UNICODE)}{else/}[] {/if};
|
||||
|
||||
layui.use('table', function() {
|
||||
new Table({
|
||||
elem: '#promotion_list',
|
||||
cols: [
|
||||
[{
|
||||
field: 'coupon_name',
|
||||
title: '优惠券',
|
||||
width: '20%',
|
||||
}, {
|
||||
title: '优惠内容',
|
||||
templet: function(data) {
|
||||
if(data.at_least > 0){
|
||||
return '满'+data.at_least+ (data.type == 'discount' ? '打'+data.discount +'折' : '减'+data.money) ;
|
||||
}else{
|
||||
return '无门槛'+ (data.type == 'discount' ? '打'+data.discount+'折' : '减' +data.money);
|
||||
}
|
||||
}
|
||||
}]
|
||||
],
|
||||
data: promotion_list
|
||||
});
|
||||
});
|
||||
</script>
|
||||
293
addon/memberrecharge/shop/view/memberrecharge/order_lists.html
Executable file
293
addon/memberrecharge/shop/view/memberrecharge/order_lists.html
Executable file
@@ -0,0 +1,293 @@
|
||||
<link rel="stylesheet" href="MEMBERRECHARGE_CSS/order_list.css"/>
|
||||
<div class="layui-card card-common card-brief panel-content">
|
||||
<div class="layui-card-header simple">
|
||||
<span class="card-title">充值概况</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="content">
|
||||
<p class="title">累计充值金额</p>
|
||||
<p class="money">{$order_money}</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p class="title">累计充值次数</p>
|
||||
<p class="money">{$order_num}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="screen layui-collapse" lay-filter="selection_panel">
|
||||
<div class="layui-colla-item">
|
||||
<form class="layui-form layui-colla-content layui-form layui-show" lay-filter="order_list" action="javascript:;">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">订单号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="order_no" placeholder="请输入订单号">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">客户昵称</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="nickname" placeholder="请输入客户昵称">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if addon_is_exit('store') == 1}
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">来源门店</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="store_id" lay-filter="store_id">
|
||||
<option value="">全部</option>
|
||||
{foreach $store_list as $k => $v}
|
||||
<option value="{$v.store_id}">{$v.store_name}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">支付时间</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="start_time" placeholder="开始时间" id="start_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<div class="layui-form-mid">-</div>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" class="layui-input" name="end_time" placeholder="结束时间" id="end_time" readonly>
|
||||
<i class=" iconrili iconfont calendar"></i>
|
||||
</div>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn" onclick="datePick(7, this);return false;">近7天</button>
|
||||
<button class="layui-btn layui-btn-primary date-picker-btn" onclick="datePick(30, this);return false;">近30天</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="search">筛选</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-tab table-tab " lay-filter="order_tab">
|
||||
<div class="layui-tab-content">
|
||||
<div id="order_list"></div>
|
||||
</div>
|
||||
<div id="order_page"></div>
|
||||
</div>
|
||||
|
||||
<script src="MEMBERRECHARGE_JS/order_list.js"></script>
|
||||
<script>
|
||||
var form,laypage,element,laydate;
|
||||
var is_refresh = false;
|
||||
var printer_addon_is_exit = '{$printer_addon_is_exit}';
|
||||
|
||||
layui.use(['laypage','laydate','form', 'element'], function(){
|
||||
form = layui.form;
|
||||
laypage = layui.laypage;
|
||||
element = layui.element;
|
||||
laydate = layui.laydate;
|
||||
form.render();
|
||||
|
||||
// 支付时间
|
||||
laydate.render({
|
||||
elem: '#start_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
laydate.render({
|
||||
elem: '#end_time'
|
||||
,type: 'datetime'
|
||||
,change: function(value, date, endDate){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
}
|
||||
});
|
||||
|
||||
//监听Tab切换,以改变地址hash值
|
||||
element.on('tab(order_tab)', function(){
|
||||
$(".all-selected-checkbox input").prop("checked",false);
|
||||
var hash_data = getHashList();
|
||||
hash_data.page = 1;
|
||||
setHashOrderList(hash_data);
|
||||
});
|
||||
|
||||
//监听筛选事件
|
||||
form.on('submit(search)', function(data){
|
||||
is_refresh = true;
|
||||
data.field.page = 1;
|
||||
setHashOrderList(data.field);
|
||||
return false;
|
||||
});
|
||||
getHashData();
|
||||
getOrderList();//筛选
|
||||
});
|
||||
|
||||
function setHashOrderList(data){
|
||||
localStorage.setItem('formSubmit','search'); // 表单搜索标识,防止页面重新加载
|
||||
var hash = ['url=memberrecharge://shop/memberrecharge/orderlists'];
|
||||
for (let key in data) {
|
||||
if (data[key] != '' && data[key] != 'all') {
|
||||
hash.push(`${key}=${data[key]}`)
|
||||
}
|
||||
}
|
||||
location.hash = hash.join('&');
|
||||
getOrderList();
|
||||
}
|
||||
|
||||
var order = new Order();
|
||||
function getOrderList(){
|
||||
var url = ns.url("memberrecharge://shop/memberrecharge/orderlists", getHashArr().join('&'));
|
||||
$.ajax({
|
||||
type : 'get',
|
||||
dataType: 'json',
|
||||
url :url,
|
||||
success : function(res){
|
||||
if(res.code == 0){
|
||||
order.setData(res.data);
|
||||
$("#order_list").html(order.fetch());
|
||||
form.render();
|
||||
|
||||
laypage_util = new Page({
|
||||
elem: 'order_page',
|
||||
count: res.data.count,
|
||||
curr: getHashPage(),
|
||||
limit:getHashData()['page_size'] || 10,
|
||||
callback: function(obj){
|
||||
var hash_data = getHashData();
|
||||
hash_data.page = obj.curr;
|
||||
hash_data.page_size = obj.limit;
|
||||
setHashOrderList(hash_data);
|
||||
}
|
||||
});
|
||||
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 通过hash获取页数
|
||||
function getHashPage(){
|
||||
var page = 1;
|
||||
var startTime = '';
|
||||
var endTime = '';
|
||||
var hash_arr = getHashArr();
|
||||
$.each(hash_arr,function(index, itemobj){
|
||||
var item_arr = itemobj.split("=");
|
||||
if(item_arr.length == 2){
|
||||
switch(item_arr[0]){
|
||||
case "page":
|
||||
page = item_arr[1];
|
||||
break;
|
||||
case "start_time":
|
||||
startTime = ns.date_to_time(item_arr[1].split("%")[0]);
|
||||
break;
|
||||
case "end_time":
|
||||
endTime = ns.date_to_time(item_arr[1].split("%")[0]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var _time = (endTime - startTime) / (24 * 60 * 60);
|
||||
if (_time == 6) {
|
||||
$(".date-picker-btn-seven").addClass("selected");
|
||||
$(".date-picker-btn-thirty").removeClass("selected");
|
||||
} else if (_time == 29) {
|
||||
$(".date-picker-btn-thirty").addClass("selected");
|
||||
$(".date-picker-btn-seven").removeClass("selected");
|
||||
} else {
|
||||
$(".date-picker-btn-seven").removeClass("selected");
|
||||
$(".date-picker-btn-thirty").removeClass("selected");
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
//从hash中获取数据
|
||||
function getHashData(){
|
||||
var hash_arr = getHashArr();
|
||||
var form_json = {
|
||||
"start_time" : "",
|
||||
"end_time" : "",
|
||||
"nickname" : "",
|
||||
"order_no" : "",
|
||||
'page_size':'',
|
||||
"page" : ""
|
||||
};
|
||||
if(hash_arr.length > 0){
|
||||
$.each(hash_arr,function(index, itemobj){
|
||||
var item_arr = itemobj.split("=");
|
||||
if(item_arr.length == 2){
|
||||
$.each(form_json,function(key, form_val){
|
||||
if(item_arr[0] == key){
|
||||
form_json[key] = item_arr[1];
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return form_json;
|
||||
}
|
||||
function getHashList(){
|
||||
var hash_arr = getHashArr();
|
||||
var form_json = {
|
||||
"start_time" : "",
|
||||
"end_time" : "",
|
||||
"nickname" : "",
|
||||
"order_no" : "",
|
||||
'page_size':'',
|
||||
"page" : ""
|
||||
};
|
||||
if(hash_arr.length > 0){
|
||||
$.each(hash_arr,function(index, itemobj){
|
||||
var item_arr = itemobj.split("=");
|
||||
if(item_arr.length == 2){
|
||||
$.each(form_json,function(key, form_val){
|
||||
if(item_arr[0].indexOf(key) != "-1"){
|
||||
form_json[key] = item_arr[1];
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return form_json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 七天时间
|
||||
*/
|
||||
function datePick(date_num,event_obj){
|
||||
$(".date-picker-btn").removeClass("selected");
|
||||
$(event_obj).addClass('selected');
|
||||
Date.prototype.Format = function (fmt,date_num) { //author: meizz
|
||||
this.setDate(this.getDate()-date_num);
|
||||
var o = {
|
||||
"M+": this.getMonth() + 1, //月份
|
||||
"d+": this.getDate(), //日
|
||||
"H+": this.getHours(), //小时
|
||||
"m+": this.getMinutes(), //分
|
||||
"s+": this.getSeconds(), //秒
|
||||
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
|
||||
"S": this.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
};
|
||||
var now_time = new Date().Format("yyyy-MM-dd 23:59:59",0);//当前日期
|
||||
var before_time = new Date().Format("yyyy-MM-dd 00:00:00",date_num-1);//前几天日期
|
||||
$("input[name=start_time]").val(before_time,0);
|
||||
$("input[name=end_time]").val(now_time,date_num-1);
|
||||
}
|
||||
|
||||
</script>
|
||||
80
addon/memberrecharge/shop/view/public/css/order_list.css
Executable file
80
addon/memberrecharge/shop/view/public/css/order_list.css
Executable file
@@ -0,0 +1,80 @@
|
||||
.layui-table {margin-top: 15px;}
|
||||
.layui-table thead tr {background-color: #F8F6F9;}
|
||||
.layui-table th {border-width: 0; font-size: 14px!important;}
|
||||
.layui-table td {padding: 8px 15px;}
|
||||
.layui-table .header-row {border-top: 1px solid #e6e6e6;background: #f7f7f7;}
|
||||
.layui-table .header-row:hover{background: #f7f7f7 !important;}
|
||||
.separation-row hr {margin: 0;}
|
||||
|
||||
.layui-table td,.layui-table th,.layui-table-fixed-r,.layui-table-header,.layui-table-page,.layui-table-tips-main,.layui-table-tool,.layui-table-view,.layui-table[lay-skin=line],.layui-table[lay-skin=row]{border-color:#f1f1f1 !important;}
|
||||
.layui-table thead th{border-bottom:none;padding-left:0;padding-right:0;}
|
||||
.order-list-table .separation-row td{padding:10px 20px;border: 0;}
|
||||
.order-list-table .separation-row:hover{background-color: #fff;}
|
||||
.order-list-table .header-row td{padding: 8px 15px!important;}
|
||||
.order-list-table .header-row td:nth-child(1){border-right: 0;}
|
||||
.order-list-table .header-row td:nth-child(2){text-align:center;border-left: 0;}
|
||||
.order-list-table .header-row span{vertical-align:middle}
|
||||
.order-list-table .header-row td .order-item-header{text-align:left;color:#333;}
|
||||
.order-list-table .header-row td .order-item-header.more{cursor: pointer;overflow: hidden;position: relative;}
|
||||
.order-list-table .header-row td .more-operation{display: none;font-size: 14px;line-height: 20px;background-color: #fff;border-radius: 2px;box-shadow: 0 2px 8px 0 rgba(200,201,204,.5);position: absolute;z-index: 2000;padding: 10px;top: 28px;transform: translateX(10px);left: -12px;width: 200px;}
|
||||
.order-list-table .header-row td .more-operation:before{left: 8px;top: -14px;border: solid transparent;content: "";height: 0;width: 0;position: absolute;pointer-events: none;border-color: transparent;border-bottom-color: #fff;border-width: 8px;}
|
||||
.order-list-table .header-row td .more-operation span{color:#333;}
|
||||
|
||||
.order-list-table .checkbox-all .layui-table-cell{padding:0;text-align:center;}
|
||||
.order-list-table .product-info .layui-table-cell{padding:0 5px}
|
||||
.order-list-table .content-row:hover{background-color:#fff !important;}
|
||||
.order-list-table .content-row .product-info{border-right: 0;}
|
||||
.order-list-table .content-row .product-info .img-block{width:60px;height:60px;float:left;border:1px solid #e2e2e2;display: flex;align-items: center;justify-content: center;}
|
||||
.order-list-table .content-row .product-info .img-block>img{max-width:100%;max-height:100%;}
|
||||
.order-list-table .content-row .product-info .info{margin-left:70px}
|
||||
.order-list-table .content-row .product-info .info p{color:#8e8c8c;font-size:12px}
|
||||
.order-list-table .content-row .order-price{border-left: 0;}
|
||||
.order-list-table .content-row .product-list{border-right-width:1px}
|
||||
.order-list-table .content-row .product-list p{font-size:12px}
|
||||
.order-list-table .content-row .transaction-status{line-height: 24px;}
|
||||
.order-list-table .content-row .buyers{line-height: 24px;}
|
||||
.order-list-table .operation a{font-size: 14px;}
|
||||
.order-list-table .text-tile{color:rgb(164,164,164);}
|
||||
.order-no-data-block ul{width:200px;margin:20px auto; padding-bottom: 20px;}
|
||||
.order-no-data-block ul li{text-align:center;color:#c2c2c2}
|
||||
.order-no-data-block ul li:first-child{height:70px;line-height:70px}
|
||||
.order-no-data-block ul li:first-child i{font-size:35px}
|
||||
.footer-row{border:1px solid #f2f2f2}
|
||||
.screen{margin-top: 0;}
|
||||
|
||||
/*.order-money span {color: red;}*/
|
||||
#order_page {text-align: right;}
|
||||
.bottom-row{color:#e0a723;background: #fffbec;}
|
||||
.bottom-row:hover{background: #fffbec!important;}
|
||||
|
||||
.table-tab .layui-tab-content {padding-top: 0;}
|
||||
.line-hiding{ cursor : default; -webkit-line-clamp: 2 !important;}
|
||||
.address_box{width:87%; display: inline-block}
|
||||
.address_input{width: 1px;height: 0px;overflow: hidden;border: 0px}
|
||||
.screen .layui-colla-title .layui-colla-icon{color:var(--base-color) !important}
|
||||
.screen .layui-colla-title .text-color{position: absolute;right: 45px;font-size: 14px;padding: 5px;}
|
||||
.operation .operation-type{display: block;}
|
||||
.operation .operation-type .layui-btn{display: inline;text-align: left;line-height: 23px;padding: 0px;margin: 0px;padding-left:8px;}
|
||||
.layui-colla-title .put-open{position: absolute;right: 40px;padding: 5px;color: var(--base-color) ;}
|
||||
|
||||
/*订单顶部的一行*/
|
||||
.order-list-top-line{justify-content:flex-end;}
|
||||
.order-list-top-line a{padding-right: 0px !important;}
|
||||
|
||||
.order-list-table .order-goods{align-items: flex-start !important;}
|
||||
.order-list-table .order-goods .info{margin-top: 3px;}
|
||||
.order-list-table .order-goods , .order-list-table .order-goods-item{display: flex;align-items: center;}
|
||||
.order-list-table .order-goods .img-block{margin-right: 10px;width: 60px;height: 60px;flex-shrink: 0;border: 1px solid #e2e2e2;display: flex;align-items: center;justify-content: center;}
|
||||
.order-list-table .order-goods .img-block{width: 105px;height: 63px;}
|
||||
.order-list-table .order-goods .img-block img{max-width: 100%;max-height: 100%;}
|
||||
.order-list-table .order-goods-item{margin-top: 10px;}
|
||||
.content-row .order-price {
|
||||
border-left: 0;
|
||||
}
|
||||
.content-row .card-info {
|
||||
border-right: 0;
|
||||
}
|
||||
|
||||
.layui-card-body .content{width: 50%;}
|
||||
.layui-layout-admin .screen{margin-bottom: 15px;}
|
||||
.layui-layout-admin .layui-form-item .layui-input-inline{background-color: #fff;}
|
||||
285
addon/memberrecharge/shop/view/public/js/order_list.js
Executable file
285
addon/memberrecharge/shop/view/public/js/order_list.js
Executable file
@@ -0,0 +1,285 @@
|
||||
/**
|
||||
* 渲染订单列表
|
||||
*/
|
||||
Order = function () {};
|
||||
|
||||
/**
|
||||
* 设置数据集
|
||||
*/
|
||||
Order.prototype.setData = function (data) {
|
||||
Order.prototype.data = data;
|
||||
};
|
||||
|
||||
/**
|
||||
* 列名数据
|
||||
*/
|
||||
Order.prototype.cols = [
|
||||
{
|
||||
type: 'checkbox',
|
||||
fixed: 'left',
|
||||
width: '3%',
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var json = {};
|
||||
json.order_id = order.order_id;
|
||||
json.order_no = order.order_no;
|
||||
var h = '<div class="sub-selected-checkbox" data-json='+ JSON.stringify(json) +' data-id='+ order.order_id +' >';
|
||||
h += '<input type="checkbox" lay-skin="primary" lay-filter="subCheckbox" name="" >';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '<span>套餐信息</span>',
|
||||
width: "25%",
|
||||
className: "card-info",
|
||||
template: function (orderitem, order) {
|
||||
var h = '';
|
||||
h += '<div class="order-goods">';
|
||||
// h += '<div class="img-block">';
|
||||
// h += '<img layer-src="' + ns.img(orderitem.cover_img.split(",")[0]) + '" src="' + ns.img(orderitem.cover_img.split(",")[0]) + '">';
|
||||
// h += '</div>';
|
||||
h += '<div class="info">';
|
||||
h += '<div>'+orderitem.recharge_name+'</div>';
|
||||
h += '</div>';
|
||||
h += '</div>';
|
||||
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "面值(元) / 数量",
|
||||
width: "8%",
|
||||
align: "right",
|
||||
className: "order-price",
|
||||
template: function (orderitem, order) {
|
||||
var h = '<div style="padding-right: 15px;">';
|
||||
h += '<div>';
|
||||
h += '<span>面值' + orderitem.face_value + '</span>';
|
||||
h += '</div>';
|
||||
h += '<div>';
|
||||
h += '<span>1件</span>';
|
||||
h += '</div>';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "赠送礼包",
|
||||
width: "15%",
|
||||
align: "left",
|
||||
className: "give_gift",
|
||||
template: function (orderitem, order) {
|
||||
var h = '';
|
||||
h += '<div class="order-goods">';
|
||||
h += '<div class="info">';
|
||||
h += '<div>积分:'+orderitem.point+'</div>';
|
||||
h += '<div>成长值:'+orderitem.growth+'</div>';
|
||||
h += '</div>';
|
||||
h += '</div>';
|
||||
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "实付金额(元)",
|
||||
width: "8%",
|
||||
align: "right",
|
||||
className: "order-money",
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var h = '<div style="padding-right: 15px;">';
|
||||
h += '<span>' + orderitem.price + '</span>';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "买家",
|
||||
width: "10%",
|
||||
align: "center",
|
||||
className: "member",
|
||||
template: function (orderitem, order) {
|
||||
var h = '<div style="text-align: center;">';
|
||||
h += '<a href="' + ns.href("shop/member/editmember", {member_id: orderitem.member_id}) + '" target="_blank" class="multi-line-hiding text-color-sub text-color">' +orderitem.nickname + '</a>';
|
||||
h += '';
|
||||
h += '</div>';
|
||||
return h;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "来源门店",
|
||||
width: "9%",
|
||||
align: "center",
|
||||
className: "transaction-status",
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var html = '<div>' + order.store_name + '</div>';
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "支付状态",
|
||||
width: "10%",
|
||||
align: "center",
|
||||
className: "transaction-status",
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var html = '<div>' + (order.status == 2 ? '已支付' : '未支付') + '</div>';
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
title : "支付时间",
|
||||
width : "15%",
|
||||
align : "center",
|
||||
className : "create-time",
|
||||
merge : true,
|
||||
template : function(orderitem,order){
|
||||
return '<div>' + ns.time_to_date(order.pay_time) + '</div>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: "right",
|
||||
className: "operation",
|
||||
width: "10%",
|
||||
merge: true,
|
||||
template: function (orderitem, order) {
|
||||
var html = '';
|
||||
html += '<div>';
|
||||
html += '<a class="layui-btn text-color" href="' + ns.href("memberrecharge://shop/memberrecharge/orderdetail", {order_id: orderitem.order_id}) + '" target="_blank">详情</a>';
|
||||
if(printer_addon_is_exit == 1) {
|
||||
html += '<a class="layui-btn text-color" href="javascript:printTicket(' + orderitem.order_id + ')">打印小票</a>';
|
||||
}
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
}
|
||||
];
|
||||
/**
|
||||
* 渲染表头
|
||||
*/
|
||||
Order.prototype.header = function (hasThead) {
|
||||
var colgroup = '<colgroup>';
|
||||
var thead = '';
|
||||
if (hasThead) thead = '<thead><tr>';
|
||||
|
||||
for (var i = 0; i < this.cols.length; i++) {
|
||||
var align = this.cols[i].align ? "text-align:" + this.cols[i].align : "";
|
||||
|
||||
colgroup += '<col width="' + this.cols[i].width + '">';
|
||||
if (hasThead) {
|
||||
thead += '<th style="' + align + '" class="' + (this.cols[i].className || "") + '">';
|
||||
thead += '<div class="layui-table-cell">';
|
||||
if(this.cols[i].type){
|
||||
thead += '<div class="all-selected-checkbox">';
|
||||
thead += '<input type="checkbox" lay-skin="primary" lay-filter="allCheckbox" name="">';
|
||||
thead += '</div>';
|
||||
}else{
|
||||
thead += this.cols[i].title;
|
||||
}
|
||||
thead += '</div>';
|
||||
thead += '</th>';
|
||||
}
|
||||
}
|
||||
colgroup += '</colgroup>';
|
||||
if (hasThead) thead += '</tr></thead>';
|
||||
return colgroup + thead;
|
||||
};
|
||||
|
||||
/**
|
||||
* 渲染内容
|
||||
*/
|
||||
Order.prototype.tbody = function () {
|
||||
|
||||
var tbody = '<tbody>';
|
||||
for (var i = 0; i < this.data.list.length; i++) {
|
||||
|
||||
var order = this.data.list[i];
|
||||
if (i > 0) {
|
||||
//分割行
|
||||
tbody += '<tr class="separation-row">';
|
||||
tbody += '<td colspan="' + this.cols.length + '"></td>';
|
||||
tbody += '</tr>';
|
||||
}
|
||||
|
||||
//订单项头部
|
||||
tbody += '<tr class="header-row">';
|
||||
tbody += '<td colspan="10">';
|
||||
tbody += '<span class="order-item-header" style="margin-right:10px;">订单号:' + order.order_no + '</span>';
|
||||
tbody += '<span class="order-item-header text-color more" style="margin-right:50px;" onclick="showMore(' + order.order_id + ')">更多';
|
||||
tbody += '<div class="more-operation" data-order-id="' + order.order_id + '">';
|
||||
tbody += '<span>支付流水号:' + order.out_trade_no + '</span>';
|
||||
tbody += '</div></span>';
|
||||
|
||||
tbody += '<span class="order-item-header" style="margin-right:50px;">下单时间:' + ns.time_to_date(order.create_time) + '</span>';
|
||||
tbody += '<span class="order-item-header" style="margin-right:50px;">订单来源:'+ order.order_from_name +'</span>';
|
||||
tbody += '<span class="order-item-header" style="margin-right:50px;">支付方式:'+ order.pay_type_name +'</span>';
|
||||
|
||||
tbody += '</td>';
|
||||
tbody += '</tr>';
|
||||
|
||||
var orderitemHtml = '';
|
||||
loadImgMagnify();
|
||||
orderitemHtml += '<tr class="content-row">';
|
||||
for (var k = 0; k < this.cols.length; k++) {
|
||||
orderitemHtml += '<td class="' + (this.cols[k].className || "") + '" align="' + (this.cols[k].align || "") + '" style="' + (this.cols[k].style || "") + '" rowspan="' + order.length + '">';
|
||||
orderitemHtml += this.cols[k].template(order, order);
|
||||
orderitemHtml += '</td>';
|
||||
}
|
||||
orderitemHtml += '</tr>';
|
||||
|
||||
tbody += orderitemHtml;
|
||||
|
||||
}
|
||||
|
||||
tbody += '</tbody>';
|
||||
return tbody;
|
||||
};
|
||||
|
||||
/**
|
||||
* 渲染表格
|
||||
*/
|
||||
Order.prototype.fetch = function () {
|
||||
if (this.data.list.length > 0) {
|
||||
return '<table class="layui-table layui-form">' + this.header(true) + '</table><table class="layui-table order-list-table layui-form">' + this.header(false) + this.tbody() + '</table>';
|
||||
} else {
|
||||
return '<table class="layui-table order-list-table layui-form">' + this.header(true) + '</table>' + '<div class="order-no-data-block"><ul><li><i class="layui-icon layui-icon-tabs"></i> </li><li>暂无订单</li></ul></div>';
|
||||
}
|
||||
};
|
||||
|
||||
function showMore(order_id) {
|
||||
$(".more-operation[data-order-id]").hide();
|
||||
$(".more-operation[data-order-id='" + order_id + "']").show();
|
||||
$("body").bind('click',function (e) {
|
||||
if (!$(e.target).closest(".order-item-header.more").length) {
|
||||
$(".more-operation[data-order-id='" + order_id + "']").hide();
|
||||
$("body").unbind('click');
|
||||
}
|
||||
});
|
||||
}
|
||||
$(".layui-colla-title").on("click", function(){
|
||||
if($(".layui-colla-title>i").hasClass("layui-icon-down") === false && $(".layui-colla-title>i").hasClass("layui-icon-up") === false){
|
||||
$(".layui-colla-title .put-open").html("展开");
|
||||
}else if($(".layui-colla-title>i").hasClass("layui-icon-down") === true){
|
||||
$(".layui-colla-title .put-open").html("展开");
|
||||
}else if($(".layui-colla-title>i").hasClass("layui-icon-up") === true){
|
||||
$(".layui-colla-title .put-open").html("收起");
|
||||
}
|
||||
})
|
||||
|
||||
// 打印订单小票
|
||||
function printTicket(order_id){
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
url: ns.url("memberrecharge://shop/memberrecharge/printTicket"),
|
||||
data: {order_id},
|
||||
success: function (res) {
|
||||
if (res.code != 0) {
|
||||
layer.msg(res.message ? res.message : '小票打印失败');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
38
addon/memberrecharge/shop/view/template/printer_template.html
Executable file
38
addon/memberrecharge/shop/view/template/printer_template.html
Executable file
@@ -0,0 +1,38 @@
|
||||
<style>
|
||||
.recharge-box .layui-card-header .layui-form-switch{
|
||||
margin-top: -4px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
</style>
|
||||
<div class="layui-card card-common card-brief recharge-box">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">充值打印
|
||||
<input type="checkbox" name="recharge_open" lay-filter="recharge_open" value="1" lay-skin="switch" {if empty($printer_info) || $printer_info['recharge_open']} checked {/if} />
|
||||
</span>
|
||||
</div>
|
||||
<div class="layui-card-body recharge-content">
|
||||
<div class="layui-form-item express_company recharge_item {if !empty($printer_info) && $printer_info['recharge_open'] == 0}layui-hide{/if}">
|
||||
<label class="layui-form-label"><span class="required">*</span>打印模板:</label>
|
||||
<div class="layui-input-block len-short">
|
||||
<select name="recharge_template_id" lay-filter="recharge_template_id" {if empty($printer_info) || $printer_info['recharge_open'] }lay-verify="required"{/if}>
|
||||
<option value="">请选择</option>
|
||||
{foreach $template_list as $k=>$v}
|
||||
{if $v['type'] == 'recharge'}
|
||||
<option value="{$v.template_id}" {if !empty($printer_info) && $printer_info['recharge_template_id'] == $v['template_id']} selected {/if}>{$v.template_name}</option>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item recharge_item {if !empty($printer_info) && $printer_info['recharge_open'] == 0}layui-hide{/if}">
|
||||
<label class="layui-form-label"><span class="required">*</span>打印联数:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" name="recharge_print_num" value="1" {if empty($printer_info) || $printer_info['recharge_print_num'] == 1} checked {/if} lay-verify="required" autocomplete="off" title="1" class="layui-input len-long">
|
||||
<input type="radio" name="recharge_print_num" value="2" {if !empty($printer_info) && $printer_info['recharge_print_num'] == 2} checked {/if} lay-verify="required" autocomplete="off" title="2" class="layui-input len-long">
|
||||
<input type="radio" name="recharge_print_num" value="3" {if !empty($printer_info) && $printer_info['recharge_print_num'] == 3} checked {/if} lay-verify="required" autocomplete="off" title="3" class="layui-input len-long">
|
||||
<input type="radio" name="recharge_print_num" value="4" {if !empty($printer_info) && $printer_info['recharge_print_num'] == 4} checked {/if} lay-verify="required" autocomplete="off" title="4" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
493
addon/memberrecharge/shop/view/template/recharge_template.html
Executable file
493
addon/memberrecharge/shop/view/template/recharge_template.html
Executable file
@@ -0,0 +1,493 @@
|
||||
<style>
|
||||
.printer-box{display: flex;}
|
||||
.printer-box > .layui-form{flex: 1;}
|
||||
.printer-box .preview{width: 310px;margin: 0 20px;}
|
||||
.printer-box .preview .layui-card-body{margin: 20px;padding: 0 10px;border: 1px solid #ededed;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;}
|
||||
.printer-box .preview .layui-card-body div{font-size: 12px;color: #333;}
|
||||
.printer-box .preview .layui-card-body div ~ div{border-top: 1px dashed #ededed ;}
|
||||
.printer-box .preview .receipt-name{text-align: center;line-height: 40px;}
|
||||
.printer-box .preview .shopping-name{line-height: 40px;font-size: 16px !important;text-align: center;}
|
||||
.printer-box .preview .order-info, .printer-box .preview .goods-info, .printer-box .preview .price-info, .printer-box .preview .buyer-info, .printer-box .preview .shopping-info{padding: 8px 0;}
|
||||
.printer-box .preview .order-info span{display: block;line-height: 2.5;}
|
||||
.printer-box .preview .goods-info table{width: 100%;}
|
||||
.printer-box .preview .goods-info table tr{line-height: 2.5;}
|
||||
.printer-box .preview .goods-info table th{font-weight: normal;}
|
||||
.printer-box .preview .price-info p{display: flex;line-height: 2.5;justify-content: space-between;}
|
||||
.printer-box .preview .buyer-info span, .printer-box .preview .shopping-info span{display: block;line-height: 2;}
|
||||
.printer-box .preview .buyer-message,.printer-box .preview .merchant-message{padding: 10px 0;line-height: 1.5;}
|
||||
.preview .button-info{height: 40px;line-height: 40px;text-align: center}
|
||||
.preview .shopping-code{text-align: center;}
|
||||
.preview .shopping-code img{width: 100px;height: 100px;margin: 10px 0;}
|
||||
.commodity-type-box{
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.commodity-type-item{
|
||||
margin-right: 15px;
|
||||
padding: 0px 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
border: 1px solid #e5e5e5;
|
||||
cursor: pointer;
|
||||
/* background: #e5e5e5; */
|
||||
}
|
||||
.goods_code_show td{line-height: 1;padding-bottom: 5px}
|
||||
</style>
|
||||
|
||||
<div class="layui-collapse tips-wrap">
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title">操作提示</h2>
|
||||
<ul class="layui-colla-content layui-show">
|
||||
<li>管理员可以在此页操作打印模板</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="printer-box">
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-card card-common card-brief">
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">模板信息</span>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
{if empty($info)}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>模板类型:</label>
|
||||
<div class="layui-input-block commodity-type-box">
|
||||
{foreach $template_type as $k => $v}
|
||||
<div class="commodity-type-item {if $type == $k} border-color{/if}" onclick="location.hash = ns.hash('printer://shop/template/add', {'type' : '{$v['type']}'})">
|
||||
<span class="{if $type == $k} text-color{/if}">{$v['type_name']}</span>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="type_name" value="{$template_type[$type]['type_name']}">
|
||||
<input type="hidden" name="type" value="{$type}">
|
||||
{/if}
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required"></span>模板名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="template_name" lay-verify="required" {if !empty($info)} value="{$info['template_name']}" {/if} autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-card card-common card-brief">
|
||||
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">打印信息</span>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-body">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">小票名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" {if !empty($info)} value="{$info['title']}"{else/} value="小票名称" {/if} lay-verify="required" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商城名称:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="radio" lay-filter="shop_name" name="head" value="1" title="显示" {if (!empty($info) && $info['head'] == 1) || empty($info) } checked {/if} autocomplete="off" class="layui-input len-long">
|
||||
<input type="radio" lay-filter="shop_name" name="head" value="0" title="不显示" {if !empty($info) && !$info['head']} checked {/if} autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">买家信息:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="buy_name" value="1" lay-filter="buyer_name" lay-skin="primary" title="姓名" {if (!empty($info) && $info['buy_name']) || empty($info) } checked {/if}>
|
||||
<!-- <input type="checkbox" name="buy_mobile" value="1" lay-filter="buyer_phone" lay-skin="primary" title="联系方式" {if (!empty($info) && $info['buy_mobile']) || empty($info) } checked {/if}>-->
|
||||
<!-- <input type="checkbox" name="buy_address" value="1" lay-filter="buyer_addres" lay-skin="primary" title="地址" {if (!empty($info) && $info['buy_address']) || empty($info) } checked {/if}>-->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商城信息:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="shop_mobile" value="1" lay-filter="shopping_phone" lay-skin="primary" title="联系方式" {if (!empty($info) && $info['shop_mobile'])} checked {/if}>
|
||||
<input type="checkbox" name="shop_address" value="1" lay-filter="shopping_addres" lay-skin="primary" title="地址" {if (!empty($info) && $info['shop_address'])} checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">商城二维码:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="shop_qrcode" value="1" lay-filter="shop_qrcode" lay-skin="primary" title="商城二维码" {if (!empty($info) && $info['shop_qrcode']) || empty($info) } checked {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item qrcode_url">
|
||||
<label class="layui-form-label"><span class="required">*</span>商城二维码链接:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="qrcode_url" lay-verify="required" autocomplete="off" class="layui-input len-long" {if (!empty($info) && $info['qrcode_url'])} value="{$info['qrcode_url']}" {/if}>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">底部信息:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="bottom" {if (!empty($info) && $info['bottom'])} value="{$info['bottom']}"{else /} value="谢谢惠顾,欢迎下次光临" {/if} lay-verify="required" placeholder="" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{if !empty($info)}
|
||||
<input type="hidden" name="template_id" value="{$info['template_id']}">
|
||||
{/if}
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backPrinterTemplateList()">返回</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preview">
|
||||
<div class="layui-card card-common card-brief">
|
||||
|
||||
<div class="layui-card-header">
|
||||
<span class="card-title">预览图</span>
|
||||
</div>
|
||||
|
||||
<div class="layui-card-body">
|
||||
<div class="receipt-name">小票名称</div>
|
||||
<div class="shopping-name">商城名称</div>
|
||||
<div class="order-info">
|
||||
<span>订单编号:ME20180702231831547866</span>
|
||||
<span>支付方式:微信支付</span>
|
||||
</div>
|
||||
<div class="goods-info">
|
||||
|
||||
<div class="price-info">
|
||||
<p>
|
||||
<span>充值金额</span>
|
||||
<span>¥100</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>支付金额</span>
|
||||
<span>¥95</span>
|
||||
</p>
|
||||
<p>
|
||||
<span>会员余额</span>
|
||||
<span>¥230</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="buyer-message">买家留言:物流很快</div>
|
||||
<div class="merchant-message layui-hide">卖家留言:欢迎下次购买</div>
|
||||
|
||||
<div class="buyer-info">
|
||||
<span class="name">会员:王二</span>
|
||||
<!-- <span class="phone">15135669878</span>-->
|
||||
<!-- <span class="addres">山西省 太原市 小店区 创业街</span>-->
|
||||
</div>
|
||||
<div class="shopping-info layui-hide">
|
||||
<span class="phone layui-hide">4008867993 </span>
|
||||
<span class="addres layui-hide">山西省 太原市 小店区 创业街 世纪中心4单元1025</span>
|
||||
</div>
|
||||
<div class="shopping-code">
|
||||
<img src="SHOP_IMG/shopping_code.png" alt="">
|
||||
</div>
|
||||
<div class="button-info">谢谢惠顾,欢迎下次光临</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use(['form'], function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false;
|
||||
|
||||
form.render();
|
||||
|
||||
/**
|
||||
* 表单验证
|
||||
*/
|
||||
form.verify({
|
||||
time: function(value) {
|
||||
var now_time = (new Date()).getTime();
|
||||
var start_time = (new Date($("#start_time").val())).getTime();
|
||||
var end_time = (new Date(value)).getTime();
|
||||
if (now_time > end_time) {
|
||||
return '结束时间不能小于当前时间!'
|
||||
}
|
||||
if (start_time > end_time) {
|
||||
return '结束时间不能小于开始时间!';
|
||||
}
|
||||
},
|
||||
flnum: function(value) {
|
||||
var arrMen = value.split(".");
|
||||
var val = 0;
|
||||
if (arrMen.length == 2) {
|
||||
val = arrMen[1];
|
||||
}
|
||||
if (val.length > 2) {
|
||||
return '保留小数点后两位!'
|
||||
}
|
||||
},
|
||||
int: function(value) {
|
||||
if (value <= 1 || value % 1 != 0) {
|
||||
return '请输入大于1的正整数!'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
form.on('checkbox(shop_qrcode)', function(data){
|
||||
|
||||
var value = data.elem.checked;
|
||||
if(value == true){
|
||||
$(".preview .shopping-code").removeClass("layui-hide");
|
||||
$(".qrcode_url").removeClass('layui-hide');
|
||||
$("input[name='qrcode_url']").attr("lay-verify", "required");
|
||||
}else{
|
||||
$(".preview .shopping-code").addClass("layui-hide");
|
||||
$(".qrcode_url").addClass('layui-hide');
|
||||
$("input[name='qrcode_url']").attr("lay-verify", "");
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 表单提交
|
||||
*/
|
||||
form.on('submit(save)', function(data){
|
||||
var field = data.field;
|
||||
if(repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
let url = ns.url("printer://shop/template/add");
|
||||
if(parseInt(field.template_id) > 0 ) url = ns.url("printer://shop/template/edit");
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'JSON',
|
||||
url: url,
|
||||
data: field,
|
||||
async: false,
|
||||
success: function(res){
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('操作成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '{$info ? "继续编辑" : "继续添加"}'],
|
||||
closeBtn: 0,
|
||||
yes: function(index, layero) {
|
||||
location.hash = ns.hash("printer://shop/template/lists");
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
listenerHash(); // 刷新页面
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
// 小票打印
|
||||
$("input[name='title']").bind("input propertychange",function(event){
|
||||
$(".preview .receipt-name").text($("input[name='title']").val());
|
||||
});
|
||||
|
||||
//商城名称
|
||||
form.on('radio(shop_name)', function(data){
|
||||
if (parseInt(data.value)) $(".shopping-name").removeClass("layui-hide");
|
||||
else $(".shopping-name").addClass("layui-hide");
|
||||
});
|
||||
//商品价格
|
||||
form.on('checkbox(goods_price_show)', function(data){
|
||||
if (data.elem.checked) {
|
||||
$(".goods_price_show").removeClass("layui-hide");
|
||||
$('.goods_price_type').removeClass("layui-hide");
|
||||
}else {
|
||||
$('.goods_price_type').addClass("layui-hide");
|
||||
$(".goods_price_show").addClass("layui-hide");
|
||||
}
|
||||
});
|
||||
//商品编码
|
||||
form.on('checkbox(goods_code_show)', function(data){
|
||||
if (data.elem.checked) $(".goods_code_show").removeClass("layui-hide");
|
||||
else $(".goods_code_show").addClass("layui-hide");
|
||||
});
|
||||
//表单
|
||||
form.on('checkbox(form_show)', function(data){
|
||||
if (data.elem.checked) $(".form_show").removeClass("layui-hide");
|
||||
else $(".form_show").addClass("layui-hide");
|
||||
});
|
||||
//买家留言
|
||||
form.on('checkbox(buyer_message)', function(data){
|
||||
if(data.elem.checked)
|
||||
$(".buyer-message").removeClass("layui-hide");
|
||||
else
|
||||
$(".buyer-message").addClass("layui-hide");
|
||||
});
|
||||
//卖家留言
|
||||
form.on('checkbox(merchant_message)', function(data){
|
||||
if(data.elem.checked)
|
||||
$(".merchant-message").removeClass("layui-hide");
|
||||
else
|
||||
$(".merchant-message").addClass("layui-hide");
|
||||
});
|
||||
|
||||
var buyerName = true,buyerPhone=true,buyerAddres=true;
|
||||
//买家姓名
|
||||
form.on('checkbox(buyer_name)', function(data){
|
||||
buyerName = data.elem.checked;
|
||||
|
||||
if(data.elem.checked)
|
||||
$(".buyer-info .name").removeClass("layui-hide");
|
||||
else
|
||||
$(".buyer-info .name").addClass("layui-hide");
|
||||
|
||||
buyerFn();
|
||||
});
|
||||
//买家手机号
|
||||
form.on('checkbox(buyer_phone)', function(data){
|
||||
buyerPhone = data.elem.checked;
|
||||
|
||||
if(data.elem.checked)
|
||||
$(".buyer-info .phone").removeClass("layui-hide");
|
||||
else
|
||||
$(".buyer-info .phone").addClass("layui-hide");
|
||||
|
||||
buyerFn();
|
||||
});
|
||||
//买家地址
|
||||
form.on('checkbox(buyer_addres)', function(data){
|
||||
buyerAddres= data.elem.checked;
|
||||
if(data.elem.checked)
|
||||
$(".buyer-info .addres").removeClass("layui-hide");
|
||||
else
|
||||
$(".buyer-info .addres").addClass("layui-hide");
|
||||
buyerFn();
|
||||
});
|
||||
|
||||
function buyerFn() {
|
||||
if (!buyerName )
|
||||
$(".buyer-info").addClass("layui-hide");
|
||||
else
|
||||
$(".buyer-info").removeClass("layui-hide");
|
||||
}
|
||||
|
||||
var shoppingPhone=false,shoppingAddress=false;
|
||||
//商家手机号
|
||||
form.on('checkbox(shopping_phone)', function(data){
|
||||
shoppingPhone = data.elem.checked;
|
||||
|
||||
if(data.elem.checked)
|
||||
$(".shopping-info .phone").removeClass("layui-hide");
|
||||
else
|
||||
$(".shopping-info .phone").addClass("layui-hide");
|
||||
|
||||
shoppingFn();
|
||||
});
|
||||
//商家地址
|
||||
form.on('checkbox(shopping_addres)', function(data){
|
||||
shoppingAddress= data.elem.checked;
|
||||
|
||||
if(data.elem.checked)
|
||||
$(".shopping-info .addres").removeClass("layui-hide");
|
||||
else
|
||||
$(".shopping-info .addres").addClass("layui-hide");
|
||||
shoppingFn();
|
||||
});
|
||||
|
||||
function shoppingFn() {
|
||||
if (!shoppingPhone && !shoppingAddress)
|
||||
$(".shopping-info").addClass("layui-hide");
|
||||
else
|
||||
$(".shopping-info").removeClass("layui-hide");
|
||||
}
|
||||
|
||||
// 底部信息
|
||||
$("input[name='bottom']").bind("input propertychange",function(event){
|
||||
$(".preview .button-info").text($("input[name='bottom']").val());
|
||||
});
|
||||
});
|
||||
|
||||
function backPrinterTemplateList() {
|
||||
location.hash = ns.hash("printer://shop/template/lists");
|
||||
}
|
||||
|
||||
</script>
|
||||
{if !empty($info)}
|
||||
<script>
|
||||
var shop_qrcode = {$info['shop_qrcode']};
|
||||
if(shop_qrcode){
|
||||
$(".preview .shopping-code").removeClass("layui-hide");
|
||||
$(".qrcode_url").removeClass('layui-hide');
|
||||
$("input[name='qrcode_url']").attr("lay-verify", "required");
|
||||
}else{
|
||||
$(".preview .shopping-code").addClass("layui-hide");
|
||||
$(".qrcode_url").addClass('layui-hide');
|
||||
$("input[name='qrcode_url']").attr("lay-verify", "");
|
||||
}
|
||||
|
||||
var head = {$info['head']};
|
||||
if (head) {
|
||||
$(".shopping-name").removeClass("layui-hide");
|
||||
}else {
|
||||
$(".shopping-name").addClass("layui-hide");
|
||||
}
|
||||
|
||||
var goods_price_show = {$info['goods_price_show']};
|
||||
if (goods_price_show) {
|
||||
$(".goods_price_show").removeClass("layui-hide");
|
||||
$('.goods_price_type').removeClass("layui-hide");
|
||||
}else {
|
||||
$('.goods_price_type').addClass("layui-hide");
|
||||
$(".goods_price_show").addClass("layui-hide");
|
||||
}
|
||||
|
||||
var goods_code_show = {$info['goods_code_show']};
|
||||
if (goods_code_show) $(".goods_code_show").removeClass("layui-hide");
|
||||
else $(".goods_code_show").addClass("layui-hide");
|
||||
|
||||
var form_show = {$info['form_show']};
|
||||
if (form_show) $(".form_show").removeClass("layui-hide");
|
||||
else $(".form_show").addClass("layui-hide");
|
||||
|
||||
var buy_notes = {$info['buy_notes']};
|
||||
if(buy_notes) $(".buyer-message").removeClass("layui-hide");
|
||||
else $(".buyer-message").addClass("layui-hide");
|
||||
|
||||
var seller_notes = {$info['seller_notes']};
|
||||
if(seller_notes) $(".merchant-message").removeClass("layui-hide");
|
||||
else $(".merchant-message").addClass("layui-hide");
|
||||
|
||||
buyerName = {$info['buy_name']},buyerPhone={$info['buy_mobile']},buyerAddres={$info['buy_address']};
|
||||
if(buyerName) $(".buyer-info .name").removeClass("layui-hide");
|
||||
else $(".buyer-info .name").addClass("layui-hide");
|
||||
|
||||
if(buyerPhone) $(".buyer-info .phone").removeClass("layui-hide");
|
||||
else $(".buyer-info .phone").addClass("layui-hide");
|
||||
|
||||
if(buyerAddres) $(".buyer-info .addres").removeClass("layui-hide");
|
||||
else $(".buyer-info .addres").addClass("layui-hide");
|
||||
|
||||
if (!buyerName ) $(".buyer-info").addClass("layui-hide");
|
||||
else $(".buyer-info").removeClass("layui-hide");
|
||||
|
||||
shoppingPhone= {$info['shop_mobile']},shoppingAddress= {$info['shop_address']};
|
||||
|
||||
//商家手机号
|
||||
if(shoppingPhone)$(".shopping-info .phone").removeClass("layui-hide");
|
||||
else $(".shopping-info .phone").addClass("layui-hide");
|
||||
|
||||
//商家地址
|
||||
if(shoppingAddress) $(".shopping-info .addres").removeClass("layui-hide");
|
||||
else $(".shopping-info .addres").addClass("layui-hide");
|
||||
|
||||
if (!shoppingPhone && !shoppingAddress) $(".shopping-info").addClass("layui-hide");
|
||||
else $(".shopping-info").removeClass("layui-hide");
|
||||
|
||||
</script>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user