|
@@ -1,212 +0,0 @@
|
|
-<template>
|
|
|
|
- <div class="combo-list">
|
|
|
|
- <Modal :title="editData.tips=='1'?'新增套餐':'编辑套餐'" v-model="cShow" class-name="order-model combo-model" :mask-closable="false" @on-visible-change="visibleChange">
|
|
|
|
- <Form ref="combo" :model="combo" :show-message="false" :label-width="240">
|
|
|
|
- <FormItem label="名称" prop="name" class="table-form1">
|
|
|
|
- <Input
|
|
|
|
- v-model="names"
|
|
|
|
- type="text"
|
|
|
|
- :maxlength="4"
|
|
|
|
- placeholder="请输入套餐名称(最多4个中文)"
|
|
|
|
- ></Input>
|
|
|
|
- </FormItem>
|
|
|
|
- <FormItem class="table-form2">
|
|
|
|
- <Table
|
|
|
|
- class="sel-table"
|
|
|
|
- border
|
|
|
|
- ref="selection"
|
|
|
|
- :columns="columns"
|
|
|
|
- :data="editData.lists"
|
|
|
|
- @on-selection-change="selChage"
|
|
|
|
- :summary-method="handleSummary"
|
|
|
|
- show-summary
|
|
|
|
- ></Table>
|
|
|
|
- </FormItem>
|
|
|
|
- </Form>
|
|
|
|
- <div slot="footer">
|
|
|
|
- <div class="tips">此套餐与xxx套餐内容一样,请重新选择</div>
|
|
|
|
- <Button type="primary" size="large" @click="comConfirm()">提交</Button>
|
|
|
|
- <!-- <Button type="primary" size="large" disabled v-else>提交</Button> -->
|
|
|
|
- <Button type="error" size="large" @click="comCancel()">取消</Button>
|
|
|
|
- </div>
|
|
|
|
- </Modal>
|
|
|
|
- </div>
|
|
|
|
-</template>
|
|
|
|
-
|
|
|
|
-<script>
|
|
|
|
-export default {
|
|
|
|
- props: {
|
|
|
|
- editData: {}
|
|
|
|
- },
|
|
|
|
- // computed: {
|
|
|
|
- // names: {
|
|
|
|
- // get() {
|
|
|
|
- // if (this.editData.length == 0) {
|
|
|
|
- // return ''
|
|
|
|
- // } else {
|
|
|
|
- // return this.editData.rows.s_name
|
|
|
|
- // }
|
|
|
|
- // },
|
|
|
|
- // set(val) {
|
|
|
|
- // return val
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- // },
|
|
|
|
- methods: {
|
|
|
|
- wordReg(e) {
|
|
|
|
- console.log(e.target.value)
|
|
|
|
- e.target.value = e.target.value.replace(/[^\u4e00-\u9fa5]+/g,'')
|
|
|
|
- // this.comNames = e.target.value
|
|
|
|
- },
|
|
|
|
- initialized() {
|
|
|
|
- this.names = ''
|
|
|
|
- this.zPrice = 0
|
|
|
|
- this.$refs.selection.selectAll(false)
|
|
|
|
- },
|
|
|
|
- visibleChange(val) {
|
|
|
|
- this.initialized()
|
|
|
|
- },
|
|
|
|
- // 合计
|
|
|
|
- handleSummary ({ columns, data }) {
|
|
|
|
- const sums = {}
|
|
|
|
- columns.forEach((column, index) => {
|
|
|
|
- const key = column.key
|
|
|
|
- if (index === 0) {
|
|
|
|
- sums[key] = {
|
|
|
|
- key,
|
|
|
|
- value: '合计'
|
|
|
|
- }
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- const values = this.sumSel.map(item => Number(item[key]))
|
|
|
|
- if (!values.every(value => isNaN(value))) {
|
|
|
|
- const v = values.reduce((prev, curr) => {
|
|
|
|
- const value = Number(curr);
|
|
|
|
- if (!isNaN(value)) {
|
|
|
|
- return prev + curr;
|
|
|
|
- } else {
|
|
|
|
- return prev;
|
|
|
|
- }
|
|
|
|
- }, 0)
|
|
|
|
- sums[key] = {
|
|
|
|
- key,
|
|
|
|
- value: v
|
|
|
|
- }
|
|
|
|
- this.zPrice = sums.i_price_year.value
|
|
|
|
- } else {
|
|
|
|
- if (key == 's_name') {
|
|
|
|
- sums[key] = {
|
|
|
|
- key,
|
|
|
|
- value: 'N/A'
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- sums[key] = {
|
|
|
|
- key,
|
|
|
|
- value: 0
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- return sums;
|
|
|
|
- },
|
|
|
|
- // 多选
|
|
|
|
- selChage(selection) {
|
|
|
|
- console.log(selection)
|
|
|
|
- let arrs = []
|
|
|
|
- selection.map(v => {
|
|
|
|
- arrs.push(v)
|
|
|
|
- })
|
|
|
|
- // if (this.editData.length == 0) {
|
|
|
|
- // this.sumSel = arrs
|
|
|
|
- // } else {
|
|
|
|
- // let cArr = []
|
|
|
|
- // this.editData.lists.forEach(k => {
|
|
|
|
- // if (k._checked) {
|
|
|
|
- // cArr.push(k)
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // console.log(cArr)
|
|
|
|
- // this.sumSel = Object.assign(cArr,arrs)
|
|
|
|
- // }
|
|
|
|
- // console.log(this.sumSel)
|
|
|
|
- this.sumSel = arrs
|
|
|
|
- // console.log(this.names)
|
|
|
|
- },
|
|
|
|
- comConfirm() {
|
|
|
|
- console.log(this.names)
|
|
|
|
- if (!this.names) {
|
|
|
|
- this.$Notice.warning({
|
|
|
|
- title: "套餐名称不能为空"
|
|
|
|
- })
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- let serverId = []
|
|
|
|
- this.sumSel.forEach(v => {
|
|
|
|
- serverId.push(v.id)
|
|
|
|
- })
|
|
|
|
- console.log(this.editData)
|
|
|
|
- let str = {
|
|
|
|
- id: this.editData.tips == 1 ? '' : this.editData.rows.id,
|
|
|
|
- name: this.names,
|
|
|
|
- price: this.zPrice,
|
|
|
|
- serverids: String(serverId)
|
|
|
|
- }
|
|
|
|
- console.log(str)
|
|
|
|
- // this.$request('/order/updateCombo').data(str).success(() => {
|
|
|
|
- // this.cShow = false
|
|
|
|
- // this.initialized()
|
|
|
|
- // this.$parent.reload()
|
|
|
|
- // }).post()
|
|
|
|
- },
|
|
|
|
- comCancel() {
|
|
|
|
- this.cShow = false
|
|
|
|
- this.initialized()
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- cShow: false,
|
|
|
|
- combo: {},
|
|
|
|
- sumSel: [],
|
|
|
|
- names: '',
|
|
|
|
- zPrice: 0,
|
|
|
|
- columns: [
|
|
|
|
- {
|
|
|
|
- type: 'selection',
|
|
|
|
- width: 40,
|
|
|
|
- align: 'center'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '服务名称',
|
|
|
|
- key: 's_name',
|
|
|
|
- width: 240,
|
|
|
|
- align: 'center',
|
|
|
|
- render: (h, {row}) => {
|
|
|
|
- return h('span', row.s_name ? row.s_name : '-')
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '年价格',
|
|
|
|
- key: 'i_price_year',
|
|
|
|
- align: 'center',
|
|
|
|
- render: (h, {row}) => {
|
|
|
|
- return h('span', row.i_price_year ? row.s_count_year ? row.s_count_year + '个/' + row.i_price_year : row.i_price_year : '-')
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- title: '月价格',
|
|
|
|
- key: 'i_price_month',
|
|
|
|
- align: 'center',
|
|
|
|
- render: (h, {row}) => {
|
|
|
|
- return h('span', row.i_price_month ? row.s_count_month ? row.s_count_month + '个/' + row.i_price_month : row.i_price_month : '-')
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-</script>
|
|
|
|
-
|
|
|
|
-<style lang="scss" scoped>
|
|
|
|
-
|
|
|
|
-</style>
|
|
|