mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-10-30 09:48:44 +08:00 
			
		
		
		
	fix: 完善 SPU 选择快递模版的功能
This commit is contained in:
		| @@ -33,6 +33,11 @@ export const getDeliveryExpressTemplate = async (id: number) => { | ||||
|   return await request.get({ url: '/trade/delivery/express-template/get?id=' + id }) | ||||
| } | ||||
|  | ||||
| // 查询快递运费模板详情 | ||||
| export const getSimpleTemplateList = async () => { | ||||
|   return await request.get({ url: '/trade/delivery/express-template/list-all-simple' }) | ||||
| } | ||||
|  | ||||
| // 新增快递运费模板 | ||||
| export const createDeliveryExpressTemplate = async (data: DeliveryExpressTemplateVO) => { | ||||
|   return await request.post({ url: '/trade/delivery/express-template/create', data }) | ||||
|   | ||||
| @@ -28,7 +28,9 @@ | ||||
|     </el-tabs> | ||||
|     <el-form> | ||||
|       <el-form-item style="float: right"> | ||||
|         <el-button :loading="formLoading" type="primary" @click="submitForm">保存</el-button> | ||||
|         <el-button v-if="!isDetail" :loading="formLoading" type="primary" @click="submitForm"> | ||||
|           保存 | ||||
|         </el-button> | ||||
|         <el-button @click="close">返回</el-button> | ||||
|       </el-form-item> | ||||
|     </el-form> | ||||
| @@ -94,7 +96,9 @@ const formData = ref<ProductSpuApi.Spu>({ | ||||
|  | ||||
| /** 获得详情 */ | ||||
| const getDetail = async () => { | ||||
|   console.log(name) | ||||
|   if ('productSpuDetail' === name) { | ||||
|     isDetail.value = true | ||||
|   } | ||||
|   const id = params.spuId as number | ||||
|   if (id) { | ||||
|     formLoading.value = true | ||||
|   | ||||
| @@ -67,7 +67,12 @@ | ||||
|       <el-col :span="12"> | ||||
|         <el-form-item label="运费模板" prop="deliveryTemplateId"> | ||||
|           <el-select v-model="formData.deliveryTemplateId" placeholder="请选择"> | ||||
|             <el-option v-for="item in []" :key="item.id" :label="item.name" :value="item.id" /> | ||||
|             <el-option | ||||
|               v-for="item in deliveryTemplateList" | ||||
|               :key="item.id" | ||||
|               :label="item.name" | ||||
|               :value="item.id" | ||||
|             /> | ||||
|           </el-select> | ||||
|           <el-button class="ml-20px">运费模板</el-button> | ||||
|         </el-form-item> | ||||
| @@ -127,6 +132,9 @@ | ||||
|     <template #brandId="{ row }"> | ||||
|       {{ brandList.find((item) => item.id === row.brandId)?.name }} | ||||
|     </template> | ||||
|     <template #deliveryTemplateId="{ row }"> | ||||
|       {{ deliveryTemplateList.find((item) => item.id === row.deliveryTemplateId)?.name }} | ||||
|     </template> | ||||
|     <template #specType="{ row }"> | ||||
|       {{ row.specType ? '多规格' : '单规格' }} | ||||
|     </template> | ||||
| @@ -157,19 +165,19 @@ | ||||
| </template> | ||||
| <script lang="ts" name="ProductSpuBasicInfoForm" setup> | ||||
| import { PropType } from 'vue' | ||||
| import { isArray } from '@/utils/is' | ||||
| import { copyValueToTarget } from '@/utils' | ||||
| import { propTypes } from '@/utils/propTypes' | ||||
| import { checkSelectedNode, defaultProps, handleTree, treeToString } from '@/utils/tree' | ||||
| import { createImageViewer } from '@/components/ImageViewer' | ||||
| import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' | ||||
| import type { Spu } from '@/api/mall/product/spu' | ||||
| import { UploadImg, UploadImgs } from '@/components/UploadFile' | ||||
| import { ProductAttributes, ProductAttributesAddForm, SkuList } from './index' | ||||
| import { basicInfoSchema } from './spu.data' | ||||
| import { createImageViewer } from '@/components/ImageViewer' | ||||
| import type { Spu } from '@/api/mall/product/spu' | ||||
| import * as ProductCategoryApi from '@/api/mall/product/category' | ||||
| import { getSimpleBrandList } from '@/api/mall/product/brand' | ||||
| import { isArray } from '@/utils/is' | ||||
|  | ||||
| import { getSimpleTemplateList } from '@/api/mall/trade/delivery/expressTemplate/index' | ||||
| // ====== 商品详情相关操作 ====== | ||||
| const { allSchemas } = useCrudSchemas(basicInfoSchema) | ||||
| /** 商品图预览 */ | ||||
| @@ -345,11 +353,14 @@ const categoryString = (categoryId) => { | ||||
|   return treeToString(categoryList.value, categoryId) | ||||
| } | ||||
| const brandList = ref([]) // 精简商品品牌列表 | ||||
| const deliveryTemplateList = ref([]) // 运费模版 | ||||
| onMounted(async () => { | ||||
|   // 获得分类树 | ||||
|   const data = await ProductCategoryApi.getCategoryList({}) | ||||
|   categoryList.value = handleTree(data, 'id', 'parentId') | ||||
|   // 获取商品品牌列表 | ||||
|   brandList.value = await getSimpleBrandList() | ||||
|   // 获取运费模版 | ||||
|   deliveryTemplateList.value = await getSimpleTemplateList() | ||||
| }) | ||||
| </script> | ||||
|   | ||||
| @@ -408,7 +408,7 @@ const openForm = (id?: number) => { | ||||
|  * 查看商品详情 | ||||
|  */ | ||||
| const openDetail = (id?: number) => { | ||||
|   push('/product/productSpuDetail' + id) | ||||
|   push('/product/productSpuDetail/' + id) | ||||
| } | ||||
|  | ||||
| /** 导出按钮操作 */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 puhui999
					puhui999