diff --git a/.env.development b/.env.development index 8bcc5d2..a4d7f18 100644 --- a/.env.development +++ b/.env.development @@ -1,5 +1,5 @@ NODE_ENV = 'development' VITE_NOW_TYPE = 'dist' # Base API -VITE_APP_BASE_URL='http://192.168.1.22:8546' +VITE_APP_BASE_URL='http://192.168.1.16:8546' # VITE_APP_BASE_URL='https://erp.lihaink.cn' \ No newline at end of file diff --git a/src/api/merchant.ts b/src/api/merchant.ts index b9ab307..3ae90c3 100644 --- a/src/api/merchant.ts +++ b/src/api/merchant.ts @@ -23,4 +23,13 @@ export function apiMerchantDelete(params: any) { // 商户表详情 export function apiMerchantDetail(params: any) { return request.get({ url: '/merchat/merchant/detail', params }) -} \ No newline at end of file +} + + +// 已绑商品表列表 +export function apiBindGoodstLists(params: any) { + return request.get({ url: '/merchat/merchant/bind_goods_lists', params }) +} + + +// /admin?mer_id=506 \ No newline at end of file diff --git a/src/components/goodsPop/index.vue b/src/components/goodsPop/index.vue index b71e723..f935119 100644 --- a/src/components/goodsPop/index.vue +++ b/src/components/goodsPop/index.vue @@ -36,13 +36,8 @@ <el-table-column label="销货价格" prop="sell" show-overflow-tooltip /> <el-table-column label="零售价格" prop="retail" show-overflow-tooltip /> <el-table-column label="标签" prop="sys_labels_text" show-overflow-tooltip /> - <!-- <el-table-column label="条形码" prop="code" show-overflow-tooltip /> --> - <!-- <el-table-column label="库存阈值" prop="stocktip" show-overflow-tooltip /> --> - <!-- <el-table-column label="备注信息" prop="data" show-overflow-tooltip /> --> - <!-- <el-table-column label="排序" prop="sort" show-overflow-tooltip /> --> <el-table-column label="数量" prop="num" width="170"> <template #default="{ row }"> - <!-- <el-image style="width:50px;height:50px;" :src="row.imgs" /> --> <el-input type="number" v-model="row.num" clearable placeholder="请输入数量" /> </template> </el-table-column> @@ -62,18 +57,13 @@ <script lang="ts" setup name="goodsLists"> import { usePaging } from '@/hooks/usePaging' import { useDictData } from '@/hooks/useDictOptions' -import { apiGoodsLists, apiGoodsDelete, apiBindGodds } from '@/api/goods' -import { timeFormat } from '@/utils/util' -import feedback from '@/utils/feedback' +import { apiGoodsLists, apiBindGodds } from '@/api/goods' import { defineProps } from "vue" - let props = defineProps({ mer_id: Number }) -const editRef = shallowRef<InstanceType<typeof EditPopup>>() -const detailRef = shallowRef<InstanceType<typeof DetailPopup>>() // 是否显示编辑框 const showEdit = ref(false) const showDetail = ref(false) @@ -128,7 +118,6 @@ const bindFn = async () => { const canceFn = () => { emits("offPop"); - } getLists() diff --git a/src/views/data/merchant/merchant/bindGoods.vue b/src/views/data/merchant/merchant/bindGoods.vue new file mode 100644 index 0000000..1a31753 --- /dev/null +++ b/src/views/data/merchant/merchant/bindGoods.vue @@ -0,0 +1,105 @@ +<template> + <div> + <!-- <el-card class="!border-none mb-4" shadow="never"> + <el-form class="mb-[-16px]" :model="queryParams" label-width="160px"> + <el-row> + <el-col :span="6"> + <el-form-item label="商户分类" prop="category_id"> + <el-select class="w-[280px]" v-model="queryParams.category_id" clearable placeholder="请选择商户分类"> + <el-option label="全部" value=""></el-option> + <el-option v-for="(item, index) in dictData.mer_category_type" :key="index" + :label="item.name" :value="item.value" /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item label="店铺类型" prop="type_id"> + <el-select class="w-[280px]" v-model="queryParams.type_id" clearable placeholder="请选择店铺类型"> + <el-option label="全部" value=""></el-option> + <el-option v-for="(item, index) in dictData.merchat_type" :key="index" :label="item.name" + :value="item.value" /> + </el-select> + </el-form-item> + </el-col> + <el-col :span="6"> + <el-form-item> + <el-button type="primary" @click="resetPage">查询</el-button> + <el-button @click="resetParams">重置</el-button> + </el-form-item> + </el-col> + </el-row> + </el-form> + </el-card> --> + <el-card class="!border-none" v-loading="pager.loading" shadow="never"> + <el-button v-perms="['merchat.merchant/add']" type="primary" @click="showDialog = true"> + <template #icon> + <icon name="el-icon-Plus" /> + </template> + 商品绑定 + </el-button> + <div class="mt-4"> + <el-table :data="pager.lists" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" /> + <!-- <el-table-column label="ID" prop="id" width="55" /> --> + <el-table-column label="商品图片" prop="imgs"> + <template #default="{ row }"> + <el-image style="width:50px;height:50px;" :src="row.goods_info.imgs" /> + </template> + </el-table-column> + <el-table-column label="商品名称" prop="goods_info.name" show-overflow-tooltip /> + <el-table-column label="规格型号" prop="goods_info.spec" show-overflow-tooltip /> + <el-table-column label="商品分类" prop="goods_info.class_name" show-overflow-tooltip /> + <el-table-column label="商品品牌" prop="goods_info.brand_name" show-overflow-tooltip /> + <el-table-column label="商品单位" prop="goods_info.unit_name" show-overflow-tooltip /> + <el-table-column label="购货价格" prop="goods_info.buy" show-overflow-tooltip /> + <el-table-column label="销货价格" prop="goods_info.sell" show-overflow-tooltip /> + <el-table-column label="零售价格" prop="goods_info.retail" show-overflow-tooltip /> + <el-table-column label="标签" prop="goods_info.sys_labels_text" show-overflow-tooltip /> + <el-table-column label="数量" prop="nums" width="170"> + </el-table-column> + </el-table> + </div> + <div class="flex mt-4 justify-end"> + <pagination v-model="pager" @change="getLists" /> + </div> + </el-card> + <el-dialog v-model="showDialog" title="绑定商品" width="70%"> + <goodsPop @offPop="showDialog = false, getLists()" :mer_id="mer_id"></goodsPop> + </el-dialog> + </div> +</template> + +<script lang="ts" setup name="merchantLists"> +import { usePaging } from '@/hooks/usePaging' +import { useDictData } from '@/hooks/useDictOptions' +import { apiBindGoodstLists } from '@/api/merchant' +import { useRoute } from 'vue-router'; +const route = useRoute() +const showDialog = ref(false) +let mer_id = route.query.mer_id; + +// 查询条件 +const queryParams = reactive({ + mer_id: mer_id, +}) + +// 选中数据 +const selectData = ref<any[]>([]) + +// 表格选择后回调事件 +const handleSelectionChange = (val: any[]) => { + selectData.value = val.map(({ mer_id }) => mer_id) +} + +// 获取字典数据 +const { dictData } = useDictData('mer_category_type,merchat_type,show_status,off_status,financial_type') + +// 分页相关 +const { pager, getLists, resetParams, resetPage } = usePaging({ + fetchFun: apiBindGoodstLists, + params: queryParams +}) + +getLists() +</script> + diff --git a/src/views/data/merchant/merchant/index.vue b/src/views/data/merchant/merchant/index.vue index 2eef5b9..a1dc140 100644 --- a/src/views/data/merchant/merchant/index.vue +++ b/src/views/data/merchant/merchant/index.vue @@ -135,7 +135,7 @@ <el-table-column label="银行卡转账信息" prop="financial_bank" width="140" show-overflow-tooltip /> <el-table-column label="微信转账信息" prop="financial_wechat" width="140" show-overflow-tooltip /> <el-table-column label="支付宝转账信息" prop="financial_alipay" width="160" show-overflow-tooltip /> - <el-table-column label="操作" width="170" fixed="right"> + <el-table-column label="操作" width="250" fixed="right"> <template #default="{ row }"> <el-button v-perms="['merchat.merchant/edit']" type="primary" link @click="handleEdit(row)"> 编辑 @@ -147,9 +147,15 @@ <el-button link @click="handleDetail(row)"> 详情 </el-button> - <el-button link @click="showDialog = true, mer_id = row.mer_id"> + + <router-link :to="{ + path: 'bindGoods', + query: { + mer_id: row.mer_id + } + }"> 商品绑定 - </el-button> + </router-link> </template> </el-table-column> </el-table> @@ -161,9 +167,6 @@ <edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> <DetailPopup v-if="showDetail" ref="detailRef" :dict-data="dictData" @success="getLists" @close="showDetail = false" /> - <el-dialog v-model="showDialog" title="绑定商品" width="70%"> - <goodsPop @offPop="showDialog = false" :mer_id="mer_id"></goodsPop> - </el-dialog> </div> </template> @@ -180,9 +183,7 @@ const detailRef = shallowRef<InstanceType<typeof EditPopup>>() // 是否显示编辑框 const showEdit = ref(false) const showDetail = ref(false) -const showDialog = ref(false) -let mer_id; // 查询条件 diff --git a/src/views/goods/goods/edit.vue b/src/views/goods/goods/edit.vue index 78f4455..682212a 100644 --- a/src/views/goods/goods/edit.vue +++ b/src/views/goods/goods/edit.vue @@ -18,11 +18,11 @@ /> </el-form-item > </el-col> --> - <el-col :span="8"> + <!-- <el-col :span="8"> <el-form-item label="商品编号" prop="number"> <el-input v-model="formData.number" clearable placeholder="请输入商品编号" /> </el-form-item> - </el-col> + </el-col> --> <el-col :span="8"> <el-form-item label="规格型号" prop="spec"> <el-input v-model="formData.spec" clearable placeholder="请输入规格型号" /> @@ -123,7 +123,7 @@ </el-col> <el-col :span="8"> <el-form-item label="排序" prop="sort"> - <el-input v-model="formData.sort" clearable placeholder="请输入排序" /> + <el-input v-model="formData.sort" type="number" clearable placeholder="请输入排序" /> </el-form-item> </el-col> <el-col :span="24"> @@ -203,6 +203,43 @@ const formData = reactive({ }); + +// const formData = reactive( +// { +// "id": "", +// "name": "In voluptas repudian", +// "py": "", +// "number": "Labore totam suscipi", +// "spec": "Esse ratione incidi", +// "class": 4796, +// "brand": 3, +// "unit": 4, +// "buy": "Tempore nihil harum", +// "sell": "Adipisicing ea qui v", +// "retail": "Consequat Eum irure", +// "integral": "Ipsum inventore beat", +// "code": "Nesciunt minim pari", +// "tax_rate": "Eaque corrupti in e", +// "warehouse": 1, +// "location": "Qui officia quod in ", +// "stocktip": "Fuga Illo fugiat su", +// "retail_name": "Voluptas itaque fuga", +// "sys_labels_text": "水果,生鲜类12,生菜", +// "sys_labels": "3,2,1", +// "imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png", +// "details": "", +// "data": "Sit maxime voluptat", +// "more": "Fugiat in ut reicie", +// "sort": "43" +// } + +// ) + + + + + + const customEvent = (e) => { formData.sys_labels = [] let text = [] diff --git a/src/views/opurchase/opurchaseclass/index.vue b/src/views/opurchase/opurchaseclass/index.vue index 2a33109..f460407 100644 --- a/src/views/opurchase/opurchaseclass/index.vue +++ b/src/views/opurchase/opurchaseclass/index.vue @@ -35,7 +35,7 @@ <el-table :data="pager.lists" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55" /> <el-table-column label="ID" prop="id" show-overflow-tooltip /> - <el-table-column label="所属商户" prop="merchant" show-overflow-tooltip /> + <el-table-column label="所属商户" prop="mer_name" show-overflow-tooltip /> <el-table-column label="零售订单id" prop="order_arr" show-overflow-tooltip /> <el-table-column label="购物车id" prop="cart_id" show-overflow-tooltip /> <el-table-column label="单据编号" prop="number" width="220" show-overflow-tooltip />