Browse Source

消除var变量

devlop
邓雄飞 4 years ago
parent
commit
b6e199f410
20 changed files with 553 additions and 545 deletions
  1. 4
      components/qn-data-picker/qn-data-picker.vue
  2. 22
      components/qn-data-pickerview/qn-data-picker.js
  3. 16
      components/qn-datetime-picker/Calendar.js
  4. 2
      pages/account-management/index.vue
  5. 2
      pages/add-account/index.vue
  6. 4
      pages/add-paper/index.vue
  7. 858
      pages/client-detail/news-item.nvue
  8. 46
      pages/mall/index.vue
  9. 2
      pages/mall/no-data.vue
  10. 18
      pages/message/system-message.vue
  11. 2
      pages/paper-detail/index.vue
  12. 26
      pages/quotation-details/index.vue
  13. 6
      pages/store-settings/index.vue
  14. 28
      pages/submit-quotation/index.vue
  15. 8
      pages/trade/quotationList.vue
  16. 2
      pages/user-info/index.vue
  17. 8
      utils/hook.js
  18. 2
      utils/http/http.js
  19. 18
      utils/index.js
  20. 24
      utils/locationTransform.js

4
components/qn-data-picker/qn-data-picker.vue

@ -239,7 +239,7 @@ export default {
this._dispatchEvent(e)
},
_processReadonly(dataList, value) {
var isTree = dataList.findIndex((item) => {
let isTree = dataList.findIndex((item) => {
return item.children
})
if (isTree > -1) {
@ -275,7 +275,7 @@ export default {
}
},
_filterForArray(data, valueArray) {
var result = []
let result = []
for (let value of valueArray) {
let found = data.find((item) => {
return item.value == value

22
components/qn-data-pickerview/qn-data-picker.js

@ -146,7 +146,7 @@ export default {
created() {
this.$watch(
() => {
var al = []
let al = []
;[
'pageCurrent',
'pageSize',
@ -368,7 +368,7 @@ export default {
result.push(`${parentField} == null || ${parentField} == ""`)
}
if (selected.length) {
for (var i = 0; i < selected.length - 1; i++) {
for (let i = 0; i < selected.length - 1; i++) {
result.push(`${parentField} == '${selected[i].value}'`)
}
}
@ -415,15 +415,15 @@ export default {
return this.parentField && this.selfField
},
_updateSelected() {
var dl = this.dataList
var sl = this.selected
let dl = this.dataList
let sl = this.selected
let textField = this.map.text
let valueField = this.map.value
for (var i = 0; i < sl.length; i++) {
var value = sl[i].value
var dl2 = dl[i]
for (let i = 0; i < sl.length; i++) {
let value = sl[i].value
let dl2 = dl[i]
for (let d of dl2) {
var item2 = d
let item2 = d
if (item2[valueField] === value) {
sl[i].text = item2[textField]
break
@ -465,8 +465,8 @@ export default {
})
)
for (let path of paths) {
var value = path.value
var nodes = data.filter((item) => {
let value = path.value
let nodes = data.filter((item) => {
return item.parent_value === value
})
@ -550,7 +550,7 @@ export default {
this._treeData = []
this._extractTree(this.localdata, this._treeData)
var inputValue = this.dataValue
let inputValue = this.dataValue
if (inputValue === undefined) {
return
}

16
components/qn-datetime-picker/Calendar.js

@ -247,16 +247,16 @@ class Calendar {
* @param {Object} end
*/
geDateAll(begin, end) {
var arr = []
var ab = begin.split('-')
var ae = end.split('-')
var db = new Date()
let arr = []
let ab = begin.split('-')
let ae = end.split('-')
let db = new Date()
db.setFullYear(ab[0], ab[1] - 1, ab[2])
var de = new Date()
let de = new Date()
de.setFullYear(ae[0], ae[1] - 1, ae[2])
var unixDb = db.getTime() - 24 * 60 * 60 * 1000
var unixDe = de.getTime() - 24 * 60 * 60 * 1000
for (var k = unixDb; k <= unixDe; ) {
let unixDb = db.getTime() - 24 * 60 * 60 * 1000
let unixDe = de.getTime() - 24 * 60 * 60 * 1000
for (let k = unixDb; k <= unixDe; ) {
k = k + 24 * 60 * 60 * 1000
arr.push(this.getDate(new Date(parseInt(k))).fullDate)
}

2
pages/account-management/index.vue

@ -74,7 +74,7 @@ export default {
this.deleteId = item.id
},
confirm() {
var params = {
let params = {
id: this.deleteId,
enterpriseId: this.$store.state.supplierInfo.id
}

2
pages/add-account/index.vue

@ -133,7 +133,7 @@ export default {
return
}
}
var params = {
let params = {
...this.form,
enterpriseId: this.$store.state.supplierInfo.id
// userId:this.$store.state.userInfo.userId,

4
pages/add-paper/index.vue

@ -396,7 +396,7 @@ export default {
},
//
getDetailList() {
var params = {
let params = {
mallSupplierIds: this.$store.state.supplierInfo.supplierId,
productId: this.option.id
}
@ -517,7 +517,7 @@ export default {
sku.isPromoting = false
}
}
var params = {
let params = {
...this.form,
isMainProduct: this.form.isMainProductRep === 0 ? true : false,
skuList: this.skuList,

858
pages/client-detail/news-item.nvue

@ -1,464 +1,480 @@
<template>
<view class="tabs">
<view class="page">
<!-- <swiper indicator-dots="true">
<view class="tabs">
<view class="page">
<!-- <swiper indicator-dots="true">
<swiper-item v-for="(img, key) in imgUrls" :key="key"><image :src="img" /></swiper-item>
</swiper> -->
</view>
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false" :scroll-into-view="scrollInto">
<view v-for="(tab,index) in tabBars" :key="tab.id" class="uni-tab-item" :id="tab.id" :data-current="index" @click="ontabtap">
<text class="uni-tab-item-title" :class="tabIndex==index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
</view>
</scroll-view>
<view class="line-h"></view>
<swiper :current="tabIndex" class="swiper-box" style="flex: 1;" :duration="300" @change="ontabchange">
<swiper-item class="swiper-item" v-for="(tab,index1) in newsList" :key="index1">
<!-- #ifdef APP-NVUE -->
<list class="scroll-v list" enableBackToTop="true" scroll-y loadmoreoffset="15" @loadmore="loadMore(index1)">
<refresh class="refresh" @refresh="onrefresh(index1)" @pullingdown="onpullingdown" :display="tab.refreshing ? 'show' : 'hide'">
<div class="refresh-view">
<image class="refresh-icon" :src="refreshIcon" :style="{width: (tab.refreshing || pulling) ? 0: '30px'}" :class="{'refresh-icon-active': tab.refreshFlag}"></image>
<loading-indicator class="loading-icon" animating="true" v-if="tab.refreshing"></loading-indicator>
<text class="loading-text">{{tab.refreshText}}</text>
</div>
</refresh>
<cell v-for="(newsitem,index2) in tab.data" :key="newsitem.id">
<media-item :options="newsitem" @close="close(index1,index2)" @click="goDetail(newsitem)"></media-item>
</cell>
<cell class="loading-more" v-if="tab.isLoading || tab.data.length > 4">
<text class="loading-more-text">{{tab.loadingText}}</text>
</cell>
</list>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<scroll-view class="scroll-v list" enableBackToTop="true" scroll-y @scrolltolower="loadMore(index1)">
<view v-for="(newsitem,index2) in tab.data" :key="newsitem.id">
<media-item :options="newsitem" @close="close(index1,index2)" @click="goDetail(newsitem)"></media-item>
</view>
<view class="loading-more" v-if="tab.isLoading || tab.data.length > 4">
<text class="loading-more-text">{{tab.loadingText}}</text>
</view>
</scroll-view>
<!-- #endif -->
</swiper-item>
</swiper>
</view>
</view>
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false" :scroll-into-view="scrollInto">
<view v-for="(tab, index) in tabBars" :key="tab.id" class="uni-tab-item" :id="tab.id" :data-current="index" @click="ontabtap">
<text class="uni-tab-item-title" :class="tabIndex == index ? 'uni-tab-item-title-active' : ''">{{ tab.name }}</text>
</view>
</scroll-view>
<view class="line-h"></view>
<swiper :current="tabIndex" class="swiper-box" style="flex: 1" :duration="300" @change="ontabchange">
<swiper-item class="swiper-item" v-for="(tab, index1) in newsList" :key="index1">
<!-- #ifdef APP-NVUE -->
<list class="scroll-v list" enableBackToTop="true" scroll-y loadmoreoffset="15" @loadmore="loadMore(index1)">
<refresh class="refresh" @refresh="onrefresh(index1)" @pullingdown="onpullingdown" :display="tab.refreshing ? 'show' : 'hide'">
<div class="refresh-view">
<image
class="refresh-icon"
:src="refreshIcon"
:style="{ width: tab.refreshing || pulling ? 0 : '30px' }"
:class="{ 'refresh-icon-active': tab.refreshFlag }"
></image>
<loading-indicator class="loading-icon" animating="true" v-if="tab.refreshing"></loading-indicator>
<text class="loading-text">{{ tab.refreshText }}</text>
</div>
</refresh>
<cell v-for="(newsitem, index2) in tab.data" :key="newsitem.id">
<media-item :options="newsitem" @close="close(index1, index2)" @click="goDetail(newsitem)"></media-item>
</cell>
<cell class="loading-more" v-if="tab.isLoading || tab.data.length > 4">
<text class="loading-more-text">{{ tab.loadingText }}</text>
</cell>
</list>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<scroll-view class="scroll-v list" enableBackToTop="true" scroll-y @scrolltolower="loadMore(index1)">
<view v-for="(newsitem, index2) in tab.data" :key="newsitem.id">
<media-item :options="newsitem" @close="close(index1, index2)" @click="goDetail(newsitem)"></media-item>
</view>
<view class="loading-more" v-if="tab.isLoading || tab.data.length > 4">
<text class="loading-more-text">{{ tab.loadingText }}</text>
</view>
</scroll-view>
<!-- #endif -->
</swiper-item>
</swiper>
</view>
</template>
<script>
import mediaItem from './news-item.nvue';
import mediaItem from './news-item.nvue'
// 缓存每页最多
const MAX_CACHE_DATA = 100;
// 缓存页签数量
const MAX_CACHE_PAGE = 3;
// 缓存每页最多
const MAX_CACHE_DATA = 100
// 缓存页签数量
const MAX_CACHE_PAGE = 3
const newsData = {
data0: {
"datetime": "40分钟前",
"article_type": 0,
"title": "uni-app行业峰会频频亮相,开发者反响热烈!",
"source": "DCloud",
"comment_count": 639
},
data1: {
"datetime": "一天前",
"article_type": 1,
"title": "DCloud完成B2轮融资,uni-app震撼发布!",
"image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg",
"source": "DCloud",
"comment_count": 11395
},
data2: {
"datetime": "一天前",
"article_type": 2,
"title": "中国技术界小奇迹:HBuilder开发者突破200万",
"image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg",
"source": "DCloud",
"comment_count": 11395
},
data3: {
"article_type": 3,
"image_list": [{
"url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg",
"width": 563,
"height": 316
}, {
"url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg",
"width": 641,
"height": 360
}, {
"url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg",
"width": 640,
"height": 360
}],
"datetime": "5分钟前",
"title": "uni-app 支持使用 npm 安装第三方包,生态更趋丰富",
"source": "DCloud",
"comment_count": 11
},
data4: {
"datetime": "2小时前",
"article_type": 4,
"title": "uni-app 支持原生小程序自定义组件,更开放、更自由",
"image_url": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg",
"source": "DCloud",
"comment_count": 69
}
};
const newsData = {
data0: {
datetime: '40分钟前',
article_type: 0,
title: 'uni-app行业峰会频频亮相,开发者反响热烈!',
source: 'DCloud',
comment_count: 639
},
data1: {
datetime: '一天前',
article_type: 1,
title: 'DCloud完成B2轮融资,uni-app震撼发布!',
image_url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg',
source: 'DCloud',
comment_count: 11395
},
data2: {
datetime: '一天前',
article_type: 2,
title: '中国技术界小奇迹:HBuilder开发者突破200万',
image_url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg',
source: 'DCloud',
comment_count: 11395
},
data3: {
article_type: 3,
image_list: [
{
url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg',
width: 563,
height: 316
},
{
url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4cd3000-517d-11eb-a16f-5b3e54966275.jpg',
width: 641,
height: 360
},
{
url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b7c7f970-517d-11eb-97b7-0dc4655d6e68.jpg',
width: 640,
height: 360
}
],
datetime: '5分钟前',
title: 'uni-app 支持使用 npm 安装第三方包,生态更趋丰富',
source: 'DCloud',
comment_count: 11
},
data4: {
datetime: '2小时前',
article_type: 4,
title: 'uni-app 支持原生小程序自定义组件,更开放、更自由',
image_url: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b2e201d0-517d-11eb-8a36-ebb87efcf8c0.jpg',
source: 'DCloud',
comment_count: 69
}
}
export default {
components: {
mediaItem
export default {
components: {
mediaItem
},
data() {
return {
showSwiper: true,
imgUrls: [
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4b60b10-5168-11eb-bd01-97bc1429a9ff.jpg',
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b1dcfa70-5168-11eb-bd01-97bc1429a9ff.jpg'
],
newsList: [],
cacheTab: [],
tabIndex: 0,
tabBars: [
{
name: '关注',
id: 'guanzhu'
},
data() {
return {
showSwiper: true,
imgUrls: [
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b4b60b10-5168-11eb-bd01-97bc1429a9ff.jpg',
'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/b1dcfa70-5168-11eb-bd01-97bc1429a9ff.jpg'
],
newsList: [],
cacheTab: [],
tabIndex: 0,
tabBars: [{
name: '关注',
id: 'guanzhu'
}, {
name: '推荐',
id: 'tuijian'
}, {
name: '体育',
id: 'tiyu'
}, {
name: '热点',
id: 'redian'
}],
scrollInto: "",
showTips: false,
navigateFlag: false,
pulling: false,
refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg=="
}
{
name: '推荐',
id: 'tuijian'
},
/**
* 当 searchInput 配置 disabled 为 true 时触发
*/
onNavigationBarSearchInputClicked(e) {
console.log('事件执行了')
uni.navigateTo({
url: '/pages/index/detail1/detail1'
});
},
/**
* 点击导航栏 buttons 时触发
*/
onNavigationBarButtonTap() {
uni.showModal({
title: '提示',
content: '用户点击了功能按钮,这里仅做展示。',
success: res => {
if (res.confirm) {
console.log('用户点击了确定');
}
}
});
},
onLoad() {
setTimeout(()=>{
this.tabBars.forEach((tabBar) => {
this.newsList.push({
data: [],
isLoading: false,
refreshText: "",
loadingText: '加载更多...'
});
});
this.getList(0);
},350)
{
name: '体育',
id: 'tiyu'
},
methods: {
getList(index) {
let activeTab = this.newsList[index];
let list = [];
for (let i = 1; i <= 10; i++) {
let item = Object.assign({}, newsData['data' + Math.floor(Math.random() * 5)]);
item.id = this.newGuid();
list.push(item);
}
activeTab.data = activeTab.data.concat(list);
},
goDetail(e) {
if (this.navigateFlag) {
return;
}
this.navigateFlag = true;
uni.navigateTo({
url: './detail/detail?title=' + e.title
});
setTimeout(() => {
this.navigateFlag = false;
}, 200)
},
close(index1, index2) {
uni.showModal({
content: '是否删除本条信息?',
success: (res) => {
if (res.confirm) {
this.newsList[index1].data.splice(index2, 1);
}
}
})
},
loadMore(e) {
setTimeout(() => {
this.getList(this.tabIndex);
}, 500)
},
ontabtap(e) {
let index = e.target.dataset.current || e.currentTarget.dataset.current;
this.switchTab(index);
},
ontabchange(e) {
let index = e.target.current || e.detail.current;
this.switchTab(index);
},
switchTab(index) {
if (this.newsList[index].data.length === 0) {
this.getList(index);
}
{
name: '热点',
id: 'redian'
}
],
scrollInto: '',
showTips: false,
navigateFlag: false,
pulling: false,
refreshIcon:
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg=='
}
},
/**
* 当 searchInput 配置 disabled 为 true 时触发
*/
onNavigationBarSearchInputClicked(e) {
console.log('事件执行了')
uni.navigateTo({
url: '/pages/index/detail1/detail1'
})
},
/**
* 点击导航栏 buttons 时触发
*/
onNavigationBarButtonTap() {
uni.showModal({
title: '提示',
content: '用户点击了功能按钮,这里仅做展示。',
success: (res) => {
if (res.confirm) {
console.log('用户点击了确定')
}
}
})
},
onLoad() {
setTimeout(() => {
this.tabBars.forEach((tabBar) => {
this.newsList.push({
data: [],
isLoading: false,
refreshText: '',
loadingText: '加载更多...'
})
})
this.getList(0)
}, 350)
},
methods: {
getList(index) {
let activeTab = this.newsList[index]
let list = []
for (let i = 1; i <= 10; i++) {
let item = Object.assign({}, newsData['data' + Math.floor(Math.random() * 5)])
item.id = this.newGuid()
list.push(item)
}
activeTab.data = activeTab.data.concat(list)
},
goDetail(e) {
if (this.navigateFlag) {
return
}
this.navigateFlag = true
uni.navigateTo({
url: './detail/detail?title=' + e.title
})
setTimeout(() => {
this.navigateFlag = false
}, 200)
},
close(index1, index2) {
uni.showModal({
content: '是否删除本条信息?',
success: (res) => {
if (res.confirm) {
this.newsList[index1].data.splice(index2, 1)
}
}
})
},
loadMore(e) {
setTimeout(() => {
this.getList(this.tabIndex)
}, 500)
},
ontabtap(e) {
let index = e.target.dataset.current || e.currentTarget.dataset.current
this.switchTab(index)
},
ontabchange(e) {
let index = e.target.current || e.detail.current
this.switchTab(index)
},
switchTab(index) {
if (this.newsList[index].data.length === 0) {
this.getList(index)
}
if (this.tabIndex === index) {
return;
}
if (this.tabIndex === index) {
return
}
// 缓存 tabId
if (this.newsList[this.tabIndex].data.length > MAX_CACHE_DATA) {
let isExist = this.cacheTab.indexOf(this.tabIndex);
if (isExist < 0) {
this.cacheTab.push(this.tabIndex);
//console.log("cache index:: " + this.tabIndex);
}
}
// 缓存 tabId
if (this.newsList[this.tabIndex].data.length > MAX_CACHE_DATA) {
let isExist = this.cacheTab.indexOf(this.tabIndex)
if (isExist < 0) {
this.cacheTab.push(this.tabIndex)
//console.log("cache index:: " + this.tabIndex);
}
}
this.tabIndex = index;
this.scrollInto = this.tabBars[index].id;
this.tabIndex = index
this.scrollInto = this.tabBars[index].id
// 释放 tabId
if (this.cacheTab.length > MAX_CACHE_PAGE) {
let cacheIndex = this.cacheTab[0];
this.clearTabData(cacheIndex);
this.cacheTab.splice(0, 1);
//console.log("remove cache index:: " + cacheIndex);
}
},
clearTabData(e) {
this.newsList[e].data.length = 0;
this.newsList[e].loadingText = "加载更多...";
},
refreshData() {},
onrefresh(e) {
var tab = this.newsList[this.tabIndex];
if (!tab.refreshFlag) {
return;
}
tab.refreshing = true;
tab.refreshText = "正在刷新...";
// 释放 tabId
if (this.cacheTab.length > MAX_CACHE_PAGE) {
let cacheIndex = this.cacheTab[0]
this.clearTabData(cacheIndex)
this.cacheTab.splice(0, 1)
//console.log("remove cache index:: " + cacheIndex);
}
},
clearTabData(e) {
this.newsList[e].data.length = 0
this.newsList[e].loadingText = '加载更多...'
},
refreshData() {},
onrefresh(e) {
let tab = this.newsList[this.tabIndex]
if (!tab.refreshFlag) {
return
}
tab.refreshing = true
tab.refreshText = '正在刷新...'
setTimeout(() => {
this.refreshData();
this.pulling = true;
tab.refreshing = false;
tab.refreshFlag = false;
tab.refreshText = "已刷新";
setTimeout(() => { // TODO fix ios和Android 动画时间相反问题
this.pulling = false;
}, 500);
}, 2000);
},
onpullingdown(e) {
var tab = this.newsList[this.tabIndex];
if (tab.refreshing || this.pulling) {
return;
}
if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
tab.refreshFlag = true;
tab.refreshText = "释放立即刷新";
} else {
tab.refreshFlag = false;
tab.refreshText = "下拉可以刷新";
}
},
newGuid() {
let s4 = function() {
return (65536 * (1 + Math.random()) | 0).toString(16).substring(1);
}
return (s4() + s4() + "-" + s4() + "-4" + s4().substr(0, 3) + "-" + s4() + "-" + s4() + s4() + s4()).toUpperCase();
}
}
setTimeout(() => {
this.refreshData()
this.pulling = true
tab.refreshing = false
tab.refreshFlag = false
tab.refreshText = '已刷新'
setTimeout(() => {
// TODO fix ios和Android 动画时间相反问题
this.pulling = false
}, 500)
}, 2000)
},
onpullingdown(e) {
let tab = this.newsList[this.tabIndex]
if (tab.refreshing || this.pulling) {
return
}
if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
tab.refreshFlag = true
tab.refreshText = '释放立即刷新'
} else {
tab.refreshFlag = false
tab.refreshText = '下拉可以刷新'
}
},
newGuid() {
let s4 = function () {
return ((65536 * (1 + Math.random())) | 0).toString(16).substring(1)
}
return (s4() + s4() + '-' + s4() + '-4' + s4().substr(0, 3) + '-' + s4() + '-' + s4() + s4() + s4()).toUpperCase()
}
}
}
</script>
<style>
image,
swiper,
.img-view {
width: 750rpx;
width: 100%;
height: 500rpx;
}
.page-section-title {
margin-top: 50rpx;
}
/* #ifndef APP-PLUS */
page {
width: 100%;
min-height: 100%;
display: flex;
}
image,
swiper,
.img-view {
width: 750rpx;
width: 100%;
height: 500rpx;
}
.page-section-title {
margin-top: 50rpx;
}
/* #ifndef APP-PLUS */
page {
width: 100%;
min-height: 100%;
display: flex;
}
/* #endif */
/* #endif */
.tabs {
flex: 1;
flex-direction: column;
overflow: hidden;
background-color: #ffffff;
/* #ifndef APP-PLUS */
height: 100vh;
/* #endif */
}
.tabs {
flex: 1;
flex-direction: column;
overflow: hidden;
background-color: #ffffff;
/* #ifndef APP-PLUS */
height: 100vh;
/* #endif */
}
.scroll-h {
width: 750rpx;
/* #ifdef H5 */
width:100%;
/* #endif */
height: 80rpx;
flex-direction: row;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
/* flex-wrap: nowrap; */
/* border-color: #cccccc;
.scroll-h {
width: 750rpx;
/* #ifdef H5 */
width: 100%;
/* #endif */
height: 80rpx;
flex-direction: row;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
/* flex-wrap: nowrap; */
/* border-color: #cccccc;
border-bottom-style: solid;
border-bottom-width: 1px; */
}
}
.line-h {
height: 1rpx;
background-color: #cccccc;
}
.line-h {
height: 1rpx;
background-color: #cccccc;
}
.uni-tab-item {
/* #ifndef APP-PLUS */
display: inline-block;
/* #endif */
flex-wrap: nowrap;
padding-left: 34rpx;
padding-right: 34rpx;
}
.uni-tab-item {
/* #ifndef APP-PLUS */
display: inline-block;
/* #endif */
flex-wrap: nowrap;
padding-left: 34rpx;
padding-right: 34rpx;
}
.uni-tab-item-title {
color: #555;
font-size: 30rpx;
height: 80rpx;
line-height: 80rpx;
flex-wrap: nowrap;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
}
.uni-tab-item-title {
color: #555;
font-size: 30rpx;
height: 80rpx;
line-height: 80rpx;
flex-wrap: nowrap;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
}
.uni-tab-item-title-active {
color: #007AFF;
}
.uni-tab-item-title-active {
color: #007aff;
}
.swiper-box {
flex: 1;
}
.swiper-box {
flex: 1;
}
.swiper-item {
flex: 1;
flex-direction: row;
}
.swiper-item {
flex: 1;
flex-direction: row;
}
.scroll-v {
flex: 1;
/* #ifndef MP-ALIPAY */
flex-direction: column;
/* #endif */
width: 750rpx;
width:100%;
}
.scroll-v {
flex: 1;
/* #ifndef MP-ALIPAY */
flex-direction: column;
/* #endif */
width: 750rpx;
width: 100%;
}
.update-tips {
position: absolute;
left: 0;
top: 41px;
right: 0;
padding-top: 5px;
padding-bottom: 5px;
background-color: #FDDD9B;
align-items: center;
justify-content: center;
text-align: center;
}
.update-tips {
position: absolute;
left: 0;
top: 41px;
right: 0;
padding-top: 5px;
padding-bottom: 5px;
background-color: #fddd9b;
align-items: center;
justify-content: center;
text-align: center;
}
.update-tips-text {
font-size: 14px;
color: #ffffff;
}
.update-tips-text {
font-size: 14px;
color: #ffffff;
}
.refresh {
width: 750rpx;
width:100%;
height: 64px;
justify-content: center;
}
.refresh {
width: 750rpx;
width: 100%;
height: 64px;
justify-content: center;
}
.refresh-view {
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
}
.refresh-view {
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: center;
}
.refresh-icon {
width: 30px;
height: 30px;
transition-duration: .5s;
transition-property: transform;
transform: rotate(0deg);
transform-origin: 15px 15px;
}
.refresh-icon {
width: 30px;
height: 30px;
transition-duration: 0.5s;
transition-property: transform;
transform: rotate(0deg);
transform-origin: 15px 15px;
}
.refresh-icon-active {
transform: rotate(180deg);
}
.refresh-icon-active {
transform: rotate(180deg);
}
.loading-icon {
width: 20px;
height: 20px;
margin-right: 5px;
color: #999999;
}
.loading-icon {
width: 20px;
height: 20px;
margin-right: 5px;
color: #999999;
}
.loading-text {
margin-left: 2px;
font-size: 16px;
color: #999999;
}
.loading-text {
margin-left: 2px;
font-size: 16px;
color: #999999;
}
.loading-more {
align-items: center;
justify-content: center;
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
}
.loading-more {
align-items: center;
justify-content: center;
padding-top: 10px;
padding-bottom: 10px;
text-align: center;
}
.loading-more-text {
font-size: 28rpx;
color: #999;
}
.loading-more-text {
font-size: 28rpx;
color: #999;
}
</style>

46
pages/mall/index.vue

@ -108,7 +108,7 @@ export default {
components: { uGap, noData, notLogged },
filters: {
timeFilter(value) {
var abs = ''
let abs = ''
if (value) {
abs = getTimer(value)
}
@ -181,28 +181,24 @@ export default {
},
//
getSupplier(id) {
storeDetail(id)
.then((res) => {
if (res) {
this.storeInfo = res
this.$set(this.storeInformation, 'productNumber', res.productNumber)
this.$set(this.storeInformation, 'currentProductNumber', res.currentProductNumber)
this.$set(this.storeInformation, 'name', res.name)
if (!res.logo) {
this.logo = '/static/imgs/mine/user-avatar.png'
} else {
this.logo = res.logo
}
if (!res.backgroundImg) {
this.backgroundStyle = 'background: url("/static/imgs/mall/top-bg.png") no-repeat;'
} else {
this.backgroundStyle = 'background: url(' + res.backgroundImg + ') no-repeat;'
}
storeDetail(id).then((res) => {
if (res) {
this.storeInfo = res
this.$set(this.storeInformation, 'productNumber', res.productNumber)
this.$set(this.storeInformation, 'currentProductNumber', res.currentProductNumber)
this.$set(this.storeInformation, 'name', res.name)
if (!res.logo) {
this.logo = '/static/imgs/mine/user-avatar.png'
} else {
this.logo = res.logo
}
})
.catch((err) => {
reject(err)
})
if (!res.backgroundImg) {
this.backgroundStyle = 'background: url("/static/imgs/mall/top-bg.png") no-repeat;'
} else {
this.backgroundStyle = 'background: url(' + res.backgroundImg + ') no-repeat;'
}
}
})
},
//
queryData() {
@ -252,14 +248,14 @@ export default {
},
//
nativeTo() {
var params = {
let params = {
title: '添加纸品'
}
go2('add-paper', params)
},
//
editPaper(item) {
var params = {
let params = {
...item,
title: '编辑纸品'
}
@ -275,7 +271,7 @@ export default {
},
//
productStatusChange(item) {
var params = {
let params = {
id: item.id,
status: item.status === 30111 ? 30112 : 30111
}

2
pages/mall/no-data.vue

@ -23,7 +23,7 @@ export default {
methods: {
//
nativeTo() {
var params = {
let params = {
title: '添加纸品'
}
go2('add-paper', params)

18
pages/message/system-message.vue

@ -5,7 +5,7 @@
<view class="system-message-main">
<view class="system-message-main-top">
<view class="system-message-title">
<view>{{ item.messageType | meesageTypeFilter }}</view>
<view>{{ item.messageType | messageTypeFilter }}</view>
<view class="dian" v-if="item.readOrNot === 0"></view>
</view>
<view class="system-message-subtitle">{{ item.createTime }}</view>
@ -37,8 +37,8 @@ export default {
}
},
filters: {
meesageTypeFilter(value) {
var mes = ''
messageTypeFilter(value) {
let mes = ''
if (value) {
switch (value) {
case 1:
@ -73,8 +73,8 @@ export default {
systemMessageList({ ...this.pagination })
.then((res) => {
if (res) {
var data = res.records
var count = 0
let data = res.records
let count = 0
for (let item of data) {
if (item.readOrNot === 0) {
count = count + 1
@ -118,13 +118,13 @@ export default {
this.$refs.messageRef.refreshFail()
})
},
allread() {
allRead() {
return new Promise((resolve, reject) => {
var meesage = this.list.map((item) => {
let message = this.list.map((item) => {
return item.id
})
var params = {
messageIds: meesage
let params = {
messageIds: message
}
systemRead(params)
.then((res) => {

2
pages/paper-detail/index.vue

@ -146,7 +146,7 @@ export default {
back,
//
getDetailList() {
var params = {
let params = {
mallSupplierIds: this.$store.state.supplierInfo.supplierId,
productId: this.id
}

26
pages/quotation-details/index.vue

@ -143,30 +143,26 @@ export default {
back,
//
getDetail(id) {
enquiryReplyDetail(id)
.then((res) => {
if (res) {
this.upDataObj = res
this.$set(this.upDataObj, 'otherFee', 0)
this.$set(this.upDataObj, 'totalAllPrice', 0)
this.priceFree()
}
})
.catch((err) => {
reject(err)
})
enquiryReplyDetail(id).then((res) => {
if (res) {
this.upDataObj = res
this.$set(this.upDataObj, 'otherFee', 0)
this.$set(this.upDataObj, 'totalAllPrice', 0)
this.priceFree()
}
})
},
priceFree() {
for (let item of this.upDataObj.itemList) {
var totalAllPrice = parseFloat(this.upDataObj.totalAllPrice) + parseFloat(item.totalPrice)
let totalAllPrice = parseFloat(this.upDataObj.totalAllPrice) + parseFloat(item.totalPrice)
this.upDataObj.totalAllPrice = round(totalAllPrice, 2)
var otherFee = parseFloat(this.upDataObj.otherFee) + parseFloat(item.otherFee)
let otherFee = parseFloat(this.upDataObj.otherFee) + parseFloat(item.otherFee)
this.upDataObj.otherFee = round(otherFee, 2)
}
},
//
editPrice() {
var params = {
let params = {
title: '修改报价',
id: this.upDataObj.id
}

6
pages/store-settings/index.vue

@ -99,7 +99,7 @@ export default {
this.background = this.option.backgroundImg
this.logo = this.option.logo
if (this.option.logo) {
var logoImage = {
let logoImage = {
name: 'text',
type: 'image',
url: this.option.logo
@ -107,7 +107,7 @@ export default {
this.logoImage.push(logoImage)
}
if (this.option.backgroundImg) {
var backgroundImage = {
let backgroundImage = {
name: 'text',
type: 'image',
url: this.option.backgroundImg
@ -155,7 +155,7 @@ export default {
},
//
uploadSet() {
var params = {
let params = {
backgroundImg: this.background,
id: this.$store.state.supplierInfo.id,
logo: this.logo,

28
pages/submit-quotation/index.vue

@ -303,8 +303,8 @@ export default {
})
},
setEnquiryTime(time) {
var timeb = time.split(' ')
var timeabs = timeb[1].split(':')
let timeb = time.split(' ')
let timeabs = timeb[1].split(':')
this.$set(this.upDataObj, 'enquiryValidTimeSplit', timeabs)
},
countTime() {
@ -382,7 +382,7 @@ export default {
pickerSure() {
console.log('timeValue', this.timeValue)
this.$refs.popupTime.close()
var abs = this.addDate(new Date(), this.timeValue[0] + 1, this.timeValue[1] + 1)
let abs = this.addDate(new Date(), this.timeValue[0] + 1, this.timeValue[1] + 1)
this.curStartTime = abs
this.$set(this.upDataObj, 'enquiryValidTime', abs)
console.log(abs)
@ -394,11 +394,11 @@ export default {
date = new Date(date)
date.setDate(date.getDate() + days)
date.setHours(date.getHours() + hours)
var month = date.getMonth() + 1
var day = date.getDate()
let month = date.getMonth() + 1
let day = date.getDate()
hours = date.getHours()
var min = date.getMinutes()
var second = date.getSeconds()
let min = date.getMinutes()
let second = date.getSeconds()
return (
date.getFullYear() +
'-' +
@ -418,7 +418,7 @@ export default {
return ''
}
var re = arg + ''
let re = arg + ''
if (re.length < 2) {
re = '0' + re
}
@ -465,7 +465,7 @@ export default {
},
//
pricesUnitFee(item) {
var abs = parseFloat(this.prices.unitFee) * parseFloat(this.prices.weight)
let abs = parseFloat(this.prices.unitFee) * parseFloat(this.prices.weight)
this.prices.totalPrice = round(abs, 2)
},
//
@ -475,7 +475,7 @@ export default {
}
this.$set(this.upDataObj.itemList[this.pricesIndex], 'otherFee', this.prices.otherFee)
this.$set(this.upDataObj.itemList[this.pricesIndex], 'unitFee', this.prices.unitFee)
var abs = round(this.prices.unitFee * this.prices.weight, 2)
let abs = round(this.prices.unitFee * this.prices.weight, 2)
this.$set(this.upDataObj.itemList[this.pricesIndex], 'totalPrice', round(abs, 2))
this.upDataObj = JSON.parse(JSON.stringify(this.upDataObj))
this.$refs.popupPrice.close()
@ -486,16 +486,16 @@ export default {
this.upDataObj.totalAllPrice = 0
this.upDataObj.otherFee = 0
for (let item of this.upDataObj.itemList) {
var totalAllPrice = parseFloat(this.upDataObj.totalAllPrice) + parseFloat(item.totalPrice)
let totalAllPrice = parseFloat(this.upDataObj.totalAllPrice) + parseFloat(item.totalPrice)
this.upDataObj.totalAllPrice = round(totalAllPrice, 2)
var otherFee = parseFloat(this.upDataObj.otherFee) + parseFloat(item.otherFee)
let otherFee = parseFloat(this.upDataObj.otherFee) + parseFloat(item.otherFee)
this.upDataObj.otherFee = round(otherFee, 2)
}
this.upDataObj.totalAllPrice = round(this.upDataObj.totalAllPrice + this.upDataObj.otherFee, 2)
},
//
updateQuery() {
for (let target of this.upDataObj.itemList[i]) {
for (let target of this.upDataObj.itemList) {
if (target.weight == 0 || target.unitFee == 0 || target.totalPrice == 0) {
uni.showToast({
title: '请填写报价完整信息,费用、单价、重量不能为0',
@ -504,7 +504,7 @@ export default {
return
}
}
var params = {
let params = {
...this.upDataObj,
// remark: this.quotationRemark, //
userId: this.$store.state.userInfo.userId

8
pages/trade/quotationList.vue

@ -127,7 +127,7 @@ export default {
},
methods: {
//
getQuotationQurty() {
getQuotationQuery() {
return new Promise((resolve, reject) => {
getEnterpriseList({ ...this.params, ...this.pagination })
.then((res) => {
@ -151,7 +151,7 @@ export default {
//
quotationUp(page) {
this.pagination.pageNum++
this.getQuotationQurty()
this.getQuotationQuery()
.then(({ list, total }) => {
this.$refs.quotationRef.refreshSuccess({ list, total })
})
@ -162,7 +162,7 @@ export default {
//
quotationDown() {
this.pagination.pageNum = 1
this.getQuotationQurty()
this.getQuotationQuery()
.then(({ list, total }) => {
this.$refs.quotationRef.refreshSuccess({ list, total })
})
@ -172,7 +172,7 @@ export default {
},
//
offerClick(item) {
var params = {
let params = {
...item,
title: '提交报价'
}

2
pages/user-info/index.vue

@ -40,7 +40,7 @@ export default {
})
return
}
var params = {
let params = {
userId: this.$store.state.userInfo.userId,
name: this.name,
enterpriseId: this.$store.state.supplierInfo.id

8
utils/hook.js

@ -169,11 +169,11 @@ export function uploadFile(path, type = 'image') {
* 屏幕截图并保存到相册(不包含状态栏和tabBar),原理就是用webview的draw方法
*/
export function screenShot() {
var pages = getCurrentPages()
var page = pages[pages.length - 1]
var bitmap = null
let pages = getCurrentPages()
let page = pages[pages.length - 1]
let bitmap = null
// 获取当前页面 webview 的对象实例
var currentWebview = page.$getAppWebview()
let currentWebview = page.$getAppWebview()
bitmap = new plus.nativeObj.Bitmap('amway_img')
// 将webview内容绘制到Bitmap对象中
currentWebview.draw(

2
utils/http/http.js

@ -73,7 +73,7 @@ export default class Http {
}
// config:{}
uploadFile(config, options) {
return new Promise((resolve, rejetc) => {
return new Promise((resolve, reject) => {
let conf = Object.assign({}, config)
conf.url = uploadUrl
const { reqInterceptor } = this

18
utils/index.js

@ -35,16 +35,16 @@ export const dateTimeFormat = (date, fmt) => {
* @param stringTime 需要转换的日期
*/
export const getTimer = (stringTime) => {
var minute = 1000 * 60
var hour = minute * 60
var day = hour * 24
var week = day * 7
var month = day * 30
var time1 = new Date().getTime() //当前的时间戳
var time2 = Date.parse(new Date(stringTime)) //指定时间的时间戳
var time = time1 - time2
let minute = 1000 * 60
let hour = minute * 60
let day = hour * 24
let week = day * 7
let month = day * 30
let time1 = new Date().getTime() //当前的时间戳
let time2 = Date.parse(new Date(stringTime)) //指定时间的时间戳
let time = time1 - time2
var result = null
let result = null
if (time / month >= 1) {
result = parseInt(time / month) + '月前'
} else if (time / week >= 1) {

24
utils/locationTransform.js

@ -1,6 +1,6 @@
var pi = 3.14159265358979324
var a = 6378245.0
var ee = 0.00669342162296594323
const pi = 3.14159265358979324
const a = 6378245.0
const ee = 0.00669342162296594323
/**
* WGS84坐标转换GCJ02坐标
@ -9,22 +9,22 @@ var ee = 0.00669342162296594323
* @return Array[lat:gcj纬度,lon:gcj经度]
*/
function wgs84togcj02(wgLat, wgLon) {
var mgLat, mgLon
let mgLat, mgLon
if (outOfChina(wgLat, wgLon)) {
console.log('out of china')
return
}
var dLat = transformLat(wgLon - 105.0, wgLat - 35.0)
var dLon = transformLon(wgLon - 105.0, wgLat - 35.0)
var radLat = (wgLat / 180.0) * pi
var magic = Math.sin(radLat)
let dLat = transformLat(wgLon - 105.0, wgLat - 35.0)
let dLon = transformLon(wgLon - 105.0, wgLat - 35.0)
let radLat = (wgLat / 180.0) * pi
let magic = Math.sin(radLat)
magic = 1 - ee * magic * magic
var sqrtMagic = Math.sqrt(magic)
let sqrtMagic = Math.sqrt(magic)
dLat = (dLat * 180.0) / (((a * (1 - ee)) / (magic * sqrtMagic)) * pi)
dLon = (dLon * 180.0) / ((a / sqrtMagic) * Math.cos(radLat) * pi)
mgLat = wgLat + dLat
mgLon = wgLon + dLon
var arr = {}
let arr = {}
arr['lat'] = mgLat
arr['lon'] = mgLon
return arr
@ -35,14 +35,14 @@ function outOfChina(lat, lon) {
return false
}
function transformLat(x, y) {
var ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x))
ret += ((20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0) / 3.0
ret += ((20.0 * Math.sin(y * pi) + 40.0 * Math.sin((y / 3.0) * pi)) * 2.0) / 3.0
ret += ((160.0 * Math.sin((y / 12.0) * pi) + 320 * Math.sin((y * pi) / 30.0)) * 2.0) / 3.0
return ret
}
function transformLon(x, y) {
var ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x))
ret += ((20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0) / 3.0
ret += ((20.0 * Math.sin(x * pi) + 40.0 * Math.sin((x / 3.0) * pi)) * 2.0) / 3.0
ret += ((150.0 * Math.sin((x / 12.0) * pi) + 300.0 * Math.sin((x / 30.0) * pi)) * 2.0) / 3.0

Loading…
Cancel
Save