...
|
...
|
@@ -12,6 +12,7 @@ use PhpOffice\PhpSpreadsheet\Reader\Csv; |
|
|
use think\exception\PDOException;
|
|
|
use app\admin\library\Auth;
|
|
|
use think\Db;
|
|
|
use PhpOffice\PhpSpreadsheet\Cell\DataType;
|
|
|
/**
|
|
|
* 会员注册管理
|
|
|
*
|
...
|
...
|
@@ -198,6 +199,15 @@ class Registers extends Backend |
|
|
$values = [];
|
|
|
for ($currentColumn = 1; $currentColumn <= $maxColumnNumber; $currentColumn++) {
|
|
|
$val = $currentSheet->getCellByColumnAndRow($currentColumn, $currentRow)->getValue();
|
|
|
$cell = $currentSheet->getCellByColumnAndRow($currentColumn,$currentRow);
|
|
|
if($cell->getDataType() == DataType::TYPE_NUMERIC){
|
|
|
$cellstyleformat = $cell->getStyle($cell->getCoordinate())->getNumberFormat();
|
|
|
$formatcode = $cellstyleformat->getFormatCode();
|
|
|
if (preg_match('/^(\[\$[A-Z]*-[0-9A-F]*\])*[hmsdy]/i', $formatcode)) {
|
|
|
// $val = strtotime(gmdate("Y-m-d H:i:s", $currentSheet->ExcelToPHP($val)));
|
|
|
$val = AdminCommon::getDateByFloatValue($val);
|
|
|
}
|
|
|
}
|
|
|
$values[] = is_null($val) ? '' : $val;
|
|
|
}
|
|
|
$row = [];
|
...
|
...
|
@@ -235,7 +245,7 @@ class Registers extends Backend |
|
|
$row['id'] = $res1['id'];
|
|
|
}
|
|
|
//根据手机号查询会员注册id
|
|
|
$res = Db::name('registers')->where('mobile',$values[7])->field('id')->find();
|
|
|
$res = Db::name('registers')->where('mobile',$values[5])->field('id')->find();
|
|
|
if($res){
|
|
|
$row['r_id'] = $res['id'];
|
|
|
}else{
|
...
|
...
|
@@ -244,7 +254,7 @@ class Registers extends Backend |
|
|
}
|
|
|
if ($row) {
|
|
|
if($row['r_id'] != 0){
|
|
|
//如果订单金额为空,则视为该条数据为空
|
|
|
//如果订单编号为空,则视为该条数据为空
|
|
|
if(isset($row['order_sn']) && !empty($row['order_sn'])){
|
|
|
$insert[] = $row;
|
|
|
}
|
...
|
...
|
@@ -326,4 +336,40 @@ class Registers extends Backend |
|
|
$fileName = "套餐订单列表";//文件名
|
|
|
AdminCommon::exportExcel($expTitle,$expCellName,$expTableData,$fileName);
|
|
|
}
|
|
|
|
|
|
//导出服务列表excel
|
|
|
public function export1(){//导出Excel
|
|
|
$ids = $this->request->param('s_ids');
|
|
|
if(!$ids){
|
|
|
return;
|
|
|
}
|
|
|
$ids = explode(',',$ids);
|
|
|
$expTableData = Common::selectWhereData('service_order',['r_id'=>['in',$ids]],'r_id,order_sn,customer_name,service_time,service_content,service_name,assess,mark','id asc');
|
|
|
//查询手机号
|
|
|
$r_ids = array_unique(array_column($expTableData,'r_id'));
|
|
|
$res_mobile = Common::selectWhereData('registers',['id'=>['in',$r_ids]],'id,mobile');
|
|
|
$expCellName = [
|
|
|
['order_sn','服务订单编号',20],
|
|
|
['customer_name','客户姓名',10],
|
|
|
['service_time','服务时间',20],
|
|
|
['service_content','服务项目',30],
|
|
|
['service_name','服务员',10],
|
|
|
['mobile','VIP手机号',20],
|
|
|
['assess','评价',30],
|
|
|
['mark','备注',40],
|
|
|
];
|
|
|
|
|
|
foreach ($expTableData as &$v) {
|
|
|
$v['mobile'] = '';
|
|
|
foreach ($res_mobile as $value){
|
|
|
if($v['r_id'] == $value['id']){
|
|
|
$v['mobile'] = $value['mobile'];
|
|
|
}
|
|
|
}
|
|
|
$v['service_time'] = date('Y-m-d H:i:s',$v['service_time']);
|
|
|
}
|
|
|
$expTitle = "服务订单列表";
|
|
|
$fileName = "服务订单列表";//文件名
|
|
|
AdminCommon::exportExcel($expTitle,$expCellName,$expTableData,$fileName);
|
|
|
}
|
|
|
} |
...
|
...
|
|