Ver Fonte

Merge branch 'dev' of https://git.citupro.com/zhengnaiwen_citu/menduner into dev

lifanagju_citu há 4 meses atrás
pai
commit
d3501dc613

+ 18 - 9
src/views/mall/components/GoodsItem/index.vue

@@ -1,10 +1,10 @@
 <template>
-  <div class="order-item-goods px-3 pt-3 cursor-pointer" @click="handleDetail(item)">
+  <div class="order-item-goods px-3 pt-3 cursor-pointer">
     <div class="d-flex align-center">
-      <div style="width: 90px; height: 90px">
+      <div style="width: 90px; height: 90px" @click="handleDetail(item)">
         <v-img :src="item.picUrl"></v-img>
       </div>
-      <div class="ml-5">
+      <div class="ml-5" style="flex: 1;" @click="handleDetail(item)">
         <p class="font-size-15" :class="{'goods-name': showHover}">{{ item.spuName }}</p>
         <p class="color-999 font-size-14">{{ item.properties.map((property) => property.valueName).join(' ') }}</p>
         <p v-if="showPriceCount">
@@ -12,6 +12,10 @@
           <span v-if="item.count" class="color-999 font-size-13 ml-1">x {{ item.count }}</span>
         </p>
       </div>
+      <div v-if="[10, 20, 30].includes(orderStatus) && item.extend && item.extend?.fileUrls && item.extend?.fileUrls?.length" class="d-flex" style="max-width: 160px;">
+        <v-btn variant="text" color="primary" prepend-icon="mdi-eye-outline" @click="previewFile(item.extend.fileUrls[0])">预览</v-btn>
+        <v-btn variant="text" color="primary" prepend-icon="mdi-arrow-down-bold-outline" @click="handleDownload(item.extend.fileUrls[0])">下载</v-btn>
+      </div>
     </div>
     <v-divider v-if="showLine" class="mt-3"></v-divider>
   </div>
@@ -19,10 +23,10 @@
 
 <script setup>
 defineOptions({ name: 'mall-goods-item'})
-// import { useRouter } from 'vue-router'
 import { fen2yuan } from '@/hooks/web/useGoods'
+import { getBlob, saveAs, previewFile } from '@/utils'
 
