Explorar el Código

0114 10:57

多乐器 多提供方式 提测
mo hace 5 años
padre
commit
4f78931bdf

+ 273 - 47
src/views/resetTeaming/components/resetSound.vue

@@ -61,44 +61,42 @@
       </el-table-column>
       <el-table-column label="乐器提供方式"
                        align="center"
-                       prop="fangshi"
-                       width="180">
+                       prop="fangshi">
         <template slot-scope="scope">
           <div>
             <!-- <div class="chiose"
                   >选择</div> -->
-            <span v-if="scope.row.fangshi">{{scope.row.fangshi | fangshiFilter(scope.row.fangshiprice)}}</span>
-            <el-popover placement="bottom"
-                        v-model="scope.row.provideVisible"
-                        v-if='scope.row.type == 1'>
-              <i class='el-icon-edit'
-                 slot='reference'>
-              </i>
-
-              <el-select v-model="scope.row.fangshi"
-                         filterable
-                         clearable>
-                <el-option label="团购"
-                           value="GROUP"></el-option>
-                <el-option label="借用"
-                           value="LEASE"></el-option>
-                <el-option label="免费"
-                           value="FREE"></el-option>
+            <div style='white-space:pre'
+                 v-if="scope.row.fangshi.length >0">{{scope.row.fangshi | fangshiFilter(scope.row)}}</div>
+            <i class='el-icon-edit'
+               @click="setGiveMode(scope.row)">
+            </i>
+            <!-- <el-popover placement="bottom"
+                          v-model="scope.row.provideVisible"
+                          v-if='scope.row.type == 1'>
+                <i class='el-icon-edit'
+                   slot='reference'>
+                </i>
 
-              </el-select>
-              <el-input placeholder="请输入费用"
-                        v-if='scope.row.fangshi == "LEASE"'
-                        v-model="scope.row.fangshiprice"
-                        style='width:180px; margin-top:20px'></el-input>
-              <div style="text-align: right; margin-top: 20px">
-                <!-- <el-button size="mini"
-                             type="text"
-                             @click="scope.row.provideVisible = false">取消</el-button> -->
-                <el-button type="primary"
-                           size="mini"
-                           @click="scope.row.provideVisible  = false">确定</el-button>
-              </div>
-            </el-popover>
+                <el-select v-model="scope.row.fangshi"
+                           clearable>
+                  <el-option label="团购"
+                             value="GROUP"></el-option>
+                  <el-option label="借用"
+                             value="LEASE"></el-option>
+                  <el-option label="免费"
+                             value="FREE"></el-option>
+                </el-select>
+                <el-input placeholder="请输入费用"
+                          v-if='scope.row.fangshi == "LEASE"'
+                          v-model="scope.row.fangshiprice"
+                          style='width:180px; margin-top:20px'></el-input>
+                <div style="text-align: right; margin-top: 20px">
+                  <el-button type="primary"
+                             size="mini"
+                             @click="scope.row.provideVisible  = false">确定</el-button>
+                </div>
+              </el-popover> -->
           </div>
         </template>
       </el-table-column>
@@ -204,7 +202,7 @@
                  id: this.activeSoundList[item].id, //声部id
                  visible: false, // 当前乐器提供方式的pop提示框显示隐藏 -->
               <el-checkbox :label="sound.id"
-                           @change="checkinlist({'id':sound.id,'sound':sound.name,'jihua':0,'yuji':0,'zhonglei':[],'fangshi':'','fangshiprice':1500,'jiaopu':'','type':1,'typeVisible':false,'provideVisible':false,'markVisible':false,'goodsList':[],'markList':[],'markChioseList':[]})"
+                           @change="checkinlist({'id':sound.id,'sound':sound.name,'jihua':0,'yuji':0,'zhonglei':[],'fangshi':[],'fangshiprice':1500,'jiaopu':'','type':1,'typeVisible':false,'provideVisible':false,'markVisible':false,'goodsList':[],'markList':[],'markChioseList':[]})"
                            v-for="(sound,indexs) in item.subjects"
                            :key="indexs">{{sound.name }}</el-checkbox>
             </el-checkbox-group>
