|
|
@@ -47,49 +47,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- let formatDate = function (date, fmt) {
|
|
|
- if (typeof date === 'string') {
|
|
|
- date = new Date(Date.parse(date.replace(/-/g, '/')))
|
|
|
- }
|
|
|
- let o = {
|
|
|
- 'M+': date.getMonth() + 1, // 月份
|
|
|
- 'd+': date.getDate(), // 日
|
|
|
- 'h+': 23, // 小时
|
|
|
- 'm+': 59, // 分
|
|
|
- 's+': 59, // 秒
|
|
|
- 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
|
|
|
- 'S': date.getMilliseconds() // 毫秒
|
|
|
- }
|
|
|
- if (/(y+)/.test(fmt)) {
|
|
|
- fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
|
|
- }
|
|
|
- for (let k in o) {
|
|
|
- if (new RegExp('(' + k + ')').test(fmt)) {
|
|
|
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
|
|
|
- }
|
|
|
- }
|
|
|
- return fmt
|
|
|
- }
|
|
|
- let getRealLen = function (str) {
|
|
|
- let len = 0
|
|
|
- for (let i = 0; i < str.length; i++) {
|
|
|
- if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
|
|
|
- len += 2
|
|
|
- } else {
|
|
|
- len++
|
|
|
- }
|
|
|
- }
|
|
|
- return len
|
|
|
- }
|
|
|
- let cutOutString = function (str, length) {
|
|
|
- for (let i = 1; i <= str.length; i++) {
|
|
|
- if (getRealLen(str.substr(0, i)) > length) {
|
|
|
- str = str.substr(0, i - 1)
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- return str
|
|
|
- }
|
|
|
+ import { formatDate, getRealLen, cutOutString } from '~utils/baseUtils'
|
|
|
export default {
|
|
|
props: ['showSayPriceBox'],
|
|
|
data () {
|
|
|
@@ -122,10 +80,8 @@
|
|
|
return formatDate(new Date(), 'yyyy-MM-dd')
|
|
|
},
|
|
|
maxDay: function () {
|
|
|
- let deadDate = new Date()
|
|
|
- deadDate.setMonth(deadDate.getMonth() + 3)
|
|
|
- deadDate.setDate(deadDate.getDate() + 1)
|
|
|
- deadDate = formatDate(deadDate, 'yyyy-MM-dd')
|
|
|
+ let deadDate = new Date().getTime() + 1000 * 60 * 60 * 24 * 90
|
|
|
+ deadDate = formatDate(new Date(deadDate), 'yyyy-MM-dd')
|
|
|
return deadDate
|
|
|
}
|
|
|
},
|