Merge branch 'dev' of http://192.168.5.5:10010/r/web/crm-web into dev
New file |
| | |
| | | export default (() => { |
| | | const getDateObj = ms => { |
| | | const now = ms ? new Date(ms) : new Date() |
| | | const y = now.getFullYear() |
| | | let m = now.getMonth() + 1 |
| | | m = m > 9 ? m : '0' + m |
| | | let d = now.getDate() |
| | | d = d > 9 ? d : '0' + d |
| | | return { y, m, d } |
| | | } |
| | | // 获取当前日期 |
| | | const getCurrentDate = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | return '' + dateObj.y + '-' + dateObj.m + '-' + dateObj.d |
| | | } |
| | | //获取当前 前后N天的时间 |
| | | const getDateStr = (AddDayCount = 0) => { |
| | | let dd = new Date() |
| | | dd.setDate(dd.getDate() + AddDayCount) |
| | | let y = dd.getFullYear() |
| | | let m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1) //获取当前月份的日期,不足10补0 |
| | | let d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() //获取当前几号,不足10补0 |
| | | return y + '-' + m + '-' + d |
| | | } |
| | | //获取某个日期 前后N天的时间 |
| | | const getDateDay2 = (time, AddDayCount) => { |
| | | if (time) { |
| | | let dd = new Date(time) |
| | | dd.setDate(dd.getDate() + AddDayCount) |
| | | let y = dd.getFullYear() |
| | | let m = (dd.getMonth() + 1) < 10 ? '0' + (dd.getMonth() + 1) : (dd.getMonth() + 1) //获取当前月份的日期,不足10补0 |
| | | let d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() //获取当前几号,不足10补0 |
| | | return y + '-' + m + '-' + d |
| | | } else { |
| | | return '--' |
| | | } |
| | | } |
| | | //获取当前年份 |
| | | const getCurrentYear = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | return '' + dateObj.y |
| | | } |
| | | // 获取当前月份 |
| | | const getCurrentMonth = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | return '' + dateObj.y + '-' + dateObj.m |
| | | } |
| | | // 获取上月月份 |
| | | const getPreviousMonth = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | const b = dateObj.m - 1 > 0 |
| | | let y = b ? dateObj.y : dateObj.y - 1 |
| | | let m = b ? dateObj.m - 1 : 12 |
| | | m = m > 9 ? m : '0' + m |
| | | return '' + y + '-' + m |
| | | } |
| | | // 获取下月月份 |
| | | const getNextMonth = ms => { |
| | | const dateObj = getDateObj(ms) |
| | | const b = dateObj.m - (-1) != 13; |
| | | let y = b ? dateObj.y : dateObj.y + 1 |
| | | let m = b ? dateObj.m - (-1) : 1 |
| | | m = m > 9 ? m : '0' + m |
| | | return '' + y + '-' + m |
| | | } |
| | | // 格式化时间 ==> yyyy-mm-dd |
| | | const formatDate = (value, str) => { |
| | | if (value) { |
| | | let date_arr = value.split(str) |
| | | let m = date_arr[1].length == 1 && date_arr[1] < 10 ? '0' + date_arr[1] : date_arr[1] |
| | | let d = date_arr[2].length == 1 && date_arr[2] < 10 ? '0' + date_arr[2] : date_arr[2] |
| | | return date_arr[0] + '-' + m + '-' + d |
| | | } else { |
| | | return '--' |
| | | } |
| | | } |
| | | const getK = value => { |
| | | if (value) { |
| | | let date = new Date(value) |
| | | return date |
| | | } else { |
| | | let v = new Date().getTime() |
| | | return v |
| | | } |
| | | } |
| | | //转为时间戳 |
| | | const formatTime = value => { |
| | | if (value) { |
| | | let date = new Date(value) |
| | | return date.getTime() |
| | | } |
| | | } |
| | | const formatDate2 = (time, format = 'YY-MM-DD hh:mm:ss') => { |
| | | if (time) { |
| | | let date = time ? new Date(time) : new Date() |
| | | let year = date.getFullYear(), |
| | | month = date.getMonth() + 1, //月份是从0开始的 |
| | | day = date.getDate(), |
| | | hour = date.getHours(), |
| | | min = date.getMinutes(), |
| | | sec = date.getSeconds() |
| | | let preArr = Array.apply(null, Array(10)).map(function (elem, index) { |
| | | return '0' + index |
| | | }) //开个长度为10的数组 格式为 00 01 02 03 |
| | | |
| | | let newTime = format |
| | | .replace(/YY/g, year) |
| | | .replace(/MM/g, preArr[month] || month) |
| | | .replace(/DD/g, preArr[day] || day) |
| | | .replace(/hh/g, preArr[hour] || hour) |
| | | .replace(/mm/g, preArr[min] || min) |
| | | .replace(/ss/g, preArr[sec] || sec) |
| | | |
| | | return newTime |
| | | } else { |
| | | return '--' |
| | | } |
| | | } |
| | | |
| | | const getLastDay = dateStr => { |
| | | dateStr = dateStr || getCurrentMonth() |
| | | let nextMonthMS = new Date(getNextMonth(new Date(dateStr).getTime())).getTime() |
| | | return getCurrentDate(new Date(nextMonthMS - 1000 * 60 * 60 * 24).getTime()) |
| | | } |
| | | |
| | | // 对比时间 |
| | | const compareTime = (date1, date2) => { |
| | | let d1_date1 = new Date(date1), |
| | | d1_date2 = new Date(date2); |
| | | let time_span1 = d1_date1.getTime(), |
| | | time_span2 = d1_date2.getTime(); |
| | | return time_span1 - time_span2; |
| | | } |
| | | //格式yy-mm month1小的 month2大的 |
| | | const intervalMonth = (month1, month2) => { |
| | | let yearMonth, number; |
| | | let year1 = Number(getCurrentYear(month1)); |
| | | let year2 = Number(getCurrentYear(month2)); |
| | | if (year1 != year2) { |
| | | yearMonth = (year2 - year1) * 12; |
| | | } else { |
| | | yearMonth = 0; |
| | | } |
| | | let min = Number(month1.split('-')[1]); |
| | | let max = Number(month2.split('-')[1]); |
| | | if (min < max) { |
| | | number = max - min + yearMonth + 1 |
| | | } else { |
| | | number = yearMonth - (min - max) + 1 |
| | | } |
| | | return Number(number); |
| | | } |
| | | //获取季度的时间 val 例如 yyyy,1 最终结果 yyyy-mm-dd,yyyy-mm-dd |
| | | const qurterDay = (val) => { |
| | | let value; |
| | | let num = val.split(',')[1] |
| | | if (num == 1) { |
| | | value = val.split(',')[0] + '-01-01,' + val.split(',')[0] + '-03-31' |
| | | } else if (num == 2) { |
| | | value = val.split(',')[0] + '-04-30,' + val.split(',')[0] + '-06-30' |
| | | } else if (num == 3) { |
| | | value = val.split(',')[0] + '-07-31,' + val.split(',')[0] + '-09-30' |
| | | } else if (num == 4) { |
| | | value = val.split(',')[0] + '-10-30,' + val.split(',')[0] + '-12-31' |
| | | } |
| | | return [value, num]; |
| | | } |
| | | //获取某月最后一天 |
| | | const getMonthLastDay = (dateStr) => { |
| | | let dateObj = getNextMonth(dateStr) |
| | | let date = getDateDay2(dateObj + '-01', -1) |
| | | return date |
| | | } |
| | | /*获取当前日期*/ |
| | | const getWeekdayTime = (value) => { |
| | | let d = new Date(value) |
| | | let week = d.getDay() |
| | | let weekday = '' |
| | | if (week == 0) |
| | | weekday = '星期日' |
| | | else if (week == 1) |
| | | weekday = '星期一' |
| | | else if (week == 2) |
| | | weekday = '星期二' |
| | | else if (week == 3) |
| | | weekday = '星期三' |
| | | else if (week == 4) |
| | | weekday = '星期四' |
| | | else if (week == 5) |
| | | weekday = '星期五' |
| | | else if (week == 6) |
| | | weekday = '星期六' |
| | | return weekday |
| | | } |
| | | //计算当前时间到今天结束时还剩多少 毫秒 |
| | | const getRestOfDayTime = () => { |
| | | let x = new Date(); |
| | | x.setHours(0, 0, 0, 0); |
| | | let y = new Date(); |
| | | return 24 * 3600 * 1000 - (y.getTime() - x.getTime()) |
| | | } |
| | | /* 用于月日这种需要加前置0的方法 |
| | | * @param num 需要加0的参数 string | number |
| | | * @return 结果 始终保证结果为字符串 string |
| | | */ |
| | | const paddingZero = (num) => { |
| | | return num < 10 ? "0" + num : String(num) |
| | | } |
| | | return { paddingZero, getDateObj, getCurrentDate, getDateStr, getDateDay2, getCurrentYear, getCurrentMonth, getPreviousMonth, getNextMonth, formatDate, formatDate2, formatTime, getK, compareTime, getLastDay, intervalMonth, getMonthLastDay, qurterDay, getWeekdayTime, getRestOfDayTime } |
| | | })() |
| | |
| | | :data="tableList.tableInfomation" |
| | | tooltip-effect="dark" |
| | | :height="'calc(100% - 0px)'" |
| | | :max-height="tableList.maxHeight" |
| | | style="width: 100%" |
| | | :lazy="tableList.lazy" |
| | | :show-summary="showSummary.show" |
| | |
| | | </div> |
| | | </div> |
| | | <TableCommonView |
| | | class="bg-list" |
| | | ref="tableListRef" |
| | | :table-list="tableList" |
| | | :select-box="editCommonConfig.isSelectBox" |
| | |
| | | isSelectBox:false, |
| | | title: "", |
| | | clientId: 0, |
| | | isRequest:true, |
| | | client_name: "", |
| | | tableInfomation: [] |
| | | } |
| | |
| | | this.showCol = ["报价单号", "销售负责人"] |
| | | this.tableList = { |
| | | selectIndex: true, |
| | | |
| | | tableInfomation: [], |
| | | allcol: [], |
| | | showcol: this.showCol, |
| | |
| | | }, |
| | | // 报价单 |
| | | async getQuotationList() { |
| | | if(!this.editConfig.isRequest){ |
| | | this.tableList.tableInfomation =this.editConfig.tableInfomation.map((item) => { |
| | | return { |
| | | ...item, |
| | | member_name: item.member.username |
| | | } |
| | | }) |
| | | this.pagerOptions.totalCount =this.editConfig.count?this.editConfig.count:0 |
| | | return true; |
| | | } |
| | | await getQuotationList({ |
| | | search_map: this.search_map, |
| | | page: this.pagerOptions.currPage, |
| | |
| | | <style lang="scss" scoped> |
| | | .bg-view { |
| | | margin: 10px; |
| | | .bg-list{ |
| | | min-height:370px; |
| | | } |
| | | .query-bg { |
| | | margin-left: -20px; |
| | | margin-bottom: 10px; |
| | |
| | | width: 100px; |
| | | } |
| | | } |
| | | |
| | | .btn { |
| | | float: right; |
| | | } |
| | |
| | | <el-date-picker |
| | | v-model="editConfig.infomation.start_time" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | :picker-options="pickerOptions" |
| | | style="width: 100%" |
| | | @change="checkDate(editConfig.infomation.start_time,editConfig.infomation.end_time)" |
| | | type="datetime" |
| | | placeholder="选择日期" |
| | | > |
| | |
| | | <el-date-picker |
| | | v-model="editConfig.infomation.end_time" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | :picker-options="pickerOptions" |
| | | type="datetime" |
| | | @change="checkDate(editConfig.infomation.start_time,editConfig.infomation.end_time)" |
| | | style="width: 100%" |
| | | placeholder="选择日期" |
| | | > |
| | |
| | | import { getAddMasterOrder, getUpdateMasterOrder } from "@/api/sales/masterOrder" |
| | | import SelectClientDialog from "@/views/other/commonDialog/SelectClientDialog" |
| | | import codeMixin from "@/components/makepager/mixin/codeMixin" |
| | | import NewDate from "@/api/date"; |
| | | const { compareTime } = NewDate; |
| | | export default { |
| | | name: "QuotationDialog", |
| | | mixins: [codeMixin], |
| | |
| | | infomation: {} |
| | | }, |
| | | clientId: this.editCommonConfig.infomation.client_id, |
| | | objCode: { name: "", page: 0, pageSize: 0, type: "销售总单编码", codeStandID: "" } |
| | | objCode: { name: "", page: 0, pageSize: 0, type: "销售总单编码", codeStandID: "" }, |
| | | pickerOptions: { |
| | | disabledDate(time) { |
| | | return time.getTime() < new Date().getTime() - 86400000; |
| | | }, |
| | | }, |
| | | } |
| | | }, |
| | | created() { |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | checkDate(start,end){ |
| | | if(start&&end){ |
| | | if (compareTime(start, end) > 0) { |
| | | this.$message.error('服务截止时间要晚于服务开始时间!') |
| | | } |
| | | } |
| | | }, |
| | | formInfo() { |
| | | this.objCode.codeStandID = "" |
| | | if (this.editConfig.infomation.codeStandID) { |
| | |
| | | this.$message.error("产品名称不能为空") |
| | | } else { |
| | | for (let i = 0; i < this.tableData.length; i++) { |
| | | if (this.tableData[i].cost || Number(this.tableData[i].cost) == 0) { |
| | | let reg = /^\+?[1-9]\d*$/ |
| | | if (this.tableData[i].cost) { |
| | | let reg =/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; |
| | | if (!reg.test(this.tableData[i].cost)) { |
| | | this.$message.error("成本单价需要填写大于0的2位小数!") |
| | | return true |
| | |
| | | :disabled="isNameChanceEdit || isView" |
| | | ></el-autocomplete> |
| | | <div |
| | | v-if="!isNameChanceEdit && !isView" |
| | | v-if="!isNameChanceEdit && !isView&&editConfig.infomation.client_name" |
| | | class="common-select-btn" |
| | | @click="selClientClick('chance')" |
| | | > |
| | |
| | | :disabled="isAddQuatation || isView" |
| | | ></el-autocomplete> |
| | | <div |
| | | v-if="!isAddQuatation && !isView" |
| | | v-if="!isAddQuatation && !isView&&editConfig.infomation.sale_chance_name" |
| | | class="common-select-btn" |
| | | @click="selClientClick('quotation')" |
| | | > |
| | |
| | | ></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <!-- <el-col :span="12"> |
| | | <el-form-item label="物流公司" prop="logisticCompany"> |
| | | <el-input v-model="editConfig.infomation.logisticCompany" :disabled="isView"></el-input> |
| | | </el-form-item> |
| | |
| | | <el-form-item label="物流单号" prop="logisticNumber"> |
| | | <el-input v-model="editConfig.infomation.logisticNumber" :disabled="isView"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-col> --> |
| | | <el-col :span="12"> |
| | | <el-form-item label="物流费用" prop="logisticCost"> |
| | | <el-input-number |
| | |
| | | if (res.code == 200) { |
| | | console.log(res) |
| | | this.quotationList = res.data.list |
| | | this.count=res.data.count; |
| | | if (value === "全部产品") { |
| | | // this.quotationList.map((item) => { |
| | | // if (item.id === this.editConfig.infomation.quotationId) { |
| | |
| | | restaurants = this.clientList |
| | | console.log(restaurants, "客户单") |
| | | } else if (value === "chance") { |
| | | restaurants = this.saleChancelist |
| | | if(this.editConfig.infomation.client_name){ |
| | | restaurants = this.saleChancelist |
| | | } |
| | | } else if (value === "subbill") { |
| | | restaurants = this.subOrderList |
| | | } else if (value === "quotation") { |
| | | restaurants = this.quotationList |
| | | if(this.editConfig.infomation.sale_chance_name){ |
| | | restaurants = this.quotationList |
| | | } |
| | | } |
| | | var results = queryString ? restaurants.filter(this.createStateFilter(queryString, value)) : restaurants |
| | | cb(results) |
| | |
| | | this.editSelCommonConfig.title = "报价单" |
| | | this.editSelCommonConfig.editVisible = true |
| | | this.editSelCommonConfig.clientId = this.clientId |
| | | this.editSelCommonConfig.isRequest = false |
| | | this.editSelCommonConfig.count=this.count |
| | | this.editSelCommonConfig.tableInfomation = [...this.quotationList] |
| | | } |
| | | }, |
| | |
| | | { label: "产品名称", prop: "name" }, |
| | | { label: "数量", prop: "amount" }, |
| | | { label: "单位", prop: "unit" }, |
| | | { label: "销售单价", prop: "salePrice", price: true }, |
| | | { label: "销售单价", prop: "price", price: true }, |
| | | { label: "成本单价", prop: "cost" }, |
| | | { label: "毛利", prop: "profit" }, |
| | | { label: "毛利率(%)", prop: "margin" }, |
| | |
| | | { label: "销售负责人", prop: "member_name" }, |
| | | { label: "签约日期", prop: "signTime" }, |
| | | { label: "交付日期", prop: "deliveryDate" }, |
| | | { label: "订单来源", prop: "source" }, |
| | | // { label: "订单来源", prop: "source" }, |
| | | { label: "合计", prop: "amountTotal", price: true }, |
| | | { label: "状态", prop: "status", isCallMethod: true, getCallMethod: this.getStatus } |
| | | ], |