瀏覽代碼

Merge branch 'develop'

yuanliang 1 年之前
父節點
當前提交
7f0b6878e0

+ 37 - 20
src/views/music-library/music-sheet/modal/use-project.tsx

@@ -58,7 +58,7 @@ export default defineComponent({
         KLX: {
           availableType: null as any, //可用途径 ORG 机构 PLATFORM 平台
           musicTagIds: null as any,
-          paymentType: null as any, // 是否收费
+          paymentType: [] as any, // 是否收费
           musicPrice: null as any, // 曲目价格
           topFlag: null as any, // 是否置顶(0:否;1:是)
           exquisiteFlag: null as any, // 精品标志
@@ -228,7 +228,7 @@ export default defineComponent({
           } else if (key === 'KLX') {
             forms.useProjectParamConfig[key]['availableType'] = next.availableType
             forms.useProjectParamConfig[key]['musicTagIds'] = next.musicTagIds?.split(',')||[]
-            forms.useProjectParamConfig[key]['paymentType'] = next.paymentType
+            forms.useProjectParamConfig[key]['paymentType'] = next.paymentType?.split(',')||[]
             forms.useProjectParamConfig[key]['musicPrice'] = next.musicPrice
             forms.useProjectParamConfig[key]['topFlag'] = next.topFlag
             forms.useProjectParamConfig[key]['exquisiteFlag'] = next.exquisiteFlag
@@ -280,6 +280,7 @@ export default defineComponent({
                  let appData = value as any;
                   if (appKey === 'KLX') {
                     appData['musicTagIds'] = appData['musicTagIds'].join(',')
+                    appData['paymentType'] = appData['paymentType'].join(',')
                   }
                   applicationExtends.push({
                     ...appData,
@@ -520,6 +521,7 @@ export default defineComponent({
                               required: klxFileRequire.value,
                               message: '请选择是否收费',
                               trigger:'change',
+                              type:'array'
                             }
                           ]}
                         >
@@ -528,26 +530,41 @@ export default defineComponent({
                             clearable
                             v-model:value={forms.useProjectParamConfig.KLX.paymentType}
                             options={getSelectDataFromObj(musicSheetPaymentType)}
+                            multiple
+                            onUpdate:value={() => {
+                              const free = 'FREE'
+                              if(forms.useProjectParamConfig.KLX.paymentType[forms.useProjectParamConfig.KLX.paymentType.length - 1] == free) {
+                                forms.useProjectParamConfig.KLX.paymentType = [free]
+                              } else if (forms.useProjectParamConfig.KLX.paymentType.length > 1 && forms.useProjectParamConfig.KLX.paymentType.includes(free)) {
+                                forms.useProjectParamConfig.KLX.paymentType.splice(forms.useProjectParamConfig.KLX.paymentType.indexOf(free), 1)
+                              }
+                              if (!forms.useProjectParamConfig.KLX.paymentType.includes('CHARGE')) {
+                                forms.useProjectParamConfig.KLX.musicPrice = 0
+                              }
+                            }}
                           ></NSelect>
                         </NFormItem>
-                        <NFormItem
-                          label="曲目价格"
-                          path="useProjectParamConfig.KLX.musicPrice"
-                          rule={[
-                            {
-                              required: klxFileRequire.value,
-                              message: '请输入曲目价格',
-                              trigger:['input','blur'],
-                              type:'number'
-                            }
-                          ]}
-                        >
-                          <NInputNumber
-                            style={'width:100%'}
-                            placeholder="请输入曲目价格"
-                            v-model:value={forms.useProjectParamConfig.KLX.musicPrice}
-                          />
-                        </NFormItem>
+                        {forms.useProjectParamConfig.KLX.paymentType?.includes('CHARGE') && (
+                            <NFormItem
+                                label="曲目价格"
+                                path="useProjectParamConfig.KLX.musicPrice"
+                                rule={[
+                                  {
+                                    required: klxFileRequire.value,
+                                    message: '请输入曲目价格',
+                                    trigger: ['input', 'blur'],
+                                    type: 'number'
+                                  }
+                                ]}
+                            >
+                              <NInputNumber
+                                  style={'width:100%'}
+                                  placeholder="请输入曲目价格"
+                                  v-model:value={forms.useProjectParamConfig.KLX.musicPrice}
+                              />
+                            </NFormItem>
+                        )
+                        }
                         <NFormItem
                           label="是否置顶"
                           path="useProjectParamConfig.KLX.topFlag"

+ 9 - 36
src/views/music-library/project-music-sheet/module/gyt/music-sheet-gyt.tsx

@@ -1,43 +1,16 @@
-import { defineComponent, onMounted, reactive, ref } from 'vue'
+import {defineComponent, onMounted, reactive, ref} from 'vue'
 import SaveForm from '@components/save-form'
-import {
-  DataTableRowKey,
-  NButton,
-  NCascader,
-  NDataTable,
-  NDatePicker,
-  NDescriptions,
-  NDescriptionsItem,
-  NFormItem,
-  NImage,
-  NInput,
-  NModal,
-  NSelect,
-  NSpace,
-  NTag,
-  useDialog,
-  useMessage
-} from 'naive-ui'
+import {DataTableRowKey, NButton, NCascader, NDataTable, NDatePicker, NDescriptions, NDescriptionsItem, NFormItem, NImage, NInput, NModal, NSelect, NSpace, NTag, useDialog, useMessage} from 'naive-ui'
 import Pagination from '@components/pagination'
 import TheTooltip from '@components/TheTooltip'
-import AddMusic from '@views/music-library/project-music-sheet/module/gym/addMusic'
-import { getMapValueByKey, getSelectDataFromObj } from '@/utils/objectUtil'
-import {
-  musicSheetAudioType,
-  musicSheetPaymentType,
-  musicSheetSourceType,
-  musicSheetType
-} from '@/utils/constant'
-import {
-  musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendStatus,
-  musicSheetApplicationOwnerList,
-  musicSheetPageByApplication,
-  musicSheetStatusList
-} from '@views/music-library/api'
-import { subjectPage, sysApplicationPage } from '@views/system-manage/api'
-import { filterTimes } from '@/utils/dateUtil'
+import AddMusic from '@views/music-library/project-music-sheet/module/gyt/addMusic'
+import {getMapValueByKey, getSelectDataFromObj} from '@/utils/objectUtil'
+import {musicSheetAudioType, musicSheetPaymentType, musicSheetSourceType, musicSheetType} from '@/utils/constant'
+import {musicSheetApplicationExtendCategoryList, musicSheetApplicationExtendStatus, musicSheetApplicationOwnerList, musicSheetPageByApplication} from '@views/music-library/api'
+import {subjectPage, sysApplicationPage} from '@views/system-manage/api'
+import {filterTimes} from '@/utils/dateUtil'
 import deepClone from '@/utils/deep.clone'
-import { getOwnerName } from '@views/music-library/musicUtil'
+import {getOwnerName} from '@views/music-library/musicUtil'
 import UpdateMusic from '@views/music-library/project-music-sheet/module/gyt/updateMusic'
 
 export default defineComponent({

+ 44 - 10
src/views/music-library/project-music-sheet/module/klx/addMusic.tsx

@@ -179,8 +179,8 @@ export default defineComponent({
         params.push({
           ...item,
           musicSheetId: item.id,
-          // musicSheetCategoryId: item.projectMusicCategoryId,
           applicationId: props.appId,
+          paymentType: item.paymentType.join(','),
           musicTagIds: item.musicTagIds.join(','),
           id: null
         })
@@ -348,12 +348,24 @@ export default defineComponent({
                         },
                         [
                           h(NSelect, {
-                            onUpdateValue(v) {
-                              state.globalPaymentType = v
-                            },
+                                value: state.globalPaymentType,
+                                onUpdateValue(v) {
+                                  state.globalPaymentType = v
+                                  const free = 'FREE'
+                                  if (state.globalPaymentType[state.globalPaymentType.length - 1] == free) {
+                                    state.globalPaymentType = [free]
+                                    return
+                                  }
+                                  if (state.globalPaymentType.length > 1 && state.globalPaymentType.includes(free)) {
+                                    state.globalPaymentType.splice(state.globalPaymentType.indexOf(free), 1)
+                                  }
+
+                                },
+                            multiple: true,
                             clearable: true,
                             options: getSelectDataFromObj(musicSheetPaymentType)
-                          })
+                          }
+                          )
                         ]
                       )
                     },
@@ -363,6 +375,10 @@ export default defineComponent({
                       for (let i = 0; i < state.selectRowData.length; i++) {
                         const item = state.selectRowData[i]
                         item.paymentType = state.globalPaymentType
+                        if (!state.globalPaymentType.includes("CHARGE")) {
+                          item.musicPrice = 0
+                          item.musicPriceDisable = true
+                        }
                       }
                     }
                   })
@@ -382,15 +398,26 @@ export default defineComponent({
           )
         },
         key: 'paymentType',
+        width:'180px',
         render: (row: any) => {
           return (
             <NSelect
               placeholder="请选择收费方式"
-              value={row.paymentType}
+              value={row.paymentType as []}
               options={getSelectDataFromObj(musicSheetPaymentType)}
               clearable
-              onUpdateValue={(value) => {
-                row['paymentType'] = value
+              multiple
+              onUpdate:value={(value) => {
+                row.paymentType = value
+                const free = 'FREE'
+                if (row.paymentType[row.paymentType.length - 1] == free) {
+                  row.paymentType = [free]
+                } else if (row.paymentType.length > 1 && row.paymentType.includes(free)) {
+                  row.paymentType.splice(row.paymentType.indexOf(free), 1)
+                }
+                if (!row.paymentType.includes("CHARGE")) {
+                  row.musicPrice = 0
+                }
               }}
             />
           )
@@ -433,7 +460,9 @@ export default defineComponent({
                       if (state.globalMusicPrice) {
                         for (let i = 0; i < state.selectRowData.length; i++) {
                           const item = state.selectRowData[i]
-                          item.musicPrice = state.globalMusicPrice
+                          if (item.paymentType.includes("CHARGE")) { // 只修改包含单曲收费,则价格为0
+                            item.musicPrice = state.globalMusicPrice
+                          }
                         }
                       }
                     }
@@ -459,6 +488,7 @@ export default defineComponent({
             value: row.musicPrice,
             min: 0,
             max: 9999,
+            disabled: !row.paymentType?.includes('CHARGE'),
             onUpdateValue(value: any) {
               row['musicPrice'] = value
             }
@@ -843,7 +873,11 @@ export default defineComponent({
             return row.id === next.id
           })
           if (!find) {
-            state.selectRowData.push(next)
+            state.selectRowData.push({
+              ...next,
+              paymentType: [] as any,
+              musicPriceDisable: false // 默认可以编辑曲目价格
+            })
           }
         }
       })

+ 12 - 1
src/views/music-library/project-music-sheet/module/klx/music-sheet-klx.tsx

@@ -226,6 +226,17 @@ export default defineComponent({
       })
     }
 
+    const getPaymentType = (paymentType: any) => {
+      const paymentTypeName = []
+      if (paymentType && paymentType.length > 0) {
+        for (let i = 0; i < paymentType.length; i++) {
+          const name = getMapValueByKey(paymentType[i], new Map(Object.entries(musicSheetPaymentType)))
+          paymentTypeName.push(name)
+        }
+      }
+      return paymentTypeName.join(',');
+    }
+
     const columns = (): any => {
       return [
         {
@@ -332,7 +343,7 @@ export default defineComponent({
           render: (row: any) => {
             return (
               <div>
-                {getMapValueByKey(row.paymentType, new Map(Object.entries(musicSheetPaymentType)))}
+                {getPaymentType(row.paymentType?.split(','))}
               </div>
             )
           }

+ 33 - 29
src/views/music-library/project-music-sheet/module/klx/updateMusic.tsx

@@ -27,7 +27,7 @@ export default defineComponent({
     const forms = reactive({
       musicTagIds: [] as any,
       sortNo: null as any,
-      paymentType: null as any,
+      paymentType: [] as any,
       musicPrice: null as any,
       availableType: null as any,
       topFlag: null as any,
@@ -50,7 +50,7 @@ export default defineComponent({
       }
       forms.musicTagIds = data[0].musicTagIds?.split(',')
       forms.sortNo = data[0].sortNo
-      forms.paymentType = data[0].paymentType
+      forms.paymentType = data[0].paymentType?.split(',')
       forms.musicPrice = data[0].musicPrice
       forms.availableType = data[0].availableType
       forms.topFlag = data[0].topFlag
@@ -67,6 +67,7 @@ export default defineComponent({
                 ...forms,
                 musicSheetId: state.rowData.id,
                 musicTagIds: forms.musicTagIds.join(','),
+                paymentType: forms.paymentType.join(','),
                 applicationId: props.appId
               }
           ) as any;
@@ -124,37 +125,40 @@ export default defineComponent({
                     options={getSelectDataFromObj(musicSheetPaymentType)}
                     v-model:value={forms.paymentType}
                     multiple
-                    // onChange={() => {
-                    //   console.log(' forms.paymentType', forms.paymentType)
-                    //   console.log(' forms.paymentType include', forms.paymentType?.includes('FREE'))
-                    //   if (forms.paymentType?.includes('FREE')) {
-                    //     forms.paymentType = ['FREE']
-                    //   }
-                    //   console.log(' forms.paymentType', forms.paymentType)
-                    //   return
-                    //
-                    // }}
+                    onUpdate:value={() => {
+                      const free = 'FREE'
+                      if (forms.paymentType[forms.paymentType.length - 1] == free) {
+                        forms.paymentType = [free]
+                      } else if (forms.paymentType.length > 1 && forms.paymentType.includes(free)) {
+                        forms.paymentType.splice(forms.paymentType.indexOf(free), 1)
+                      }
+                      if (!forms.paymentType.includes("CHARGE")) {
+                        forms.musicPrice = 0
+                      }
+                    }}
                     clearable
                 />
               </NFormItem>
 
-              <NFormItem
-                  label="曲目价格"
-                  path="musicPrice"
-                  rule={[
-                    {
-                      required: true,
-                      message: '请输入曲目价格'
-                    }
-                  ]}
-              >
-                <NInputNumber
-                    style={'width:100%'}
-                    placeholder="请输入曲目价格"
-                    v-model:value={forms.musicPrice}
-                    clearable
-                />
-              </NFormItem>
+              {forms.paymentType.includes('CHARGE') && (
+                  <NFormItem
+                      label="曲目价格"
+                      path="musicPrice"
+                      rule={[
+                        {
+                          required: true,
+                          message: '请输入曲目价格'
+                        }
+                      ]}
+                  >
+                    <NInputNumber
+                        style={'width:100%'}
+                        placeholder="请输入曲目价格"
+                        v-model:value={forms.musicPrice}
+                        clearable
+                    />
+                  </NFormItem>
+              )}
               <NFormItem
                   label="可用途径"
                   path="availableType"