Browse Source

更新option

gary
10994015 1 year ago
parent
commit
074a4bb4e5
  1. 3
      wms/contract/composer.json
  2. 567
      wms/contract/composer.lock
  3. 165
      wms/contract/insertData.php
  4. 1
      wms/contract/js/alpine.js
  5. BIN
      wms/mkt/assets/img/1.jpg
  6. BIN
      wms/mkt/assets/img/2.jpg
  7. BIN
      wms/mkt/assets/img/3.jpg
  8. BIN
      wms/mkt/assets/img/4.jpg
  9. BIN
      wms/mkt/assets/img/5.jpg
  10. BIN
      wms/mkt/assets/img/S__14541066.jpg
  11. BIN
      wms/mkt/assets/img/curry.jpg
  12. 72
      wms/mkt/assets/js/alpine.js
  13. 43
      wms/mkt/conn.php
  14. 75
      wms/mkt/css/style.css
  15. 1
      wms/mkt/css/style.css.map
  16. 71
      wms/mkt/css/style.scss
  17. 135
      wms/mkt/price_option-index.php
  18. 87
      wms/mkt/price_option-index2.php
  19. 47
      wms/mkt/price_option-select.php

3
wms/contract/composer.json

@ -12,6 +12,7 @@
} }
], ],
"require": { "require": {
"tecnickcom/tcpdf": "^6.6" "tecnickcom/tcpdf": "^6.6",
"phpoffice/phpspreadsheet": "^1.29"
} }
} }

567
wms/contract/composer.lock

