Pārlūkot izejas kodu

课堂乐器曲目添加收费方式字段

yuanliang 1 gadu atpakaļ
vecāks
revīzija
6eedcdf285

+ 93 - 0
src/views/music-library/project-music-sheet/module/kt/addMusic.tsx

@@ -81,6 +81,7 @@ export default defineComponent({
       useProjectData: [] as any, // 适用项目行数据
       userIdDisable: true,
       userIdData: [] as any,
+      globalPaymentType: null as any,
     })
 
     onMounted(async () => {
@@ -173,6 +174,10 @@ export default defineComponent({
           message.error('乐谱教材不能为空')
           return
         }
+        if (!item.paymentType) {
+          message.error('收费方式不能为空')
+          return
+        }
         if (!item.sortNo) {
           item.sortNo = 0
         }
@@ -342,6 +347,94 @@ export default defineComponent({
       field.push({
         title(column: any) {
           return (
+              <NSpace>
+                收费方式
+                <NButton
+                    type="primary"
+                    size="small"
+                    text
+                    onClick={() => {
+                      dialogs.create({
+                        title: '请选择收费方式',
+                        showIcon: false,
+                        content: () => {
+                          return h(
+                              'div',
+                              {
+                                class: 'flex flex-col justify-center items-center text-14px'
+                              },
+                              [
+                                h(NSelect, {
+                                  onUpdateValue(v) {
+                                    state.globalPaymentType = v
+                                  },
+                                  clearable: true,
+                                  options: [
+                                    {
+                                      label:'免费',
+                                      value:'FREE'
+                                    },
+                                    {
+                                      label:'会员',
+                                      value:'VIP'
+                                    }
+                                  ]
+                                })
+                              ]
+                          )
+                        },
+                        positiveText: '确定',
+                        negativeText: '取消',
+                        onPositiveClick: () => {
+                          for (let i = 0; i < state.selectRowData.length; i++) {
+                            const item = state.selectRowData[i]
+                            item.paymentType = state.globalPaymentType
+                          }
+                        }
+                      })
+                    }}
+                >
+                  <NIcon size={15} style="padding-left: 5px;margin-top:4px">
+                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
+                      <path d="M2 26h28v2H2z" fill="currentColor"></path>
+                      <path
+                          d="M25.4 9c.8-.8.8-2 0-2.8l-3.6-3.6c-.8-.8-2-.8-2.8 0l-15 15V24h6.4l15-15zm-5-5L24 7.6l-3 3L17.4 7l3-3zM6 22v-3.6l10-10l3.6 3.6l-10 10H6z"
+                          fill="currentColor"
+                      ></path>
+                    </svg>
+                  </NIcon>
+                </NButton>
+              </NSpace>
+          )
+        },
+        key: 'paymentType',
+        width: 200,
+        render: (row: any) => {
+          return (
+              <NSelect
+                  placeholder="请选择收费方式"
+                  value={row.paymentType}
+                  options={[
+                    {
+                      label:'免费',
+                      value:'FREE'
+                    },
+                    {
+                      label:'会员',
+                      value:'VIP'
+                    }
+                  ]}
+                  clearable
+                  onUpdateValue={(value) => {
+                    row['paymentType'] = value
+                  }}
+              />
+          )
+        }
+      })
+      field.push({
+        title(column: any) {
+          return (
             <NSpace>
               排序
               <NButton

+ 29 - 1
src/views/music-library/project-music-sheet/module/kt/updateMusic.tsx

@@ -1,5 +1,5 @@
 import {defineComponent, onMounted, reactive, ref} from "vue";
-import {NButton, NCascader, NForm, NFormItem, NInputNumber, NSpace, useMessage} from "naive-ui";
+import {NButton, NCascader, NForm, NFormItem, NInputNumber, NSelect, NSpace, useMessage} from "naive-ui";
 import {musicSheetApplicationExtendCategoryApplicationExtendInfo, musicSheetApplicationExtendUpdate} from "@views/music-library/api";
 
 export default defineComponent({
@@ -25,6 +25,7 @@ export default defineComponent({
     const forms = reactive({
       musicSheetCategoryId: null as any,
       sortNo: null as any,
+      paymentType: null as any,
     })
     const formsRef = ref()
 
@@ -43,6 +44,7 @@ export default defineComponent({
       }
       forms.musicSheetCategoryId = data[0].musicSheetCategoryId
       forms.sortNo = data[0].sortNo
+      forms.paymentType = data[0].paymentType
 
     })
 
@@ -102,6 +104,32 @@ export default defineComponent({
                 />
               </NFormItem>
               <NFormItem
+                  label="收费方式"
+                  path="paymentType"
+                  rule={[
+                    {
+                      required: true,
+                      message: '请选择收费方式'
+                    }
+                  ]}
+              >
+                <NSelect
+                    placeholder="请选择收费方式"
+                    options={[
+                      {
+                        label:'免费',
+                        value:'FREE'
+                      },
+                      {
+                        label:'会员',
+                        value:'VIP'
+                      }
+                    ]}
+                    v-model:value={forms.paymentType}
+                    clearable
+                />
+              </NFormItem>
+              <NFormItem
                   label="排序值"
                   path="sortNo"
                   rule={[