-defineProps({ 
+const props = defineProps({ 
   item: {
     type: Object,
     default: () => ({})
@@ -38,15 +42,20 @@ defineProps({
   showPriceCount: {
     type: Boolean,
     default: true
-  }
+  },
+  orderStatus: [Number, String]
 })
 
-// const router = useRouter()
-
 const handleDetail = (val) => {
   const spuId = val.spuId || val.id // 商品id
   if (spuId) window.open(`/mall/goodsDetail/${spuId}`)
-  // if (spuId) router.push(`/mall/goodsDetail/${spuId}`)
+}
+
+// 下载附件
+const handleDownload = (url) => {
+  getBlob(url).then(blob => {
+    saveAs(blob, props.item.spuName)
+  })
 }
 </script>
 

+ 11 - 4
src/views/mall/home/components/hotGoods.vue

@@ -22,7 +22,7 @@
 
 <script setup>
 defineOptions({ name: 'mall-home-hotGoods'})
-import { ref, computed } from 'vue'
+import { ref, computed, watch } from 'vue'
 import { getProductByIds } from '@/api/mall/index'
 import { formatSales, fen2yuan } from '@/hooks/web/useGoods'
 import { isArray } from 'lodash-es'
@@ -33,15 +33,22 @@ const router = useRouter()
 
 // 根据id获取商品列表
 const goodList = ref([])
-const getGoodsList = async () => {
-  const productCard = props.templateData?.home?.components.find(item => item.id === 'ProductCard')
+const getGoodsList = async (val) => {
+  const productCard = val?.home?.components.find(item => item.id === 'ProductCard')
   if (!productCard) return
   const ids = productCard.property.spuIds
   if (!ids.length) return
   const data = await getProductByIds(ids)
   goodList.value = data
 }
-getGoodsList()
+
+watch(
+  () => props.templateData,
+  async (val) => {
+    await getGoodsList(val)
+  },
+  { immediate: true, deep: true }
+)
 
 // 格式化销量、库存信息
 const salesAndStock = computed(() => (data) => {

+ 2 - 2
src/views/recruit/personal/PersonalCenter/resume/attachment/index.vue

@@ -58,8 +58,8 @@ import Snackbar from '@/plugins/snackbar'
 import Confirm from '@/plugins/confirm'
 import { useI18n } from '@/hooks/web/useI18n'
 import { getPersonResumeCv, deletePersonResumeCv, savePersonResumeCv } from '@/api/recruit/personal/resume'
-import { getBlob, saveAs } from '@/utils'
-import { previewFile } from '@/utils'
+import { getBlob, saveAs, previewFile } from '@/utils'
+
 const emit = defineEmits(['analysis'])
 const props = defineProps({
   analysis: { // 简历解析

+ 21 - 2
src/views/recruit/personal/PersonalCenter/tradeOrder/components/detail.vue

@@ -24,6 +24,12 @@
           <template #spuName="{ item }">
             <span class="color-primary cursor-pointer" @click="handleToGoodsDetail(item)">{{ item.spuName }}</span>
           </template>
+          <template #actions="{ item }">
+            <div v-if="[10, 20, 30].includes(order.status) && item.extend && item.extend.fileUrls && item.extend.fileUrls.length > 0">
+              <v-btn variant="text" color="primary" prepend-icon="mdi-eye-outline" @click="previewFile(item.extend.fileUrls[0])">预览</v-btn>
+              <v-btn variant="text" color="primary" prepend-icon="mdi-arrow-down-bold-outline" @click="handleDownload(item.extend.fileUrls[0], item.spuName)">下载</v-btn>
+            </div>
+          </template>
         </CtTable>
         <div class="text-end color-primary mr-3 mt-5 font-size-20">
           共{{ order.productCount }}件商品,合计:¥{{ fen2yuan(order.payPrice) }}
@@ -64,12 +70,13 @@
 
 <script setup>
 defineOptions({ name: 'mall-user-order-detail'})
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, computed } from 'vue'
 import { useRouter } from 'vue-router'
 import { getMallOrderDetail } from '@/api/mall/user'
 import Snackbar from '@/plugins/snackbar'
 import { timesTampChange } from '@/utils/date'
 import { fen2yuan, formatOrderStatusDescription } from '@/hooks/web/useGoods'
+import { getBlob, saveAs, previewFile } from '@/utils'
 
 const router = useRouter()
 const { id } = router.currentRoute.value.params
@@ -80,7 +87,8 @@ const headers = [
   { title: '商品名称', key: 'spuName', sortable: false },
   { title: '规格', key: 'contactAddress', sortable: false, value: item => item.properties.map((property) => property.valueName).join(' ') },
   { title: '单价', key: 'price', sortable: false, value: item => '¥' + fen2yuan(item.price) },
-  { title: '数量', key: 'count', sortable: false }
+  { title: '数量', key: 'count', sortable: false },
+  { title: '操作', sortable: false, key: 'actions' }
 ]
 
 onMounted(async () =>{
@@ -95,6 +103,17 @@ onMounted(async () =>{
   order.value = data
 })
 
+const showBanner = computed(() => (order) => {
+  return order?.items?.length ? order.items.every(k => k.spuType === '0') : false
+})
+
+// 下载附件
+const handleDownload = (url, name) => {
+  getBlob(url).then(blob => {
+    saveAs(blob, name)
+  })
+}
+
 // 跳转商品详情
 const handleToGoodsDetail = (item) => {
   window.open(`/mall/goodsDetail/${item.spuId}`)

+ 3 - 2
src/views/recruit/personal/PersonalCenter/tradeOrder/dynamic/mallOrder.vue

@@ -10,12 +10,13 @@
             <span>订单号:{{ val.no }}</span>
             <span class="ml-5">{{ timesTampChange(val.createTime) }}</span>
           </div>
+          <!-- 实体商品 -->
           <div class="text-end color-warning" :class="formatOrderColor(val)" style="flex: 1">
             {{ formatOrderStatus(val) }}
           </div>
         </div>
         <!-- 商品列表 -->
-        <GoodsItem v-for="k in val.items" :key="k.id" :item="k" />
+        <GoodsItem v-for="k in val.items" :key="k.id" :item="k" :orderStatus="val.status" />
         <!-- 操作按钮 -->
         <div class="text-end pa-3 font-size-13 color-666">
           <div>共{{ val.productCount }}件商品,合计:¥{{ fen2yuan(val.payPrice) }}</div>
@@ -68,7 +69,7 @@ const tabList = [
   { title: '全部', value: -1 },
   { title: '待付款', value: 0 },
   { title: '待发货', value: 10 },
-  { title: '待收货', value: 20 },
+  { title: '已发货', value: 20 },
   { title: '已完成', value: 30 },
   { title: '已取消', value: 40 },
   // { title: '待评价', value: 30 }