@ -4,8 +4,573 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "c5a277735def820cc2b17b4a2b30976d", "content-hash": "f9ceea0f00278e84ee8bc939092d4886",
"packages": [ "packages": [
{
"name": "ezyang/htmlpurifier",
"version": "v4.17.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/bbc513d79acf6691fa9cf10f192c90dd2957f18c",
"reference": "bbc513d79acf6691fa9cf10f192c90dd2957f18c",
"shasum": ""
},
"require": {
"php": "~5.6.0 || ~7.0.0 || ~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
},
"require-dev": {
"cerdic/css-tidy": "^1.7 || ^2.0",
"simpletest/simpletest": "dev-master"
},
"suggest": {
"cerdic/css-tidy": "If you want to use the filter 'Filter.ExtractStyleBlocks'.",
"ext-bcmath": "Used for unit conversion and imagecrash protection",
"ext-iconv": "Converts text to and from non-UTF-8 encodings",
"ext-tidy": "Used for pretty-printing HTML"
},
"type": "library",
"autoload": {
"files": [
"library/HTMLPurifier.composer.php"
],
"psr-0": {
"HTMLPurifier": "library/"
},
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/v4.17.0"
},
"time": "2023-11-17T15:01:25+00:00"
},
{
"name": "maennchen/zipstream-php",
"version": "3.1.0",
"source": {
"type": "git",
"url": "https://github.com/maennchen/ZipStream-PHP.git",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/maennchen/ZipStream-PHP/zipball/b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"reference": "b8174494eda667f7d13876b4a7bfef0f62a7c0d1",
"shasum": ""
},
"require": {
"ext-mbstring": "*",
"ext-zlib": "*",
"php-64bit": "^8.1"
},
"require-dev": {
"ext-zip": "*",
"friendsofphp/php-cs-fixer": "^3.16",
"guzzlehttp/guzzle": "^7.5",
"mikey179/vfsstream": "^1.6",
"php-coveralls/php-coveralls": "^2.5",
"phpunit/phpunit": "^10.0",
"vimeo/psalm": "^5.0"
},
"suggest": {
"guzzlehttp/psr7": "^2.4",
"psr/http-message": "^2.0"
},
"type": "library",
"autoload": {
"psr-4": {
"ZipStream\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Paul Duncan",
"email": "pabs@pablotron.org"
},
{
"name": "Jonatan Männchen",
"email": "jonatan@maennchen.ch"
},
{
"name": "Jesse Donat",
"email": "donatj@gmail.com"
},
{
"name": "András Kolesár",
"email": "kolesar@kolesar.hu"
}
],
"description": "ZipStream is a library for dynamically streaming dynamic zip files from PHP without writing to the disk at all on the server.",
"keywords": [
"stream",
"zip"
],
"support": {
"issues": "https://github.com/maennchen/ZipStream-PHP/issues",
"source": "https://github.com/maennchen/ZipStream-PHP/tree/3.1.0"
},
"funding": [
{
"url": "https://github.com/maennchen",
"type": "github"
},
{
"url": "https://opencollective.com/zipstream",
"type": "open_collective"
}
],
"time": "2023-06-21T14:59:35+00:00"
},
{
"name": "markbaker/complex",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPComplex.git",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"reference": "95c56caa1cf5c766ad6d65b6344b807c1e8405b9",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Complex\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@lange.demon.co.uk"
}
],
"description": "PHP Class for working with complex numbers",
"homepage": "https://github.com/MarkBaker/PHPComplex",
"keywords": [
"complex",
"mathematics"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPComplex/issues",
"source": "https://github.com/MarkBaker/PHPComplex/tree/3.0.2"
},
"time": "2022-12-06T16:21:08+00:00"
},
{
"name": "markbaker/matrix",
"version": "3.0.1",
"source": {
"type": "git",
"url": "https://github.com/MarkBaker/PHPMatrix.git",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/MarkBaker/PHPMatrix/zipball/728434227fe21be27ff6d86621a1b13107a2562c",
"reference": "728434227fe21be27ff6d86621a1b13107a2562c",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"phpcompatibility/php-compatibility": "^9.3",
"phpdocumentor/phpdocumentor": "2.*",
"phploc/phploc": "^4.0",
"phpmd/phpmd": "2.*",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"sebastian/phpcpd": "^4.0",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "library",
"autoload": {
"psr-4": {
"Matrix\\": "classes/src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mark Baker",
"email": "mark@demon-angel.eu"
}
],
"description": "PHP Class for working with matrices",
"homepage": "https://github.com/MarkBaker/PHPMatrix",
"keywords": [
"mathematics",
"matrix",
"vector"
],
"support": {
"issues": "https://github.com/MarkBaker/PHPMatrix/issues",
"source": "https://github.com/MarkBaker/PHPMatrix/tree/3.0.1"
},
"time": "2022-12-02T22:17:43+00:00"
},
{
"name": "phpoffice/phpspreadsheet",
"version": "1.29.0",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"reference": "fde2ccf55eaef7e86021ff1acce26479160a0fa0",
"shasum": ""
},
"require": {
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
"ext-zip": "*",
"ext-zlib": "*",
"ezyang/htmlpurifier": "^4.15",
"maennchen/zipstream-php": "^2.1 || ^3.0",
"markbaker/complex": "^3.0",
"markbaker/matrix": "^3.0",
"php": "^7.4 || ^8.0",
"psr/http-client": "^1.0",
"psr/http-factory": "^1.0",
"psr/simple-cache": "^1.0 || ^2.0 || ^3.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-main",
"dompdf/dompdf": "^1.0 || ^2.0",
"friendsofphp/php-cs-fixer": "^3.2",
"mitoteam/jpgraph": "^10.3",
"mpdf/mpdf": "^8.1.1",
"phpcompatibility/php-compatibility": "^9.3",
"phpstan/phpstan": "^1.1",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^8.5 || ^9.0 || ^10.0",
"squizlabs/php_codesniffer": "^3.7",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
"dompdf/dompdf": "Option for rendering PDF with PDF Writer",
"ext-intl": "PHP Internationalization Functions",
"mitoteam/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers",
"mpdf/mpdf": "Option for rendering PDF with PDF Writer",
"tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "https://blog.maartenballiauw.be"
},
{
"name": "Mark Baker",
"homepage": "https://markbakeruk.net"
},
{
"name": "Franck Lefevre",
"homepage": "https://rootslabs.net"
},
{
"name": "Erik Tilt"
},
{
"name": "Adrien Crivelli"
}
],
"description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "https://github.com/PHPOffice/PhpSpreadsheet",
"keywords": [
"OpenXML",
"excel",
"gnumeric",
"ods",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"support": {
"issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
"source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.29.0"
},
"time": "2023-06-14T22:48:31+00:00"
},
{
"name": "psr/http-client",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-client.git",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90",
"reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90",
"shasum": ""
},
"require": {
"php": "^7.0 || ^8.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Client\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP clients",
"homepage": "https://github.com/php-fig/http-client",
"keywords": [
"http",
"http-client",
"psr",
"psr-18"
],
"support": {
"source": "https://github.com/php-fig/http-client"
},
"time": "2023-09-23T14:17:50+00:00"
},
{
"name": "psr/http-factory",
"version": "1.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-factory.git",
"reference": "e616d01114759c4c489f93b099585439f795fe35"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
"reference": "e616d01114759c4c489f93b099585439f795fe35",
"shasum": ""
},
"require": {
"php": ">=7.0.0",
"psr/http-message": "^1.0 || ^2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory/tree/1.0.2"
},
"time": "2023-04-10T20:10:41+00:00"
},
{
"name": "psr/http-message",
"version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/2.0"
},
"time": "2023-04-04T09:54:51+00:00"
},
{
"name": "psr/simple-cache",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/simple-cache.git",
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865",
"reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865",
"shasum": ""
},
"require": {
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\SimpleCache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
}
],
"description": "Common interfaces for simple caching",
"keywords": [
"cache",
"caching",
"psr",
"psr-16",
"simple-cache"
],
"support": {
"source": "https://github.com/php-fig/simple-cache/tree/3.0.0"
},
"time": "2021-10-29T13:26:27+00:00"
},
{ {
"name": "tecnickcom/tcpdf", "name": "tecnickcom/tcpdf",
"version": "6.6.5", "version": "6.6.5",

165
wms/contract/insertData.php

@ -0,0 +1,165 @@
<?php
require_once('./conn.php');
require 'vendor/autoload.php';
ini_set ( 'date.timezone' , 'Asia/Taipei' );
$id = $_GET['id'];
use PhpOffice\PhpSpreadsheet\IOFactory;
// 指定要讀取的 Excel 文件
$filePath = './option/option'.$id.'.xlsx';
// 嘗試讀取文件
try {
$spreadsheet = IOFactory::load($filePath);
} catch (\PhpOffice\PhpSpreadsheet\Reader\Exception $e) {
die('Error loading file: ' . $e->getMessage());
}
// 獲取活動工作表
$sheet = $spreadsheet->getActiveSheet();
$create_at = date('Y-m-d H:i:s');
$sql_str = "INSERT INTO option_price (kind, subkind, group_name, spec, memo, optional, unit, price, status, create_at) VALUES (:kind, :subkind, :group_name, :spec, :memo, :optional, :unit, :price, :status, :create_at)";
$sql_str_mi = "INSERT INTO option_mi (option_price_id, min_weight, max_weight, open_kind, base_floor, base_floor_plus, price, quotation_no, create_at) VALUES (:option_price_id, :min_weight, :max_weight, :open_kind, :base_floor, :base_floor_plus, :price, :quotation_no, :create_at)";
$open_kind_arr = ['CO', '2S'];
// 遍歷工作表中的每一行
foreach ($sheet->getRowIterator() as $key=>$row) {
// 獲得單元格迭代器
$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(false); // This loops through all cells,
// even if a cell value is not set.
// By default, only cells that have a value set will be iterated.
foreach ($cellIterator as $idx=>$cell) {
if ($cell !== null) {
// 打印單元格數據
// echo $cell->getValue() . '///';
}
if($idx == 'B'){
$group_name = $cell->getValue();
echo $group_name;
}elseif($idx == 'C'){
$spec = $cell->getValue();
echo $spec;
}elseif($idx == 'D'){
$memo = $cell->getValue();
echo $memo;
}elseif($idx == 'E'){
if($cell->getValue() == "標配"){
$optional = 1;
}else{
$optional = 2;
}
echo $optional;
}elseif($idx == 'F'){
$cost = $cell->getValue();
}
elseif($idx == 'G'){
$price = $cell->getValue();
echo $price;
}elseif($idx == 'H'){
$unit = $cell->getValue();
echo $unit;
}
}
echo "<br>"; // 換行,以分隔不同的行
$status = "Y";
$kindArr = ['A', 'B','C', 'D'];
if($id == 1){
$kind = 'A';
$subkind = 'A1';
}elseif($id == 2){
$kind = 'B';
$subkind = 'B1';
}elseif($id == 3){
$kind = 'B';
$subkind = 'B2';
}elseif($id == 4){
$kind ='B';
$subkind = 'B3';
}elseif($id == 5){
$kind ='B';
$subkind = 'B4';
}elseif($id == 6){
$kind ='B';
$subkind = 'B5';
}elseif($id == 7){
$kind ='B';
$subkind = 'B6';
}elseif($id == 8){
$kind ='B';
$subkind = 'B7';
}elseif($id == 9){
$kind ='C';
$subkind = 'C1';
}elseif($id == 10){
$kind ='C';
$subkind = 'C2';
}elseif($id == 11){
$kind ='C';
$subkind = 'C3';
}elseif($id == 12){
$kind ='C';
$subkind = 'C4';
}elseif($id == 13){
$kind ='D';
$subkind = 'D1';
}elseif($id == 14){
$kind ='D';
$subkind = 'D2';
}
if(isset($_GET['id'])){
try{
$stmt = $conn -> prepare($sql_str);
$stmt ->bindParam(':kind', $kind);
$stmt ->bindParam(':subkind', $subkind);
$stmt ->bindParam(':group_name', $group_name);
$stmt ->bindParam(':spec', $spec);
$stmt ->bindParam(':memo', $memo);
$stmt ->bindParam(':optional', $optional);
$stmt ->bindParam(':unit', $unit);
$stmt ->bindParam(':price', $price);
$stmt ->bindParam(':status', $status);
$stmt ->bindParam(':create_at', $create_at);
// 遍歷當前行的每一個單元格
$stmt ->execute();
$last_id = $conn->lastInsertId();
$option_price_id = $last_id;
$option_price = $cost;
$quotation_no = 'Q2311001';
foreach($open_kind_arr as $kind){
$min_weight = 1;
$max_weight = 1600;
$open_kind = $kind;
$base_floor = 0;
$base_floor_plus = 0;
$sale_price = $option_price;
$stmt = $conn -> prepare($sql_str_mi);
$stmt ->bindParam(':option_price_id', $option_price_id);
$stmt ->bindParam(':min_weight', $min_weight);
$stmt ->bindParam(':max_weight', $max_weight);
$stmt ->bindParam(':open_kind', $open_kind);
$stmt ->bindParam(':base_floor', $base_floor);
$stmt ->bindParam(':base_floor_plus', $base_floor_plus);
$stmt ->bindParam(':price', $sale_price);
$stmt ->bindParam(':quotation_no', $quotation_no);
$stmt ->bindParam(':create_at', $create_at);
$stmt ->execute();
}
}catch(PDOException $e){
echo $e->getMessage();
die('Error!:'.$e->getMessage());
}
}
}
?>

1
wms/contract/js/alpine.js

@ -1169,7 +1169,6 @@ const contractInput =()=> {
this.data.files = e.target.files this.data.files = e.target.files
}, },
} }
}; };
const contractNewApply = ()=>{ const contractNewApply = ()=>{

BIN
wms/mkt/assets/img/1.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

BIN
wms/mkt/assets/img/2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

BIN
wms/mkt/assets/img/3.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
wms/mkt/assets/img/4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

BIN
wms/mkt/assets/img/5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
wms/mkt/assets/img/S__14541066.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

BIN
wms/mkt/assets/img/curry.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

72
wms/mkt/assets/js/alpine.js

@ -0,0 +1,72 @@
const priceOptionIndex = ()=>{
return {
init(){
console.log(this.kind);
this.initButtons(this.kind);
},
kind: kind,
pageLength: 999999,
search: '',
orioptions: options,
options: options,
options_arr: {
1:'標',
2:'選',
},
btntype:'',
buttons:[],
initButtons(kind){
if(kind == 'A'){
this.buttons = [
{name: '車廂意匠', type: 'A1'}
]
}else if(kind == 'B'){
this.buttons = [
{name: '天井', type: 'B1'},
{name: '地板', type: 'B2'},
{name: '操縱盤', type: 'B3'},
{name: '扶手', type: 'B4'},
{name: '車廂門與層門(轎門/層門)', type: 'B5'},
{name: '轎壁(車廂側板)', type: 'B6'},
{name: '其他車廂內裝配件', type: 'B7'},
]
}else if(kind == 'C'){
this.buttons = [
{name: '框', type: 'C1'},
{name: '乘場指示器', type: 'C2'},
{name: '燈', type: 'C3'},
{name: '方式與門', type: 'C4'},
]
}else if(kind == 'D'){
this.buttons = [
{name: '功能與配置', type: 'D1'},
{name: 'OH與樓高', type: 'D2'},
]
}
this.buttons.unshift({
name:'顯示全部',type:'1',
})
this.btntype = this.buttons[0].type;
},
changeType(type = this.btntype){
this.btntype = type
this.options = this.orioptions;
this.options = this.getOptions();
this.inputSearch()
},
getOptions(){
if(this.btntype != 1){
return this.options.filter(item=>(item.subkind == this.btntype)).slice(0, this.pageLength)
}
return this.options.slice(0, this.pageLength);
},
inputSearch(e=null){
let text = e!=null ? e.target.value : this.search;
this.search = text
this.options = this.orioptions
this.options = this.getOptions().filter(item=>{
return (item.group_name.includes(text))
})
}
}
}

43
wms/mkt/conn.php

@ -0,0 +1,43 @@
<?php
$envFile = __DIR__ . '/.env'; // .env 文件的路径
if (file_exists($envFile)) {
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if ($lines !== false) {
foreach ($lines as $line) {
list($key, $value) = explode('=', $line, 2);
$key = trim($key);
$value = trim($value);
// 设置环境变量
putenv("$key=$value");
}
}
}
$db_hostname = 'localhost'; //資料庫主機名稱
$db_username = 'masadaroot'; //登入資料庫的管理者的帳號
$db_password = 'x6h5E5p#u8y'; //登入密碼
$db_name = 'appwms'; //使用的資料庫
$db_charset = 'utf8'; //設定字元編碼
//建立PDO的指定工作
$dsn = "mysql:host=$db_hostname;dbname=$db_name;charset=$db_charset";
try{
//使用PDO連接到MySQL資料庫,建立PDO物件
$conn = new PDO($dsn, $db_username, $db_password);
//當錯誤發生時會將錯誤資訊放到一個類物件裡(PDOException)
//PDO異常處理,PDO::ATTR_ERRMODE,有以下三種值的設定
//PDO::ERRMODE_SILENT: 預設模式,不主動報錯,需要以$conn->errorInfo()的形式獲取錯誤資訊
//PDO::ERRMODE_WARNING: 引發 E_WARNING 錯誤,主動報錯
//PDO::ERRMODE_EXCEPTION: 主動抛出 exceptions 異常,需要以try{}cath(){}輸出錯誤資訊。
//設定主動以警告的形式報錯
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
//如果連接錯誤,將抛出一個PDOException異常對象
}
catch ( PDOException $e ){
//如果連結資料庫失敗則顯示錯誤訊並停止本頁的工作
die("ERROR!!!: ". $e->getMessage());
}
//$conn = null; //關閉資料庫的連線

75
wms/mkt/css/style.css

@ -0,0 +1,75 @@
.price_option-select {
width: 100%;
max-width: 1200px;
margin: 0 auto;
display: flex;
}
.price_option-select > .sidebar {
width: 10%;
min-width: 180px;
height: 100%;
min-height: 80vh;
display: flex;
flex-direction: column;
border-right: 1px #ccc solid;
}
.price_option-select > .sidebar > a {
margin: 6px 0;
transition: 0.3s;
}
.price_option-select > .sidebar > a:hover {
color: #00b;
}
.price_option-select > .content {
display: grid;
grid-template-columns: repeat(3, 33.3%);
grid-row-gap: 12px;
grid-column-gap: 12px;
}
.price_option-select > .content > a {
width: 100%;
display: block;
height: 300px;
position: relative;
}
.price_option-select > .content > a:hover > div {
opacity: 1;
}
.price_option-select > .content > a > img {
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
}
.price_option-select > .content > a > div {
opacity: 0;
transition: 0.3s;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.7);
}
.price_option-select > .content > a > div p {
color: #fff;
font-size: 17px;
font-weight: 600;
}
.price_option-index {
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.btn-secondary {
background-color: #6C757D;
}
.text-light {
color: #fff;
}/*# sourceMappingURL=style.css.map */

1
wms/mkt/css/style.css.map

@ -0,0 +1 @@
{"version":3,"sources":["style.scss","style.css"],"names":[],"mappings":"AAAA;EACI,WAAA;EACA,iBAAA;EACA,cAAA;EACA,aAAA;ACCJ;ADAI;EACI,UAAA;EACA,gBAAA;EACA,YAAA;EACA,gBAAA;EACA,aAAA;EACA,sBAAA;EACA,4BAAA;ACER;ADDQ;EACI,aAAA;EACA,gBAAA;ACGZ;ADFY;EACI,WAAA;ACIhB;ADAI;EACI,aAAA;EACA,uCAAA;EACA,kBAAA;EACA,qBAAA;ACER;ADDQ;EACI,WAAA;EACA,cAAA;EACA,aAAA;EACA,kBAAA;ACGZ;ADFY;EACI,UAAA;ACIhB;ADFY;EACI,WAAA;EACA,YAAA;EACA,oBAAA;KAAA,iBAAA;ACIhB;ADFY;EACI,UAAA;EACA,gBAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,uBAAA;EACA,mBAAA;EACA,kBAAA;EACA,MAAA;EACA,QAAA;EACA,oCAAA;ACIhB;ADHgB;EACI,WAAA;EACA,eAAA;EACA,gBAAA;ACKpB;;ADCA;EACI,WAAA;EACA,iBAAA;EACA,cAAA;ACEJ;;ADAA;EACI,yBAAA;ACGJ;;ADDA;EACI,WAAA;ACIJ","file":"style.css"}

71
wms/mkt/css/style.scss

@ -0,0 +1,71 @@
.price_option-select{
width: 100%;
max-width: 1200px;
margin: 0 auto;
display: flex;
>.sidebar{
width: 10%;
min-width: 180px;
height: 100%;
min-height: 80vh;
display: flex;
flex-direction: column;
border-right:1px #ccc solid;
>a{
margin:6px 0;
transition: .3s;
&:hover{
color:#00b;
}
}
}
>.content{
display: grid;
grid-template-columns: repeat(3,33.3%);
grid-row-gap: 12px;
grid-column-gap: 12px;
>a{
width: 100%;
display: block;
height: 300px;
position: relative;
&:hover > div{
opacity: 1;
}
>img{
width: 100%;
height: 100%;
object-fit: cover;
}
>div{
opacity: 0;
transition: .3s;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
right:0;
background-color: rgba($color: #000, $alpha: .7);
p{
color:#fff;
font-size: 17px;
font-weight: 600;
}
}
}
}
}
.price_option-index{
width: 100%;
max-width: 1200px;
margin: 0 auto;
}
.btn-secondary{
background-color: #6C757D;
}
.text-light{
color:#fff;
}

135
wms/mkt/price_option-index.php

@ -1,53 +1,44 @@
<?php <?php
include "../header.php"; include '../header.php';
require_once './conn.php';
$opt_data_arr = []; $kind = $_GET['kind'];
$sql = "select * from option_price where status = 'Y' order by kind, id"; $sql_str = "SELECT * FROM option_price WHERE kind = :kind AND status ='Y'";
$res = mysqli_query($link, $sql); $stmt = $conn->prepare($sql_str);
while ($row = mysqli_fetch_assoc($res)) { $stmt->bindParam(':kind', $kind);
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["spec"] = $row["spec"]; $stmt->execute();
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["memo"] = $row["memo"]; $options = $stmt->fetchAll(PDO::FETCH_ASSOC);
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["optional"] = $row["optional"]; $optional_arr = [1=>'標', 2=>'選'];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"];
}
mysqli_free_result($res);
?> ?>
<style> <link rel="stylesheet" href="./css/style.css">
.container { <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
padding-top: 10px !important; <link rel="stylesheet" href="../contract/semantic/dist/semantic.min.css">
} <script defer src="../contract/js/alpinejs/cdn.min.js"></script>
#exTab1 table { <script src="../contract/js/axios/axios.min.js"></script>
background-color : white; <div class="price_option-index" x-data="priceOptionIndex">
padding : 5px 15px; <div class="container"><h2>OPTION價格查詢</h2></div>
} <div id="exTab1" class="container">
.kind-col { <div class="toolbar">
color:brown; <label for="">
} 顯示
</style> <select x-model="pageLength" @change="changeType()">
<script> <option value="10">10</option>
$(function(){ <option value="25">25</option>
$('#table_index2').DataTable({ <option value="50">50</option>
"language": { <option value="100">100</option>
"zeroRecords": "沒有符合的結果", <option value="999999">顯示全部</option>
"search": "搜尋", </select>
"lengthMenu": "顯示 _MENU_ 項結果", </label>
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項", <label for="">
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項", <template x-for="btn in buttons">
"infoFiltered": "(從 _MAX_ 項結果中過濾)", <button style="margin-right:4px" :class="['btn', (btn.type == btntype) ? 'btn-primary' : 'btn-secondary text-light']" x-text="btn.name" @click="changeType(btn.type)"></button>
}, </template>
"searching": true, </label>
"pageLength": 50 <label for="">
}); 搜尋
//$('#table_index2_length').hide(); <input type="text" @keyup="inputSearch($event)" />
//$("#table_index2_paginate").hide(); </label>
}) </div>
</script> <table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<div style="overflow-x:auto;">
<div class="container"><h2>OPTION價格查詢</h2></div>
<div id="exTab1" class="container">
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead> <thead>
<tr class="kind-col"> <tr class="kind-col">
<th scope="col" nowrap>名稱</th> <th scope="col" nowrap>名稱</th>
@ -59,29 +50,27 @@ $(function(){
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <template x-if="options.length <= 0">
foreach ($opt_data_arr as $k => $v) { <tr>
foreach ($v as $k2 => $v2) { <td colspan="6"><p style="font-size:13px;color:#a00">沒有符合的結果。</p></td>
foreach ($v2 as $k3 => $v3) { </tr>
if ($v3["optional"] == "1") $optional = "標"; </template>
elseif ($v3["optional"] == "2") $optional = "選"; <template x-for="option in options">
echo "<tr>"; <tr>
echo "<td>".$k2."</td>"; <td x-text="option.group_name"></td>
echo "<td>".$v3["spec"]."</td>"; <td x-text="option.spec"></td>
echo "<td>".$v3["memo"]."</td>"; <td x-text="option.memo"></td>
echo "<td>".$optional."</td>"; <td x-text="options_arr[option.optional]"></td>
echo "<td>".$v3["unit"]."<input type='hidden' name='option_id' value='".$k3."'></td>"; <td x-text="option.unit"></td>
echo "<td>".number_format($v3["price"])."</td>"; <td x-text="option.price!=null ? option.price.toLocaleString() : ''"></td>
echo "</tr>"; </tr>
} </template>
} </table>
} </div>
?>
</tbody>
</table>
</div>
</div> </div>
<?php
mysqli_close($link); <script src="./assets/js/alpine.js"></script>
include "../footer.php"; <script>
?> const options = [...<?php echo json_encode($options); ?>];
const kind = '<?php echo $kind; ?>';
</script>

87
wms/mkt/price_option-index2.php

@ -0,0 +1,87 @@
<?php
include "../header.php";
$opt_data_arr = [];
$sql = "select * from option_price where status = 'Y' order by kind, id";
$res = mysqli_query($link, $sql);
while ($row = mysqli_fetch_assoc($res)) {
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["spec"] = $row["spec"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["memo"] = $row["memo"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["optional"] = $row["optional"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["unit"] = $row["unit"];
$opt_data_arr[$row["kind"]][$row["group_name"]][$row["id"]]["price"] = $row["price"];
}
mysqli_free_result($res);
?>
<style>
.container {
padding-top: 10px !important;
}
#exTab1 table {
background-color : white;
padding : 5px 15px;
}
.kind-col {
color:brown;
}
</style>
<script>
$(function(){
$('#table_index2').DataTable({
"language": {
"zeroRecords": "沒有符合的結果",
"search": "搜尋",
"lengthMenu": "顯示 _MENU_ 項結果",
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
},
"searching": true,
"pageLength": 50
});
//$('#table_index2_length').hide();
//$("#table_index2_paginate").hide();
})
</script>
<div style="overflow-x:auto;">
<div class="container"><h2>OPTION價格查詢</h2></div>
<div id="exTab1" class="container">
<table id="table_index2" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr class="kind-col">
<th scope="col" nowrap>名稱</th>
<th scope="col" nowrap>規格</th>
<th scope="col" nowrap>備註</th>
<th scope="col" nowrap>配置</th>
<th scope="col" nowrap>單位</th>
<th scope="col" nowrap>定價</th>
</tr>
</thead>
<tbody>
<?php
foreach ($opt_data_arr as $k => $v) {
foreach ($v as $k2 => $v2) {
foreach ($v2 as $k3 => $v3) {
if ($v3["optional"] == "1") $optional = "標";
elseif ($v3["optional"] == "2") $optional = "選";
echo "<tr>";
echo "<td>".$k2."</td>";
echo "<td>".$v3["spec"]."</td>";
echo "<td>".$v3["memo"]."</td>";
echo "<td>".$optional."</td>";
echo "<td>".$v3["unit"]."<input type='hidden' name='option_id' value='".$k3."'></td>";
echo "<td>".number_format($v3["price"])."</td>";
echo "</tr>";
}
}
}
?>
</tbody>
</table>
</div>
</div>
<?php
mysqli_close($link);
include "../footer.php";
?>

47
wms/mkt/price_option-select.php

@ -0,0 +1,47 @@
<?php
include "../header.php";
?>
<link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="../contract/semantic/dist/semantic.min.css">
<div class="price_option-select">
<div class="sidebar">
<a href="./price_option-index.php?kind=A&<?php echo $token_link; ?>">A-1車廂意匠</a>
<a href="./price_option-index.php?kind=B&<?php echo $token_link; ?>">A-2車廂內裝</a>
<a href="./price_option-index.php?kind=C&<?php echo $token_link; ?>">A-3車廂外部</a>
<a href="./price_option-index.php?kind=D&<?php echo $token_link; ?>">A-4控制與其他</a>
<a href="./price_option-index.php?kind=E&<?php echo $token_link; ?>">A-5汰改</a>
</div>
<div class="content">
<a href="./price_option-index.php?kind=A&<?php echo $token_link; ?>">
<img src="./assets/img/1.jpg" />
<div>
<p>車廂意匠</p>
</div>
</a>
<a href="./price_option-index.php?kind=B&<?php echo $token_link; ?>">
<img src="./assets/img/2.jpg" />
<div>
<p>車廂內裝</p>
</div>
</a>
<a href="./price_option-index.php?kind=C&<?php echo $token_link; ?>">
<img src="./assets/img/3.jpg" />
<div>
<p>車廂外部</p>
</div>
</a>
<a href="./price_option-index.php?kind=D&<?php echo $token_link; ?>">
<img src="./assets/img/4.jpg" />
<div>
<p>控制與其他</p>
</div>
</a>
<a href="./price_option-index.php?kind=E&<?php echo $token_link; ?>">
<img src="./assets/img/5.jpg" />
<div>
<p>汰改</p>
</div>
</a>
</div>
</div>
Loading…
Cancel
Save