@@ -217,6 +215,90 @@
              @click="generates">确定</div>
       </div>
     </el-dialog>
+    <el-dialog tilte='请选择乐器的提供方式及减免金额'
+               width="800px"
+               :visible.sync="reductionVisible">
+      <div v-if="editSound&&editSound.fangshi.length >0">
+        <div class="reductionWrap"
+             v-for="(item,index) in editSound.fangshi"
+             :key='index'>
+          <div class="lineWrap">
+            <div class="item">{{ item.shopName}}</div>
+            <div class="item">提供方式</div>
+            <div class="item">提供方式对应金额</div>
+            <div class="item">减免金额</div>
+          </div>
+
+          <div class="lineWrap">
+            <div class="item"></div>
+            <div class="item">
+              <el-checkbox v-model="item.mode.isGROUP"></el-checkbox>
+              团购
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        @mousewheel.native.prevent
+                        type="number"
+                        v-model="item.mode.price"></el-input>
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        @mousewheel.native.prevent
+                        type="number"
+                        v-model="item.mode.GROUP"></el-input>
+            </div>
+
+          </div>
+
+          <div class="lineWrap">
+            <div class="item"></div>
+            <div class="item">
+              <el-checkbox v-model="item.mode.isLEASE"></el-checkbox>
+              租赁
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        @mousewheel.native.prevent
+                        type="number"
+                        v-model="item.mode.depositFee"></el-input>
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        type="number"
+                        @mousewheel.native.prevent
+                        v-model="item.mode.LEASE"></el-input>
+            </div>
+
+          </div>
+
+          <div class="lineWrap">
+            <div class="item"></div>
+            <div class="item">
+              <el-checkbox v-model="item.mode.isFREE"></el-checkbox>
+              免费
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        @mousewheel.native.prevent
+                        disabled></el-input>
+            </div>
+            <div class="item">
+              <el-input style="width:80%"
+                        type="number"
+                        @mousewheel.native.prevent
+                        v-model="item.mode.FREE"></el-input>
+            </div>
+
+          </div>
+        </div>
+      </div>
+
+      <div slot="footer"
+           class="dialog-footer">
+        <el-button type="primary"
+                   @click="resetSoundItem">确 定</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -225,6 +307,7 @@ export default {
   name: 'resetSound',
   data () {
     return {
+      reductionVisible: false,
       dialogTableVisible: false,
       tableList: [],
       teamid: '',
@@ -234,6 +317,7 @@ export default {
       multipleSelection: [], // 列表选择的集合
       soundList: [],
       soundLists: [], // 存储选中项的声部id 记录变量
+      editSound: null
     }
   },
   mounted () {
@@ -262,7 +346,49 @@ export default {
       findMusicGroupSubjectInfo({ musicGroupId: this.teamid }).then(res => {
         if (res.code == 200) {
           this.activeSoundList = res.data.musicGroupSubjectPlans.map(item => {
-            let obj = { 'id': item.subjectId, 'sound': item.subName, 'jihua': item.expectedStudentNum, 'yuji': item.fee, 'zhonglei': [], 'fangshi': item.kitGroupPurchaseType, 'fangshiprice': item.depositFee, 'jiaopu': '', 'type': 1, 'typeVisible': false, 'provideVisible': false, 'markVisible': false, 'goodsList': [], 'markList': [], 'markChioseList': [] }
+            let fangshi = []
+            res.data.musicGroupSubjectGoodsGroups.forEach(sub => {
+              if (sub.subjectId == item.subjectId && sub.type == 'INSTRUMENT') {
+                let FREE, LEASE, GROUP;
+                let isFREE = false
+                let isLEASE = false
+                let isGROUP = false
+                let depositFee = sub.depositFee
+                let price = sub.price
+                if (sub.kitGroupPurchaseTypeJson) {
+                  let expectJson = JSON.parse(sub.kitGroupPurchaseTypeJson);
+
+                  if (expectJson && expectJson.FREE) {
+                    FREE = expectJson.FREE
+                    isFREE = true
+                  }
+                  if (expectJson && expectJson.LEASE) {
+                    LEASE = expectJson.LEASE
+                    isLEASE = true;
+                  }
+                  if (expectJson && expectJson.GROUP) {
+                    GROUP = expectJson.GROUP
+                    isGROUP = true
+                  }
+                }
+                fangshi.push({
+                  shopName: sub.name,
+                  id: sub.goodsIdList,
+                  mode: {
+                    'FREE': FREE || 0,
+                    'GROUP': GROUP || 0,
+                    'LEASE': LEASE || 0,
+                    'depositFee': depositFee || 0, // 保证金
+                    'price': price || 0,// 团购价
+                    'isFREE': isFREE,
+                    'isGROUP': isGROUP,
+                    'isLEASE': isLEASE,
+                  }
+                })
+              }
+            })
+            let obj = { 'id': item.subjectId, 'sound': item.subName, 'jihua': item.expectedStudentNum, 'yuji': item.fee, 'zhonglei': [], 'fangshi': fangshi, 'fangshiprice': item.depositFee, 'jiaopu': '', 'type': 1, 'typeVisible': false, 'provideVisible': false, 'markVisible': false, 'goodsList': [], 'markList': [], 'markChioseList': [] }
+            this.checkinlist(obj)
             return obj;
           })
           // 这里循环
@@ -355,16 +481,39 @@ export default {
               goodsItem = goods
             }
           })
+          let kitGroupPurchaseTypeJson = ''
+          let price, depositFee;
+          active.fangshi.forEach(fs => {
+            if (fs.id == zl) {
+              price = fs.mode.price
+              depositFee = fs.mode.depositFee
+              let types = {}
+
+              if (fs.mode.isFREE) {
+                types.FREE = fs.mode.FREE
+              }
+              if (fs.mode.isGROUP) {
+                types.GROUP = fs.mode.GROUP
+              }
+              if (fs.mode.isLEASE) {
+                types.LEASE = fs.mode.LEASE
+              }
+              kitGroupPurchaseTypeJson = JSON.stringify(types)
+
+            }
+          })
           let some = {
             subjectId: active.id,
             type: 'INSTRUMENT',
             goodsIdList: zl,
             name: goodsItem.name,
-            price: goodsItem.groupPurchasePrice
+            kitGroupPurchaseTypeJson,
+            price,
+            depositFee
+            // price: goodsItem.groupPurchasePrice
           }
           obj.musicGroupSubjectGoodsGroups.push(some);
         })
-
         // 遍历声部里的教辅
         active.markList.forEach(mark => {
           if (mark.goods.length >= 1) {
@@ -382,13 +531,15 @@ export default {
         let item = {
           expectedStudentNum: active.jihua,
           fee: active.yuji,
-          kitGroupPurchaseType: active.fangshi,
+          // kitGroupPurchaseType: active.fangshi,
           subName: active.sound,
           subjectId: active.id,
           depositFee: active.fangshiprice // depositFee  只有租赁才有
         }
         obj.musicGroupSubjectPlans.push(item);
       })
+      console.log(obj)
+      return
       // 发请求修改声部信息
       updateSubjectInfo(obj).then(res => {
         if (res.code == 200) {
@@ -447,6 +598,53 @@ export default {
     generates () {
       this.dialogTableVisible = false;
     },
+    // 设置乐器提供方式
+    setGiveMode (row) {
+      // goodsList
+      if (row.zhonglei.length <= 0) {
+        this.$message.error('请先选择乐器规格')
+        return
+      }
+      // row.fangshi = []
+      // row.zhonglei
+      // row.goodsList
+      if (row.fangshi[0] && row.fangshi[0].mode) {
+      } else {
+        for (let i in row.goodsList) {
+          for (let j in row.zhonglei) {
+
+            if (row.goodsList[i].id == row.zhonglei[j]) {
+
+              row.fangshi.push({
+                shopName: row.goodsList[i].name,
+                id: row.goodsList[i].id,
+                mode: {
+                  'FREE': 0,
+                  'GROUP': 0,
+                  'LEASE': 0,
+                  'depositFee': 0, // 保证金
+                  'price': 0,// 团购价
+                  'isFREE': false,
+                  'isGROUP': false,
+                  'isLEASE': false,
+                }
+              })
+            }
+          }
+        }
+      }
+
+      this.editSound = row;
+      this.reductionVisible = true
+    },
+    resetSoundItem () {
+      for (let i in this.activeSoundList) {
+        if (this.activeSoundList[i].id == this.editSound.id) {
+          this.activeSoundList[i].id = this.editSound.id
+          this.reductionVisible = false
+        }
+      }
+    }
 
   }, filters: {
     zhongleiFilter (val, list) {
@@ -470,16 +668,29 @@ export default {
     },
     fangshiFilter (val, price) {
       let str = ''
-      if (val == 'FREE') {
-        str = '免费'
-        return str;
-      } else if (val == 'GROUP') {
-        str = '团购'
-        return str
-      } else if (val == 'LEASE') {
-        str = '借用'
+      for (let i in val) {
+        str += `${val[i].shopName}:`
+        if (val[i].mode.isFREE) {
+          str += `免费:0,减免金额${val[i].mode['FREE']}\n`
+        }
+        if (val[i].mode.isGROUP) {
+          str += `团购:${val[i].mode.price},减免金额${val[i].mode['GROUP']}\n`
+        }
+        if (val[i].mode.isLEASE) {
+          str += `租赁:${val[i].mode.depositFee},减免金额${val[i].mode['FREE']}\n`
+        }
       }
-      return str + '费用:' + price
+      // if (val == 'FREE') {
+      //   str = '免费'
+      //   return str;
+      // } else if (val == 'GROUP') {
+      //   str = '团购'
+      //   return str
+      // } else if (val == 'LEASE') {
+      //   str = '借用'
+      // }
+      // str = str.substring(0, str.length - 1)
+      return str
     },
     goodsFilter (val, list) {
       if (list && list.length <= 0) {
@@ -609,4 +820,19 @@ export default {
     cursor: pointer;
   }
 }
+.reductionWrap {
+  width: 100%;
+  .lineWrap {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-around;
+    height: 40px;
+    line-height: 40px;
+    margin-bottom: 10px;
+    .item {
+      width: 25%;
+      text-align: left;
+    }
+  }
+}
 </style>

+ 10 - 0
src/views/teamBuild/components/teamSoundMoney.vue

@@ -358,10 +358,14 @@
             </div>
             <div class="item">
               <el-input style="width:80%"
+                        type="number"
+                        @mousewheel.native.prevent
                         v-model="item.mode.price"></el-input>
             </div>
             <div class="item">
               <el-input style="width:80%"
+                        type="number"
+                        @mousewheel.native.prevent
                         v-model="item.mode.GROUP"></el-input>
             </div>
 
@@ -375,10 +379,14 @@
             </div>
             <div class="item">
               <el-input style="width:80%"
+                        type="number"
+                        @mousewheel.native.prevent
                         v-model="item.mode.depositFee"></el-input>
             </div>
             <div class="item">
               <el-input style="width:80%"
+                        type="number"
+                        @mousewheel.native.prevent
                         v-model="item.mode.LEASE"></el-input>
             </div>
 
@@ -396,6 +404,8 @@
             </div>
             <div class="item">
               <el-input style="width:80%"
+                        type="number"
+                        @mousewheel.native.prevent
                         v-model="item.mode.FREE"></el-input>
             </div>