Преглед на файлове

修改上传没有删除按钮

wxy преди 4 месеца
родител
ревизия
55981eb071
променени са 3 файла, в които са добавени 44 реда и са изтрити 37 реда
  1. 6 6
      src/components/upload/index.vue
  2. 37 30
      src/views/order/BuyCard/detaile.vue
  3. 1 1
      src/views/tariffManagement/customer/NewCustomerForm.vue

+ 6 - 6
src/components/upload/index.vue

@@ -1,7 +1,7 @@
 <template>
   <a-upload :show-file-list="true" :custom-request="handelUpload == null ? customRequest : handelUpload"
-    :list-type="listType" :file-list="fileList" :limit="minx" @before-remove="beforeRemove" :show-remove-button="showRemoveButton" :show-cancel-button="false"
-    :image-preview="imagePreview" :accept="accept" @before-upload="beforeUpload" />
+    :list-type="listType" :file-list="fileList" :limit="minx" @before-remove="beforeRemove"
+     :image-preview="imagePreview" :accept="accept" @before-upload="beforeUpload"/>
 </template>
 
 <script setup>
@@ -20,14 +20,12 @@ const customRequest = async (option) => {
   const fileName = `thumbnail_${file.name}`;
   const key = `test/${fileName}`;
 
-  // 获取上传客户端(假设 systemStore 已经定义了上传接口)
   const client = await systemStore.getSTSClient();
   const resClient = await client.putObject({
     key: key,
     body: file
   });
 
-
   // 上传成功后,更新 fileList 和 modelValue
   if (resClient.statusCode === 200) {
     const uploadedFileUrl = resClient.url;
@@ -66,7 +64,7 @@ const props = defineProps({
     type: Function,
     default: null  // 外部传入的自定义上传方法
   },
-  showRemoveButton:{
+  showRemoveButton: {
     type: Boolean,
     default: true  // 是否显示删除按钮
   },
@@ -82,6 +80,7 @@ const modelValue = toRef(props, 'modelValue');
 const listType = toRef(props, 'listType');
 const imagePreview = toRef(props, 'imagePreview');
 const handelUpload = toRef(props, 'handelUpload');
+const showRemoveButton = toRef(props, 'showRemoveButton');
 // 定义 emit,用于向外抛出事件
 const emit = defineEmits(["update:modelValue"]);
 
@@ -136,7 +135,7 @@ onMounted(() => {
 
 // 上传前校验
 const beforeUpload = (rawFile) => {
-  if(!props.beforeUpload) return true
+  if (!props.beforeUpload) return true
   const isAllowType =
     rawFile.type === "image/png" ||
     rawFile.type === "image/jpg" ||
@@ -151,6 +150,7 @@ const beforeUpload = (rawFile) => {
   return true;
 };
 
+
 </script>
 
 <style scoped>

+ 37 - 30
src/views/order/BuyCard/detaile.vue

@@ -26,12 +26,14 @@
             </div>
             <div class="detail-item-box">
                 <div class="detail-item">
-                    <div class="item-label">{{  $t('order.MinimumSubscriptionPeriod') }}</div>
-                    <div class="item-content">{{ tariffForm.settlementCycle?.split('~')[0] }} {{ $t('order.Months') }}</div>
+                    <div class="item-label">{{ $t('order.MinimumSubscriptionPeriod') }}</div>
+                    <div class="item-content">{{ tariffForm.settlementCycle?.split('~')[0] }} {{ $t('order.Months') }}
+                    </div>
                 </div>
                 <div class="detail-item">
-                    <div class="item-label">{{  $t('order.MaximumSubscriptionPeriod') }}</div>
-                    <div class="item-content">{{ tariffForm.settlementCycle?.split('~')[1] }} {{ $t('order.Months') }}</div>
+                    <div class="item-label">{{ $t('order.MaximumSubscriptionPeriod') }}</div>
+                    <div class="item-content">{{ tariffForm.settlementCycle?.split('~')[1] }} {{ $t('order.Months') }}
+                    </div>
                 </div>
             </div>
             <div class="detail-item-box">
@@ -46,26 +48,28 @@
             </div>
             <div class="detail-item-box">
                 <div class="detail-item">
-                    <div class="item-label">{{  $t('order.CardType') }}</div>
+                    <div class="item-label">{{ $t('order.CardType') }}</div>
                     <div class="item-content">{{ FormDataList.cardType }}</div>
                 </div>
                 <div class="detail-item">
-                    <div class="item-label">{{  $t('order.StandardPrice') }}</div>
+                    <div class="item-label">{{ $t('order.StandardPrice') }}</div>
                     <div class="item-content">{{ tariffForm.pricingName }}</div>
                 </div>
             </div>
             <div class="detail-item-box">
                 <div class="detail-item">
-                    <div class="item-label">{{  $t('order.FlowPool') }}</div>
-                    <div class="item-content">{{ FormDataList.isTrafficPool == 1 ?  $t('lotCard.Yes') : $t('lotCard.No') }}</div>
+                    <div class="item-label">{{ $t('order.FlowPool') }}</div>
+                    <div class="item-content">{{ FormDataList.isTrafficPool == 1 ? $t('lotCard.Yes') : $t('lotCard.No')
+                        }}</div>
                 </div>
             </div>
             <div class="detail-item-box">
                 <div class="detail-item">
-                    <div class="item-label">{{  $t('order.CardNum') }}</div>
+                    <div class="item-label">{{ $t('order.CardNum') }}</div>
                     <div class="item-content">{{ dataDetail.length }}
                         <a-button type="primary" @click="showCard = true" style="margin-left:10px;"
-                            v-if="userType == 1 && FormDataList.moderationStatus == 2">{{ $t('order.AllocationCardNumber') }}</a-button>
+                            v-if="userType == 1 && FormDataList.moderationStatus == 2">{{
+                                $t('order.AllocationCardNumber') }}</a-button>
                     </div>
                 </div>
             </div>
@@ -75,26 +79,27 @@
         </div>
 
         <template #footer>
-            <a-button @click="cancel">{{ $t('form.Cancel')}}</a-button>
+            <a-button @click="cancel">{{ $t('form.Cancel') }}</a-button>
         </template>
     </a-modal>
 
     <!-- 分配卡号 -->
-    <a-modal v-model:visible="showCard" :title="$t('order.AllocationCardNumber')" @cancel="closeModal(showCard, FormDataList)"
-        @before-ok="showCard = false" :okText="$t('form.Confirm')" :cancelText="$t('form.Cancel')">
+    <a-modal v-model:visible="showCard" :title="$t('order.AllocationCardNumber')"
+        @cancel="closeModal(showCard, FormDataList)" @before-ok="showCard = false" :okText="$t('form.Confirm')"
+        :cancelText="$t('form.Cancel')">
         <Upload listType="" minx="1" accept=".xlsx" :handelUpload="customRequest" :showRemoveButton="false">
         </Upload>
     </a-modal>
 </template>
 
 <script setup>
-import { ref, onMounted, toRefs, toRef ,watch} from 'vue';
-import { AcquireOrdertariff, DistributionCard,ReturntheOrderCard } from '@/api/path/order'
+import { ref, onMounted, toRefs, toRef, watch } from 'vue';
+import { AcquireOrdertariff, DistributionCard, ReturntheOrderCard } from '@/api/path/order'
 import { Message } from '@arco-design/web-vue';
 import Upload from "@/components/upload/index.vue";
 import { Getdictionary } from '@/mixins/index.js'
-import {useI18n} from 'vue-i18n'
-const {t} = useI18n();
+import { useI18n } from 'vue-i18n'
+const { t } = useI18n();
 const props = defineProps({
     modelValue: {
         type: Boolean,
@@ -111,13 +116,13 @@ const emit = defineEmits(['update:modelValue', 'submit'])
 const state = ref({
     tariffForm: {},
     showCard: false,
-    res1:[],
-    res2:[],
-    res3:[],
+    res1: [],
+    res2: [],
+    res3: [],
     userType: JSON.parse(localStorage.getItem('user_login_information'))?.userType, // 1平台 2用户
 })
-const { tariffForm, showCard,res1,res2,res3,userType } = toRefs(state.value)
-const columnsDetail = [{ title: 'ICCID', dataIndex: 'iccid' },{ title: t('order.CardStatus'), dataIndex: 'status' },{ title: t('order.CreationTime'), dataIndex: 'createdAt' }
+const { tariffForm, showCard, res1, res2, res3, userType } = toRefs(state.value)
+const columnsDetail = [{ title: 'ICCID', dataIndex: 'iccid' }, { title: t('order.CardStatus'), dataIndex: 'status' }, { title: t('order.CreationTime'), dataIndex: 'createdAt' }
 ]
 const dataDetail = ref([])
 
@@ -127,10 +132,12 @@ const customRequest = (options) => {
     formData.append('file', options.fileItem.file);  // 这里将文件添加到 FormDataList 中
     formData.append('orderId', FormDataList.value.id);
     DistributionCard(formData).then(res => {
-        Message.success(res.message)
-        res.data[0].forEach(val=>[
-            dataDetail.value.push({iccid:val})
-        ])
+        if (res.code == 200) {
+            Message.success(res.message)
+            res.data[0].forEach(val => [
+                dataDetail.value.push({ iccid: val })
+            ])
+        }
     })
 }
 
@@ -138,7 +145,7 @@ const cancel = () => {
     emit('update:modelValue', false)
 }
 
-const closeModal = ()=>{
+const closeModal = () => {
     showCard.value = false
 }
 
@@ -152,10 +159,10 @@ watch(() => FormDataList.value, val => {
         tariffForm.value.pricingName = tariffForm.value.pricing !== '' ? tariffForm.value.pricing + '/' + res3.value.filter(val => val.value == res.data.currency)[0]?.label : '';
     })
     dataDetail.value = []
-    ReturntheOrderCard({id:val.id}).then(res=>{
-        dataDetail.value = res.data.map(val=>({...val,status:val.status==1?t('order.normal'):t('order.unsubscribe')}))
+    ReturntheOrderCard({ id: val.id }).then(res => {
+        dataDetail.value = res.data.map(val => ({ ...val, status: val.status == 1 ? t('order.normal') : t('order.unsubscribe') }))
     })
-},{deep: true})
+}, { deep: true })
 
 onMounted(async () => {
     res1.value = await Getdictionary('Billingcycle')

+ 1 - 1
src/views/tariffManagement/customer/NewCustomerForm.vue

@@ -1,6 +1,6 @@
 <template>
   <a-modal :visible="visible" :title="editMode ? $t('customer.editCustomer') : $t('customer.addCustomer')"
-    :loading="loading" @ok="handleSubmit" @cancel="handleCancel" :width="720" :okText="$t('form.Confirm')"
+    :loading="loading" @ok="handleSubmit" @cancel="handleCancel" :width="800" :okText="$t('form.Confirm')"
     :cancelText="$t('form.Cancel')">
     <a-tabs>
       <!-- 基本信息 Tab -->