|
|
@@ -0,0 +1,151 @@
|
|
|
+<!-- 顧客購入履歴 -->
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form ref="queryRef" :inline="true" :model="queryParams">
|
|
|
+ <el-form-item label="顧客名" prop="customerName">
|
|
|
+ <el-input v-model="queryParams.customerName"
|
|
|
+ clearable maxlength="255" @keyup.enter="handleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="顧客名(カナ)" prop="customerNameKana">
|
|
|
+ <el-input v-model="queryParams.customerNameKana"
|
|
|
+ clearable
|
|
|
+ maxlength="255" @keyup.enter="handleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button icon="Search" type="primary" @click="handleQuery">検索</el-button>
|
|
|
+ <el-button icon="Refresh" type="primary" @click="resetQuery">クリア</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-table v-show="initLoadingCompleted" v-loading="listLoading" :border="true" :data="CustomerList">
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="left" label="FC" min-width="60"
|
|
|
+ prop="brandName"
|
|
|
+ width=""/>
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="left" label="店舗名" min-width="90"
|
|
|
+ prop="storeName"
|
|
|
+ width=""/>
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="商品名" min-width="100"
|
|
|
+ prop="purchaseProductName"
|
|
|
+ width=""/>
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="購入年月日" min-width="70"
|
|
|
+ prop="purchaseMonth" :formatter="formatPurchaseMonth"
|
|
|
+ width=""/>
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="単価" min-width="60"
|
|
|
+ prop="purchaseCost" :formatter="formatPrice"
|
|
|
+ width=""/>
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="数量" min-width="70"
|
|
|
+ prop="purchaseQuantity"
|
|
|
+ width=""/>
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="購入金額" min-width="70"
|
|
|
+ prop="purchaseAmount" :formatter="formatPrice"
|
|
|
+ width=""/>
|
|
|
+ <el-table-column :show-overflow-tooltip="true" align="center" header-align="center" label="購入状態" min-width="70"
|
|
|
+ prop="validPurchaseFlagName"
|
|
|
+ width=""/>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination v-show="listTotalCnt>0"
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
+ v-model:page="queryParams.pageNum"
|
|
|
+ :total="listTotalCnt"
|
|
|
+ @pagination="getSearchList"/>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script name="CustomerHistory" setup>
|
|
|
+
|
|
|
+import {customerHistory} from "@/api/fcbi/customer.js"
|
|
|
+import {useRoute} from 'vue-router';
|
|
|
+
|
|
|
+// 認証項目のテーブルデータを格納するリアクティブ
|
|
|
+const CustomerList = ref([]);
|
|
|
+// データ読み込み中のローディング状態を管理するリアクティブ
|
|
|
+const listLoading = ref(false);
|
|
|
+// 検索結果の総件数を格納するリアクティブ
|
|
|
+const listTotalCnt = ref(0);
|
|
|
+// 初期ロードが完了したかどうかを示すリアクティブ
|
|
|
+const initLoadingCompleted = ref(false);
|
|
|
+const {proxy} = getCurrentInstance();
|
|
|
+const route = useRoute();
|
|
|
+const customerId = route.params.customerId;
|
|
|
+
|
|
|
+/**
|
|
|
+ * コンポーネントの状態を管理するリアクティブオブジェクト
|
|
|
+ */
|
|
|
+const data = reactive({
|
|
|
+ form: {},
|
|
|
+ // 検索条件を格納するオブジェクト
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ customerName: '',
|
|
|
+ customerNameKana: '',
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+//値の書式設定関数
|
|
|
+const formatPrice = (row, column, cellValue) => {
|
|
|
+ if (cellValue === null || cellValue === undefined) return '';
|
|
|
+ const num = Number(cellValue);
|
|
|
+ if (isNaN(num)) return cellValue;
|
|
|
+
|
|
|
+ return num.toLocaleString(undefined, {
|
|
|
+ minimumFractionDigits: 2,
|
|
|
+ maximumFractionDigits: 2
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
+// 日付フォーマット関数
|
|
|
+const formatPurchaseMonth = (row, column, cellValue) => {
|
|
|
+ if (!cellValue) return '';
|
|
|
+ const str = cellValue.toString();
|
|
|
+ if (str.length !== 8) return cellValue;
|
|
|
+ return `${str.slice(0, 4)}-${str.slice(4, 6)}-${str.slice(6, 8)}`;
|
|
|
+};
|
|
|
+
|
|
|
+// リアクティブオブジェクトからプロパティを参照可能なオブジェクトに変換
|
|
|
+const {queryParams} = toRefs(data);
|
|
|
+
|
|
|
+/**
|
|
|
+ * 検索ボタンのクリックイベントハンドラー
|
|
|
+ * 検索条件を初期ページに設定して検索を実行する
|
|
|
+ */
|
|
|
+function handleQuery() {
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
+ getSearchList();
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 発注リストを検索する関数
|
|
|
+ * APIを呼び出して検索条件に一致する発注データを取得する
|
|
|
+ */
|
|
|
+function getSearchList() {
|
|
|
+ listLoading.value = true;
|
|
|
+ let params = {
|
|
|
+ pageNum: queryParams.value.pageNum,
|
|
|
+ pageSize: queryParams.value.pageSize,
|
|
|
+ customerName: queryParams.value.customerName,
|
|
|
+ customerNameKana: queryParams.value.customerNameKana,
|
|
|
+ customerId: customerId
|
|
|
+ };
|
|
|
+ customerHistory(params).then(response => {
|
|
|
+ CustomerList.value = response.rows;
|
|
|
+ listTotalCnt.value = response.total;
|
|
|
+ listLoading.value = false;
|
|
|
+ initLoadingCompleted.value = true;
|
|
|
+ });
|
|
|
+}
|
|
|
+/**
|
|
|
+ * リセット ボタンアクション
|
|
|
+ */
|
|
|
+function resetQuery() {
|
|
|
+ proxy.resetForm("queryRef");
|
|
|
+ handleQuery();
|
|
|
+}
|
|
|
+// コンポーネント初期化時に検索を実行
|
|
|
+getSearchList();
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+
|
|
|
+</style>
|