From 44d5bcbf3f9985a204210bc50824b61c24355189 Mon Sep 17 00:00:00 2001
From: xpz2018 <107107461@qq.com>
Date: Tue, 14 Sep 2021 20:32:07 +0800
Subject: [PATCH] =?UTF-8?q?ui=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app.js | 1 +
app.wxss | 5 +-
components/city-change/README.md | 13 -
components/city-change/index.js | 190 --
components/city-change/index.wxml | 47 -
components/city-change/index.wxss | 125 --
components/free-input/index.js | 161 ++
.../{city-change => free-input}/index.json | 4 +-
components/free-input/index.wxml | 32 +
components/free-input/index.wxss | 78 +
pages/agent/fragment/index.js | 24 +-
pages/agent/index/index.json | 4 +-
pages/agent/index/index.wxml | 4 +-
pages/article/fragment/index.js | 31 +-
pages/article/fragment/index.wxml | 8 +-
pages/goods/fragment/index.js | 143 ++
pages/goods/fragment/index.json | 15 +
pages/goods/fragment/index.wxml | 41 +
pages/goods/fragment/index.wxss | 1 +
pages/home/city-select/city.js | 1535 +++++++++++++++++
pages/home/city-select/index.js | 90 +-
pages/home/city-select/index.json | 2 +-
pages/home/city-select/index.wxml | 51 +-
pages/home/city-select/index.wxss | 70 +-
pages/index/index.js | 109 +-
pages/index/index.json | 3 +-
pages/index/index.wxml | 8 +-
pages/moment/fragment/index.js | 130 ++
pages/moment/fragment/index.json | 6 +
pages/moment/fragment/index.wxml | 31 +
pages/moment/fragment/index.wxss | 34 +
pages/purchase/fragment/index.js | 118 ++
pages/purchase/fragment/index.json | 11 +
pages/purchase/fragment/index.wxml | 30 +
pages/purchase/fragment/index.wxss | 1 +
pages/purchase/index/index.wxml | 3 +-
36 files changed, 2738 insertions(+), 421 deletions(-)
delete mode 100644 components/city-change/README.md
delete mode 100644 components/city-change/index.js
delete mode 100644 components/city-change/index.wxml
delete mode 100644 components/city-change/index.wxss
create mode 100644 components/free-input/index.js
rename components/{city-change => free-input}/index.json (51%)
create mode 100644 components/free-input/index.wxml
create mode 100644 components/free-input/index.wxss
create mode 100644 pages/goods/fragment/index.js
create mode 100644 pages/goods/fragment/index.json
create mode 100644 pages/goods/fragment/index.wxml
create mode 100644 pages/goods/fragment/index.wxss
create mode 100644 pages/home/city-select/city.js
create mode 100644 pages/moment/fragment/index.js
create mode 100644 pages/moment/fragment/index.json
create mode 100644 pages/moment/fragment/index.wxml
create mode 100644 pages/moment/fragment/index.wxss
create mode 100644 pages/purchase/fragment/index.js
create mode 100644 pages/purchase/fragment/index.json
create mode 100644 pages/purchase/fragment/index.wxml
create mode 100644 pages/purchase/fragment/index.wxss
diff --git a/app.js b/app.js
index 2f82eb3..930c922 100644
--- a/app.js
+++ b/app.js
@@ -6,6 +6,7 @@ App({
agentMsgIds: ['kG8DErWDpyzBHCFaLlSKYMF7xVy8UpgogCwV_WSNt10', 'lOQ8Gvyy_dTk68bYGpRVnVA0M7DsYYrV81Gd39GUPBA'],
version: 152,
xAppId: '470236309865238528',
+ nowLocation: null,
globalData: {
userInfo: null,
openId: null,
diff --git a/app.wxss b/app.wxss
index fdf0a6e..e6485d0 100644
--- a/app.wxss
+++ b/app.wxss
@@ -41,4 +41,7 @@
opacity: .5
}
-
\ No newline at end of file
+.solid-bottom,
+.solid-bottom::after {
+ border-bottom: 1rpx solid #f3f3ff;
+}
\ No newline at end of file
diff --git a/components/city-change/README.md b/components/city-change/README.md
deleted file mode 100644
index 2090839..0000000
--- a/components/city-change/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
- wxml页面引用
- 注意:
- 1.需要引用组件的index.json中需要
- "usingComponents": {
- "city-change":"/components/city-change/index"
- }
-
- 2.在index.js中可以添加以下方法以便于获取回调
- cityTap(e){
- const cityName=e.detail.cityname;//城市名
- const cityId=e.detail.cityId;//城市行政编号
- wx.navigateBack();
- },
\ No newline at end of file
diff --git a/components/city-change/index.js b/components/city-change/index.js
deleted file mode 100644
index 309e606..0000000
--- a/components/city-change/index.js
+++ /dev/null
@@ -1,190 +0,0 @@
-import qqmap from '../../utils/map';
-import region2 from '../../utils/region2'
-const app = getApp()
-Component({
- properties: {
- styles: { //这个是可以自定义最外层的view的样式
- type: String,
- value: '',
- observer: function (newval, oldval) {
- // 监听改变
- console.log(newval, oldval);
- }
- },
-
- },
- data: {
- //下面是字母排序
- letter: ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"],
- cityListId: '',
- //下面是城市列表信息,这里只是模拟数据
- citylist:region2,
- //下面是热门城市数据,模拟数据
- newcity: [{"id":110100,"cityName":"北京"}, {"id":310100,"cityName":"上海"}, {"id":440100,"cityName":"广州"},{"id":440300,"cityName":"深圳"}],//若还需要添加则在region2中查找
- // citySel: '全国',
- locateCity: '',
- touchEndy:0,
- rightheight:0,
- topHeight:0,
- dialogIsShow:false,
- chooseCity:null,//缓存的城市
- },
- attached() {
- var that=this
- this.data.topHeight=app.globalData.CustomBar
- wx.getStorage({
- key: 'city',
- success: function(res){
- if(res.data.cityName){
- that.setData({
- chooseCity:res.data.cityName
- })
- }else{
- that.setData({
- chooseCity:''
- })
- }
- },
- fail: function(res) {
- that.setData({
- chooseCity:''
- })
- }
- });
- var query = this.createSelectorQuery()
- query.select('#rightSortHeight').boundingClientRect(function (res) {
- console.log(res);
- that.setData({
- rightheight:res.height
- })
- }).exec();
- },
- methods: {
- //点击城市
- cityTap(e) {
- const val = e.currentTarget.dataset.val || '',
- types = e.currentTarget.dataset.types || '',
- Index = e.currentTarget.dataset.index || '',
- that = this;
- let city = this.data.citySel;
- let cityId=''
- switch (types) {
- case 'locate':
- //定位内容
- city = this.data.locateCity;
- break;
- case 'national':
- //全国
- city = '全国';
- break;
- case 'new':
- //热门城市
- city = val.cityName;
- cityId=val.id
- break;
- case 'list':
- //城市列表
- city = val.cityName;
- cityId=val.id
- break;
- }
- if (city) {
- var cityData={
- cityName: city,
- cityId:cityId
- }
- wx.setStorage({
- key: 'city',
- data: cityData
- }) //点击后给父组件可以通过bindcitytap事件,获取到cityname的值,这是子组件给父组件传值和触发事件的方法
- this.triggerEvent('citytap', {
- cityname: city,
- cityId:cityId
- });
- } else {
- console.log('还没有');
- this.getLocate();
- }
-
- },
- //点击城市字母
- letterTap(e) {
- const Item = e.currentTarget.dataset.item;
- this.setData({
- cityListId: Item
- });
- this.titleDialog(Item)
-
- },
- //调用定位
- getLocate(){
- let that=this;
- new qqmap().getLocateInfo().then(function (val) {//这个方法在另一个文件里,下面有贴出代码
- console.log(val);
- if (val.indexOf('市') !== -1) {//这里是去掉“市”这个字
- console.log(val.indexOf('市') - 1);
- val = val.slice(0, val.indexOf('市'));
- console.log(val);
- }
- that.setData({
- locateCity: val,
- });
- //把获取的定位和获取的时间放到本地存储
- wx.setStorageSync('locatecity', { city: val, time: new Date().getTime() });
- });
- },
- //开始触摸事件
- touchStart: function (e) {
- this.data.touchEndy = e.touches[0].pageY-this.data.topHeight;
- },
- touchMove: function (e) {
- this.data.touchEndy = e.touches[0].pageY-this.data.topHeight;
- var lindex = parseInt(this.data.touchEndy / this.data.rightheight * 26);//根据前面分析获取手指触摸位置在letters中的index值
- var value = this.data.letter[lindex];
- this.titleDialog(value)
-
- },
- touchEnd: function (e) {
- var lindex = parseInt(this.data.touchEndy / this.data.rightheight * 26);//根据前面分析获取手指触摸位置在letters中的index值
- var value = this.data.letter[lindex];
- if(value){
- this.setData({
- cityListId: value
- });
- }
-
- this.titleDialog(value)
-
- },
- titleDialog: function (value) {
- if(value){
- this.setData({
- dialongValue:value,
- dialogIsShow:true
- })
- setTimeout(() => {
- this.setData({
- dialongValue:null,
- dialogIsShow:false
- })
- }, 1500);
- }
-
-
- },
- },
- ready() {
- console.log(getApp());
- let that = this,
- cityOrTime = wx.getStorageSync('locatecity')||{},
- time = new Date().getTime(),
- city='';
- if (!cityOrTime.time||(time - cityOrTime.time > 1800000)){//每隔30分钟请求一次定位
- this.getLocate();
- }else{//如果未满30分钟,那么直接从本地缓存里取值
- that.setData({
- locateCity: cityOrTime.city
- })
- }
- },
-})
\ No newline at end of file
diff --git a/components/city-change/index.wxml b/components/city-change/index.wxml
deleted file mode 100644
index 74d5584..0000000
--- a/components/city-change/index.wxml
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
- 自动定位
- {{locateCity||'点击定位'}}
-
-
- 选择城市
- {{chooseCity}}
-
-
-
-
-
-
- 热门城市
-
- {{item.cityName}}
-
-
-
-
- {{letterItem.letter}}
- {{item.cityName}}
-
-
-
-
-
- {{item}}
-
-
-
- {{dialongValue}}
-
\ No newline at end of file
diff --git a/components/city-change/index.wxss b/components/city-change/index.wxss
deleted file mode 100644
index 39e821b..0000000
--- a/components/city-change/index.wxss
+++ /dev/null
@@ -1,125 +0,0 @@
-.city_box {
- height: 100%;
- background: #fff;
- display: flex;
-}
-
-.city_left {
- flex: 1;
-}
-
-.city_right {
- width: 60rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
-}
-
-.letter_item {
- flex: 1;
- display: block;
- font-size: 24rpx;
- color: #33B9FF;
- text-align: center;
-}
-
-.city_locate{
- display: flex;
- justify-content: space-between;
- padding: 10rpx 20rpx 10rpx 20rpx;
-}
-.national {
- height: 80rpx;
- line-height: 80rpx;
- border-bottom: 1px solid #efefef;
- font-size: 28rpx;
- color: #333;
- padding-left: 25rpx;
-}
-
-.city_locate_title {
- color: #999;
- margin-right: 20rpx;
-}
-
-.new_city {
- background: #efefef;
- font-size: 28rpx;
-}
-
-.new_city_title {
- line-height: 50rpx;
- color: #999;
- padding-left: 25rpx;
- margin-bottom: 20rpx;
-}
-
-.new_city_box {
- display: flex;
- flex-wrap: wrap;
-}
-
-.new_city_text {
- width: 200rpx;
- text-align: center;
- line-height: 70rpx;
- background: #fff;
- border-radius: 35rpx;
- margin: 0 0 22rpx 22rpx;
-}
-
-.city_first_letter {
- line-height: 40rpx;
- height: 40rpx;
- padding-left: 25rpx;
- font-size: 28rpx;
- background: #eee;
- color: #999;
-}
-
-.city_name {
- display: block;
- line-height: 80rpx;
- height: 80rpx;
- border-bottom: 1px solid #efefef;
- font-size: 28rpx;
- color: #333;
- padding-left: 25rpx;
-}
-
-.show-dialog {
- width: 10vh;
- height: 10vh;
- position: absolute;
- top: 50vh;
- left: 40vw;
-
- background: white;
- color: #1296DB;
- font-size: 100rpx;
- font-weight: bold;
- position: fixed;
- padding-top: 30rpx;
- padding-bottom: 30rpx;
- text-align: center;
- box-shadow:0px 2px 5px 5px gray;
-}
-
-.top {
- width: 100%;
- background-color: #f7f7f7;
-}
-
-.topsearch {
- width: 97%;
- display: flex;
- padding: 3% 0;
- align-items: center;
-}
-
-.frame {
- background-color: white;
- width: 90%;
- border-radius: 20rpx;
- padding: 0 3%;
-}
\ No newline at end of file
diff --git a/components/free-input/index.js b/components/free-input/index.js
new file mode 100644
index 0000000..aaa641a
--- /dev/null
+++ b/components/free-input/index.js
@@ -0,0 +1,161 @@
+
+Component({
+ options: {
+ addGlobalClass: true,
+ multipleSlots: true
+ },
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ // 整个背景颜色
+ bgColor:{
+ type:String,
+ value:''
+ },
+ value:{
+ type:String,
+ value:''
+ },
+ // 输入框样式
+ inputStyle:{
+ type:String,
+ value:'0'
+ },
+ color:{
+ type:String,
+ value:''
+ },
+ // 输入框背景颜色
+ inputBg:{
+ type:String,
+ value:''
+ },
+ // 输入框圆角
+ radius:{
+ type:String,
+ value:'8000rpx'
+ },
+ password:{
+ type:Boolean,
+ value:false
+ },
+ // text、number、idcard、digit
+ type:{
+ type:String,
+ value:'text'
+ },
+ // 头部icon
+ prefixIcon:{
+ type:String,
+ value:'search'
+ },
+ // 尾部icon
+ suffixIcon:{
+ type:String,
+ value:''
+ },
+ // 输入框定位
+ position:{
+ type:String,
+ value:''
+ },
+ // 键盘右下角文本
+ // send、search、next、go、done
+ confirmType:{
+ type:String,
+ value:'done'
+ },
+ // 提示词
+ placeholder:{
+ type:String,
+ value:'请输入内容'
+ },
+ // 是否显示关闭按钮
+ close:{
+ type:Boolean,
+ value:false
+ },
+ // 是否禁用
+ disabled:{
+ type:Boolean,
+ value:false
+ },
+ // 额外按钮
+ extreaWord:{
+ type:String,
+ value:''
+ },
+ // 额外按钮颜色
+ extreaColor:{
+ type:String,
+ value:'#0081ff'
+ }
+ },
+
+ /**
+ * 组件的初始数据
+ */
+ data: {
+
+ },
+
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+ // 输入变化
+ getInput(e){
+ this.data.value = e.detail.value
+ this.setData({
+ value:e.detail.value
+ })
+ this.triggerEvent("input", { value: e.detail.value })
+ },
+ // 聚焦输入框变化
+ getFocus(e){
+ this.data.value = e.detail.value
+ this.setData({
+ value:e.detail.value
+ })
+ this.triggerEvent("focus", {
+ value: e.detail.value
+ })
+ },
+ // 失焦
+ getBlur(e){
+ this.data.value = e.detail.value
+ this.setData({
+ value:e.detail.value
+ })
+ this.triggerEvent("blur", {
+ value: e.detail.value
+ },{})
+ },
+ // 聚焦输入框变化
+ getConfirm(e){
+ this.data.value = e.detail.value
+ this.setData({
+ value:e.detail.value
+ })
+ this.triggerEvent("confirm", {
+ value: e.detail.value
+ })
+ },
+ // 额外按钮
+ extreaBtn(){
+ this.triggerEvent("extrea", {
+ value: this.data.value
+ },{})
+ },
+ // 关闭
+ close(){
+ this.setData({
+ value:''
+ })
+ this.triggerEvent("close", {
+ value: ''
+ })
+ }
+ }
+})
diff --git a/components/city-change/index.json b/components/free-input/index.json
similarity index 51%
rename from components/city-change/index.json
rename to components/free-input/index.json
index 1e15d13..2176e13 100644
--- a/components/city-change/index.json
+++ b/components/free-input/index.json
@@ -1,6 +1,6 @@
{
"component": true,
"usingComponents": {
- "wux-dialog": "/components/dialog/index"
+
}
- }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/components/free-input/index.wxml b/components/free-input/index.wxml
new file mode 100644
index 0000000..3c15ffa
--- /dev/null
+++ b/components/free-input/index.wxml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{extreaWord}}
+
+
diff --git a/components/free-input/index.wxss b/components/free-input/index.wxss
new file mode 100644
index 0000000..9616dec
--- /dev/null
+++ b/components/free-input/index.wxss
@@ -0,0 +1,78 @@
+.box{
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ height: 100rpx;
+ width: 100%;
+ top: 0;
+ left: 0;
+ z-index: 99;
+ /* padding: 0 20rpx; */
+}
+.inputStyle{
+ position: relative;
+ display: flex;
+ align-items: center;
+ justify-items: center;
+ background: #f5f5f5;
+ line-height: 32px;
+ height: 64rpx;
+ font-size: 24rpx;
+ color: #333333;
+ flex: 1;
+ overflow: hidden;
+ margin: 0 30rpx;
+}
+.inputStyles{
+ position: relative;
+ display: flex;
+ align-items: center;
+ justify-items: center;
+ /* background: #f5f5f5; */
+ line-height: 32px;
+ border: 2rpx solid #dcdfe6;
+ height: 64rpx;
+ font-size: 24rpx;
+ color: #333333;
+ flex: 1;
+ overflow: hidden;
+ margin: 0 30rpx;
+}
+.disabled{
+ background-color: #f5f7fa;
+ border-color: #e4e7ed;
+ color: #c0c4cc;
+ cursor: not-allowed;
+}
+.iconStyle{
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+.slot{
+ display: flex;
+ align-items: center;
+}
+.input{
+ flex: 1;
+ padding:0 30rpx 0 0.5em;
+ height: 64rpx;
+ line-height: 64rpx;
+ font-size: 26rpx;
+ background-color: transparent;
+}
+.deleStyle{
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ /* background:#e1e1e1; */
+ width: 26rpx;
+ height: 26rpx;
+ margin: 0 20rpx;
+ /* border: 2rpx solid rgb(139, 138, 138); */
+ border-radius: 50%;
+}
+.extreaBtn{
+ text-align: center;
+ margin-right: 30rpx;
+}
\ No newline at end of file
diff --git a/pages/agent/fragment/index.js b/pages/agent/fragment/index.js
index 3158f92..7f95b42 100644
--- a/pages/agent/fragment/index.js
+++ b/pages/agent/fragment/index.js
@@ -1,5 +1,7 @@
// pages/agent/index/index.js
+import util from "../../../utils/util"
import { getFactoryPrice, getFactoryCity, hasActivity } from "../../api/ztb"
+const event = require('../../../utils/event')
const app = getApp()
Component({
@@ -37,12 +39,15 @@ Component({
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
attached: function () {
-
+ event.on('EventMessage', this, this.onEvent)
if(app.globalData.userInfo){
hasActivity().then(result => {
this.setData({ hasActivity: result.data })
})
}
+ },
+ detached: function () {
+ event.remove('EventMessage', this)
}
},
methods: {
@@ -54,8 +59,20 @@ Component({
}
this.data.firstShow = true
},
+ onEvent: function (message) {
+ console.log('mall>>index>>onEvent', message)
+ if (message.what == 10 && app.globalData.isVIP == 1) {
+ // this.setData({ token: app.globalData.token })
+ // this.onRefreshList()
+ } else if(message.what == 1001){
+ this.setData({ kg: app.globalData.kg })
+ } else if(message.what == 888){
+ this.setData({ orderList: [], tabIndex: this.data.tabIndex, ['form.pageNum']: 1, loading: true, finished: false })
+ this.fetchPapersList()
+ }
+ },
toAbility: function(){
- wx.navigateTo({ url: '/pages/agent/ability/index' })
+ util.navigateTo('/pages/agent/ability/index')
},
fetchRegionList: function () {
getFactoryCity().then(result => {
@@ -126,9 +143,6 @@ Component({
//异常回调
this.setData({ requesting: false, finished: true, loading: false, })
})
- },
- goattentionIndex: function () {
- wx.navigateTo({ url: '/pages/home/attentionPaperList/index' })
}
}
diff --git a/pages/agent/index/index.json b/pages/agent/index/index.json
index b637617..663430c 100644
--- a/pages/agent/index/index.json
+++ b/pages/agent/index/index.json
@@ -1,6 +1,6 @@
{
"usingComponents": {
- "focus": "/pages/agent/focus-fragment/index",
- "factory": "/pages/agent/factory-fragment/index"
+ "focus": "/pages/purchase/fragment/index",
+ "factory": "/pages/goods/fragment/index"
}
}
\ No newline at end of file
diff --git a/pages/agent/index/index.wxml b/pages/agent/index/index.wxml
index 22c9739..5f14b88 100644
--- a/pages/agent/index/index.wxml
+++ b/pages/agent/index/index.wxml
@@ -9,10 +9,10 @@
- 关注
+ 求购
- 全部
+ 供应
diff --git a/pages/article/fragment/index.js b/pages/article/fragment/index.js
index 034a2f5..592c321 100644
--- a/pages/article/fragment/index.js
+++ b/pages/article/fragment/index.js
@@ -1,5 +1,5 @@
// pages/message/index.js
-import { getFactoryPrice, getProductList, getMiniProxyList, getBannerList, getSuccessNotices } from "../../api/ztb"
+import { getFactoryPrice, getBannerList, getSuccessNotices } from "../../api/ztb"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
@@ -9,6 +9,12 @@ Component({
addGlobalClass: true,
multipleSlots: true
},
+ properties:{
+ cityName: { //这个是可以自定义最外层的view的样式
+ type: String,
+ value: ''
+ }
+ },
/**
* 页面的初始数据
*/
@@ -80,25 +86,28 @@ Component({
} else if(message.what == 888){
this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false })
this.fetchAgentList()
+ } else if(message.what == 444){
+ this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false, cityName: app.nowLocation.cityName })
+ this.fetchAgentList()
}
},
chooseCity: function(){
- var that = this
- console.log('chooseCity>>>')
- wx.navigateTo({
- url: `/pages/home/city-select/index?type=1`,
- events: {
- onCallback: (data) => {
-
- }
- }
- })
+ wx.navigateTo({url: `/pages/home/city-select/index?type=1` })
},
searchList: function(){
},
postList: function(){
+ },
+ gridTap: function(e){
+ if(e.currentTarget.id == 'agent'){
+ this.triggerEvent("click", { what: 1 })
+ } else if(e.currentTarget.id == 'trans'){
+ util.navigateTo('/pages/agent/index/index')
+ } else if(e.currentTarget.id == 'action'){
+ util.navigateTo(`/pages/agent/ability/index`)
+ }
},
tapBanner: function(e){
var item = this.data.bannerList[e.currentTarget.dataset.index]
diff --git a/pages/article/fragment/index.wxml b/pages/article/fragment/index.wxml
index 9c523a4..534f566 100644
--- a/pages/article/fragment/index.wxml
+++ b/pages/article/fragment/index.wxml
@@ -4,7 +4,7 @@
- 广州
+ {{cityName}}
@@ -29,11 +29,11 @@
-
+
-
+
-
+
diff --git a/pages/goods/fragment/index.js b/pages/goods/fragment/index.js
new file mode 100644
index 0000000..0fe373e
--- /dev/null
+++ b/pages/goods/fragment/index.js
@@ -0,0 +1,143 @@
+// pages/agent/index/index.js
+import { paperCategoryList, getMiniProxyList } from "../../api/ztb"
+const app = getApp()
+const statusList = [1, 2]
+
+Component({
+ options: {
+ addGlobalClass: true,
+ multipleSlots: true
+ },
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ height: app.globalData.fragmentHeight - 90,
+ kg: app.globalData.kg,
+ loading: true,
+ requesting: false,
+ finished: false,
+ cateList: [],
+ cateScroll: false,
+ tabiList: [],
+ pageIndex: 0,
+ top: 0,
+ orderList: [],
+ form: {
+ firstCategoryId: '',
+ bidType: statusList[0],
+ pageNum: 1,
+ pageSize:15
+ },
+ firstShow: false
+ },
+ methods: {
+ onRestart: function(){
+ if (!this.data.firstShow) {
+ this.setData({ height: app.globalData.fragmentHeight - 90, kg: app.globalData.kg })
+ this.fetchCateList()
+ this.fetchGoodsList()
+ }
+ this.data.firstShow = true
+ },
+ fetchCateList: function(){
+ paperCategoryList({ type: 1 }).then(result => {
+ var tabList = ['全部']
+ var size = 0
+ for (let index = 0; index < result.data.length; index++) {
+ tabList.push(result.data[index].name)
+ size += result.data[index].name.length
+ }
+ this.data.cateList = result.data
+ this.setData({ tabiList: tabList, cateScroll: size > 14 })
+ })
+ },
+ onCategoryChange: function ({detail}) {
+ if(this.data.pageIndex == Number(detail.index)){
+ return
+ }
+ this.data.pageIndex = Number(detail.index)
+ if(this.data.pageIndex == 0){
+ this.data.form.firstCategoryId = ''
+ } else {
+ this.data.form.firstCategoryId = this.data.cateList[this.data.pageIndex - 1].id
+ }
+ this.onRefreshList()
+ },
+ onTabChange: function (e) {
+ if (this.data.form.bidType == Number(e.currentTarget.dataset.index)) {
+ return
+ }
+ var tabIndex = Number(e.currentTarget.dataset.index)
+ // this.data.form.bidType = statusList[this.data.tabIndex]
+ this.data.form.firstCategoryId = ''
+ this.setData({ pageIndex: 0, ['form.bidType']: tabIndex })
+ this.onRefreshList()
+ },
+ // 下拉刷新...
+ onRefreshList: function () {
+ if (this.data.requesting) {
+ return
+ }
+ this.setData({
+ orderList: [],
+ ['form.pageNum']: 1,
+ loading: true,
+ finished: false
+ })
+ this.fetchGoodsList()
+ },
+ // 获取特价列表
+ fetchGoodsList: function () {
+ if (this.data.requesting || this.data.finished) {
+ return
+ }
+ if (this.data.loading) {
+ this.data.requesting = true
+ } else {
+ this.setData({ requesting: true })
+ }
+ getMiniProxyList(this.data.form).then(result => {
+ if (result.data.records.length) {
+ var respList = result.data.records
+ let nowList = `orderList[${this.data.orderList.length}]`
+ var num = result.data.current
+ var finished = result.data.current >= result.data.pages
+ if(this.data.form.pageNum == 1){
+ this.setData({
+ [nowList]: respList,
+ total: result.data.total,
+ ['form.pageNum']: (num + 1),
+ top: 0,
+ finished,
+ requesting: false,
+ loading: false
+ })
+ } else {
+ this.setData({
+ [nowList]: respList,
+ total: result.data.total,
+ ['form.pageNum']: (num + 1),
+ finished,
+ requesting: false,
+ loading: false
+ })
+ }
+ } else {
+ this.setData({ finished: true, requesting: false, loading: false })
+ }
+ }).catch(err => {
+ this.setData({ requesting: false, finished: true, loading: false })
+ })
+ },
+ lookItem: function (e) {
+ var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
+ wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id })
+ },
+ offerGood: function(e){
+ var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
+ wx.navigateTo({ url: '/pages/mall/detail/index?id=' + item.id })
+ }
+ }
+
+})
\ No newline at end of file
diff --git a/pages/goods/fragment/index.json b/pages/goods/fragment/index.json
new file mode 100644
index 0000000..9d6df21
--- /dev/null
+++ b/pages/goods/fragment/index.json
@@ -0,0 +1,15 @@
+{
+ "usingComponents": {
+ "wux-skeleton": "/components/skeleton/index",
+ "wux-skeleton-avatar": "/components/skeleton-avatar/index",
+ "wux-skeleton-paragraph": "/components/skeleton-paragraph/index",
+ "wux-row": "/components/row/index",
+ "wux-col": "/components/col/index",
+ "refresh-view": "/components/refresher/index",
+ "wux-button": "/components/button/index",
+ "wux-tabi": "/components/tabi/index",
+ "wux-image": "/components/image/index",
+ "wux-divider": "/components/divider/index",
+ "product-item": "/pages/mall/product-item/index"
+ }
+}
\ No newline at end of file
diff --git a/pages/goods/fragment/index.wxml b/pages/goods/fragment/index.wxml
new file mode 100644
index 0000000..5634126
--- /dev/null
+++ b/pages/goods/fragment/index.wxml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+ 正在加载
+
+
+ 竞价商品发布中,
+ 先去一口价专区逛逛吧。
+
+ 暂无数据
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{finished?'到底啦~':'加载中...'}}
+
+
+
+
+
diff --git a/pages/goods/fragment/index.wxss b/pages/goods/fragment/index.wxss
new file mode 100644
index 0000000..14f8cb0
--- /dev/null
+++ b/pages/goods/fragment/index.wxss
@@ -0,0 +1 @@
+/* pages/agent/index/index.wxss */
\ No newline at end of file
diff --git a/pages/home/city-select/city.js b/pages/home/city-select/city.js
new file mode 100644
index 0000000..b1e6ddb
--- /dev/null
+++ b/pages/home/city-select/city.js
@@ -0,0 +1,1535 @@
+module.exports = {
+ list: [
+ {
+ "letter": "A",
+ "data": [
+ {
+ "cityName": "阿坝",
+ "code": 513200,
+ "keyword": "阿坝ABA"
+ },
+ {
+ "cityName": "阿克苏",
+ "code": 652900,
+ "keyword": "阿克苏AKESU"
+ },
+ {
+ "cityName": "阿拉善",
+ "code": 152900,
+ "keyword": "阿拉善ALASHAN"
+ },
+ {
+ "cityName": "阿勒泰",
+ "code": 654300,
+ "keyword": "阿勒泰ALETAI"
+ },
+ {
+ "cityName": "阿里",
+ "code": 542500,
+ "keyword": "阿里ALI"
+ },
+ {
+ "cityName": "安康",
+ "code": 610900,
+ "keyword": "安康ANKANG"
+ },
+ {
+ "cityName": "安庆",
+ "code": 340800,
+ "keyword": "安庆ANQING"
+ },
+ {
+ "cityName": "鞍山",
+ "code": 210300,
+ "keyword": "鞍山ANSHAN"
+ },
+ {
+ "cityName": "安顺",
+ "code": 520400,
+ "keyword": "安顺ANSHUN"
+ },
+ {
+ "cityName": "安阳",
+ "code": 410500,
+ "keyword": "安阳ANYANG"
+ }
+ ]
+ },
+ {
+ "letter": "B",
+ "data": [
+ {
+ "cityName": "白城",
+ "code": 220800,
+ "keyword": "白城BAICHENG"
+ },
+ {
+ "cityName": "白山",
+ "code": 220800,
+ "keyword": "白山BAISHAN"
+ },
+ {
+ "cityName": "白银",
+ "code": 220800,
+ "keyword": "白银BAIYIN"
+ },
+ {
+ "cityName": "保定",
+ "code": 220800,
+ "keyword": "保定BAODING"
+ },
+ {
+ "cityName": "宝鸡",
+ "code": 220800,
+ "keyword": "宝鸡BAOJI"
+ },
+ {
+ "cityName": "保山",
+ "code": 220800,
+ "keyword": "保山BAOSHAN"
+ },
+ {
+ "cityName": "包头",
+ "code": 220800,
+ "keyword": "包头BAOTOU"
+ },
+ {
+ "cityName": "巴彦淖尔",
+ "code": 220800,
+ "keyword": "巴彦淖尔BAYANNAOER"
+ },
+ {
+ "cityName": "巴音郭楞",
+ "code": 220800,
+ "keyword": "巴音郭楞BAYINGUOLENG"
+ },
+ {
+ "cityName": "巴中",
+ "code": 220800,
+ "keyword": "巴中BAZHONG"
+ },
+ {
+ "cityName": "北海",
+ "code": 220800,
+ "keyword": "北海BEIHAI"
+ },
+ {
+ "cityName": "北京",
+ "code": 220800,
+ "keyword": "北京BEIJING"
+ },
+ {
+ "cityName": "蚌埠",
+ "code": 220800,
+ "keyword": "蚌埠BENGBU"
+ },
+ {
+ "cityName": "本溪",
+ "code": 220800,
+ "keyword": "本溪BENXI"
+ },
+ {
+ "cityName": "毕节",
+ "code": 220800,
+ "keyword": "毕节BIJIE"
+ },
+ {
+ "cityName": "滨州",
+ "code": 220800,
+ "keyword": "滨州BINZHOU"
+ },
+ {
+ "cityName": "博尔塔拉",
+ "code": 220800,
+ "keyword": "博尔塔拉BOERTALA"
+ },
+ {
+ "cityName": "百色",
+ "code": 220800,
+ "keyword": "百色BOSE"
+ },
+ {
+ "cityName": "亳州",
+ "code": 220800,
+ "keyword": "亳州BOZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "C",
+ "data": [
+ {
+ "cityName": "沧州",
+ "keyword": "沧州CANGZHOU"
+ },
+ {
+ "cityName": "长春",
+ "keyword": "长春CHANGCHUN"
+ },
+ {
+ "cityName": "常德",
+ "keyword": "常德CHANGDE"
+ },
+ {
+ "cityName": "昌都",
+ "keyword": "昌都CHANGDU"
+ },
+ {
+ "cityName": "昌吉",
+ "keyword": "昌吉CHANGJI"
+ },
+ {
+ "cityName": "长沙",
+ "keyword": "长沙CHANGSHA"
+ },
+ {
+ "cityName": "长治",
+ "keyword": "长治CHANGZHI"
+ },
+ {
+ "cityName": "常州",
+ "keyword": "常州CHANGZHOU"
+ },
+ {
+ "cityName": "潮州",
+ "keyword": "潮州CHAOZHOU"
+ },
+ {
+ "cityName": "承德",
+ "keyword": "承德CHENGDE"
+ },
+ {
+ "cityName": "成都",
+ "keyword": "成都CHENGDU"
+ },
+ {
+ "cityName": "郴州",
+ "keyword": "郴州CHENZHOU"
+ },
+ {
+ "cityName": "赤峰",
+ "keyword": "赤峰CHIFENG"
+ },
+ {
+ "cityName": "池州",
+ "keyword": "池州CHIZHOU"
+ },
+ {
+ "cityName": "重庆",
+ "keyword": "重庆CHONGQING"
+ },
+ {
+ "cityName": "崇左",
+ "keyword": "崇左CHONGZUO"
+ },
+ {
+ "cityName": "楚雄",
+ "keyword": "楚雄CHUXIONG"
+ },
+ {
+ "cityName": "滁州",
+ "keyword": "滁州CHUZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "D",
+ "data": [
+ {
+ "cityName": "大理",
+ "keyword": "大理DALI"
+ },
+ {
+ "cityName": "大连",
+ "keyword": "大连DALIAN"
+ },
+ {
+ "cityName": "丹东",
+ "keyword": "丹东DANDONG"
+ },
+ {
+ "cityName": "儋州",
+ "keyword": "儋州DANZHOU"
+ },
+ {
+ "cityName": "大庆",
+ "keyword": "大庆DAQING"
+ },
+ {
+ "cityName": "大同",
+ "keyword": "大同DATONG"
+ },
+ {
+ "cityName": "大兴安岭",
+ "keyword": "大兴安岭DAXINGANLING"
+ },
+ {
+ "cityName": "达州",
+ "keyword": "达州DAZHOU"
+ },
+ {
+ "cityName": "德宏",
+ "keyword": "德宏DEHONG"
+ },
+ {
+ "cityName": "德阳",
+ "keyword": "德阳DEYANG"
+ },
+ {
+ "cityName": "德州",
+ "keyword": "德州DEZHOU"
+ },
+ {
+ "cityName": "定西",
+ "keyword": "定西DINGXI"
+ },
+ {
+ "cityName": "迪庆",
+ "keyword": "迪庆DIQING"
+ },
+ {
+ "cityName": "东莞",
+ "keyword": "东莞DONGGUAN"
+ },
+ {
+ "cityName": "东营",
+ "keyword": "东营DONGYING"
+ }
+ ]
+ },
+ {
+ "letter": "E",
+ "data": [
+ {
+ "cityName": "鄂尔多斯",
+ "keyword": "鄂尔多斯EERDUOSI"
+ },
+ {
+ "cityName": "恩施",
+ "keyword": "恩施ENSHI"
+ },
+ {
+ "cityName": "鄂州",
+ "keyword": "鄂州EZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "F",
+ "data": [
+ {
+ "cityName": "防城港",
+ "keyword": "防城港FANGCHENGGANG"
+ },
+ {
+ "cityName": "佛山",
+ "keyword": "佛山FOSHAN"
+ },
+ {
+ "cityName": "抚顺",
+ "keyword": "抚顺FUSHUN"
+ },
+ {
+ "cityName": "阜新",
+ "keyword": "阜新FUXIN"
+ },
+ {
+ "cityName": "阜阳",
+ "keyword": "阜阳FUYANG"
+ },
+ {
+ "cityName": "抚州",
+ "keyword": "抚州FUZHOU"
+ },
+ {
+ "cityName": "福州",
+ "keyword": "福州FUZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "G",
+ "data": [
+ {
+ "cityName": "甘南",
+ "keyword": "甘南GANNAN"
+ },
+ {
+ "cityName": "赣州",
+ "keyword": "赣州GANZHOU"
+ },
+ {
+ "cityName": "甘孜",
+ "keyword": "甘孜GANZI"
+ },
+ {
+ "cityName": "广安",
+ "keyword": "广安GUANGAN"
+ },
+ {
+ "cityName": "广元",
+ "keyword": "广元GUANGYUAN"
+ },
+ {
+ "cityName": "广州",
+ "keyword": "广州GUANGZHOU"
+ },
+ {
+ "cityName": "贵港",
+ "keyword": "贵港GUIGANG"
+ },
+ {
+ "cityName": "桂林",
+ "keyword": "桂林GUILIN"
+ },
+ {
+ "cityName": "贵阳",
+ "keyword": "贵阳GUIYANG"
+ },
+ {
+ "cityName": "果洛",
+ "keyword": "果洛GUOLUO"
+ },
+ {
+ "cityName": "固原",
+ "keyword": "固原GUYUAN"
+ }
+ ]
+ },
+ {
+ "letter": "H",
+ "data": [
+ {
+ "cityName": "哈尔滨",
+ "keyword": "哈尔滨HAERBIN"
+ },
+ {
+ "cityName": "海北",
+ "keyword": "海北HAIBEI"
+ },
+ {
+ "cityName": "海东",
+ "keyword": "海东HAIDONG"
+ },
+ {
+ "cityName": "海口",
+ "keyword": "海口HAIKOU"
+ },
+ {
+ "cityName": "海南藏族自治州",
+ "keyword": "海南藏族自治州HAINAN"
+ },
+ {
+ "cityName": "海南",
+ "keyword": "海南藏族自治州HAINAN"
+ },
+ {
+ "cityName": "海南",
+ "keyword": "海南HAINAN"
+ },
+ {
+ "cityName": "海西",
+ "keyword": "海西HAIXI"
+ },
+ {
+ "cityName": "哈密",
+ "keyword": "哈密HAMI"
+ },
+ {
+ "cityName": "邯郸",
+ "keyword": "邯郸HANDAN"
+ },
+ {
+ "cityName": "杭州",
+ "keyword": "杭州HANGZHOU"
+ },
+ {
+ "cityName": "汉中",
+ "keyword": "汉中HANZHONG"
+ },
+ {
+ "cityName": "河北",
+ "keyword": "河北HEBEI"
+ },
+ {
+ "cityName": "鹤壁",
+ "keyword": "鹤壁HEBI"
+ },
+ {
+ "cityName": "河池",
+ "keyword": "河池HECHI"
+ },
+ {
+ "cityName": "合肥",
+ "keyword": "合肥HEFEI"
+ },
+ {
+ "cityName": "鹤岗",
+ "keyword": "鹤岗HEGANG"
+ },
+ {
+ "cityName": "黑河",
+ "keyword": "黑河HEIHE"
+ },
+ {
+ "cityName": "河南",
+ "keyword": "河南HENAN"
+ },
+ {
+ "cityName": "衡水",
+ "keyword": "衡水HENGSHUI"
+ },
+ {
+ "cityName": "衡阳",
+ "keyword": "衡阳HENGYANG"
+ },
+ {
+ "cityName": "和田",
+ "keyword": "和田HETIAN"
+ },
+ {
+ "cityName": "河源",
+ "keyword": "河源HEYUAN"
+ },
+ {
+ "cityName": "菏泽",
+ "keyword": "菏泽HEZE"
+ },
+ {
+ "cityName": "贺州",
+ "keyword": "贺州HEZHOU"
+ },
+ {
+ "cityName": "红河",
+ "keyword": "红河HONGHE"
+ },
+ {
+ "cityName": "淮安",
+ "keyword": "淮安HUAIAN"
+ },
+ {
+ "cityName": "淮北",
+ "keyword": "淮北HUAIBEI"
+ },
+ {
+ "cityName": "怀化",
+ "keyword": "怀化HUAIHUA"
+ },
+ {
+ "cityName": "淮南",
+ "keyword": "淮南HUAINAN"
+ },
+ {
+ "cityName": "黄冈",
+ "keyword": "黄冈HUANGGANG"
+ },
+ {
+ "cityName": "黄南",
+ "keyword": "黄南HUANGNAN"
+ },
+ {
+ "cityName": "黄山",
+ "keyword": "黄山HUANGSHAN"
+ },
+ {
+ "cityName": "黄石",
+ "keyword": "黄石HUANGSHI"
+ },
+ {
+ "cityName": "湖北",
+ "keyword": "湖北HUBEI"
+ },
+ {
+ "cityName": "呼和浩特",
+ "keyword": "呼和浩特HUHEHAOTE"
+ },
+ {
+ "cityName": "惠州",
+ "keyword": "惠州HUIZHOU"
+ },
+ {
+ "cityName": "葫芦岛",
+ "keyword": "葫芦岛HULUDAO"
+ },
+ {
+ "cityName": "呼伦贝尔",
+ "keyword": "呼伦贝尔HULUNBEIER"
+ },
+ {
+ "cityName": "湖州",
+ "keyword": "湖州HUZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "I",
+ "data": [
+
+ ]
+ },
+ {
+ "letter": "J",
+ "data": [
+ {
+ "cityName": "佳木斯",
+ "keyword": "佳木斯JIAMUSI"
+ },
+ {
+ "cityName": "吉安",
+ "keyword": "吉安JIAN"
+ },
+ {
+ "cityName": "江门",
+ "keyword": "江门JIANGMEN"
+ },
+ {
+ "cityName": "焦作",
+ "keyword": "焦作JIAOZUO"
+ },
+ {
+ "cityName": "嘉兴",
+ "keyword": "嘉兴JIAXING"
+ },
+ {
+ "cityName": "嘉峪关",
+ "keyword": "嘉峪关JIAYUGUAN"
+ },
+ {
+ "cityName": "揭阳",
+ "keyword": "揭阳JIEYANG"
+ },
+ {
+ "cityName": "吉林",
+ "keyword": "吉林JILIN"
+ },
+ {
+ "cityName": "济南",
+ "keyword": "济南JINAN"
+ },
+ {
+ "cityName": "金昌",
+ "keyword": "金昌JINCHANG"
+ },
+ {
+ "cityName": "晋城",
+ "keyword": "晋城JINCHENG"
+ },
+ {
+ "cityName": "景德镇",
+ "keyword": "景德镇JINGDEZHEN"
+ },
+ {
+ "cityName": "荆门",
+ "keyword": "荆门JINGMEN"
+ },
+ {
+ "cityName": "荆州",
+ "keyword": "荆州JINGZHOU"
+ },
+ {
+ "cityName": "金华",
+ "keyword": "金华JINHUA"
+ },
+ {
+ "cityName": "济宁",
+ "keyword": "济宁JINING"
+ },
+ {
+ "cityName": "晋中",
+ "keyword": "晋中JINZHONG"
+ },
+ {
+ "cityName": "锦州",
+ "keyword": "锦州JINZHOU"
+ },
+ {
+ "cityName": "九江",
+ "keyword": "九江JIUJIANG"
+ },
+ {
+ "cityName": "酒泉",
+ "keyword": "酒泉JIUQUAN"
+ },
+ {
+ "cityName": "鸡西",
+ "keyword": "鸡西JIXI"
+ }
+ ]
+ },
+ {
+ "letter": "K",
+ "data": [
+ {
+ "cityName": "开封",
+ "keyword": "开封KAIFENG"
+ },
+ {
+ "cityName": "喀什",
+ "keyword": "喀什KASHI"
+ },
+ {
+ "cityName": "克拉玛依",
+ "keyword": "克拉玛依KELAMAYI"
+ },
+ {
+ "cityName": "克孜勒苏",
+ "keyword": "克孜勒苏KEZILESU"
+ },
+ {
+ "cityName": "昆明",
+ "keyword": "昆明KUNMING"
+ }
+ ]
+ },
+ {
+ "letter": "L",
+ "data": [
+ {
+ "cityName": "来宾",
+ "keyword": "来宾LAIBIN"
+ },
+ {
+ "cityName": "莱芜",
+ "keyword": "莱芜LAIWU"
+ },
+ {
+ "cityName": "廊坊",
+ "keyword": "廊坊LANGFANG"
+ },
+ {
+ "cityName": "兰州",
+ "keyword": "兰州LANZHOU"
+ },
+ {
+ "cityName": "拉萨",
+ "keyword": "拉萨LASA"
+ },
+ {
+ "cityName": "乐山",
+ "keyword": "乐山LESHAN"
+ },
+ {
+ "cityName": "凉山",
+ "keyword": "凉山LIANGSHAN"
+ },
+ {
+ "cityName": "连云港",
+ "keyword": "连云港LIANYUNGANG"
+ },
+ {
+ "cityName": "聊城",
+ "keyword": "聊城LIAOCHENG"
+ },
+ {
+ "cityName": "辽阳",
+ "keyword": "辽阳LIAOYANG"
+ },
+ {
+ "cityName": "辽源",
+ "keyword": "辽源LIAOYUAN"
+ },
+ {
+ "cityName": "丽江",
+ "keyword": "丽江LIJIANG"
+ },
+ {
+ "cityName": "临沧",
+ "keyword": "临沧LINCANG"
+ },
+ {
+ "cityName": "临汾",
+ "keyword": "临汾LINFEN"
+ },
+ {
+ "cityName": "临夏",
+ "keyword": "临夏LINXIA"
+ },
+ {
+ "cityName": "临沂",
+ "keyword": "临沂LINYI"
+ },
+ {
+ "cityName": "林芝",
+ "keyword": "林芝LINZHI"
+ },
+ {
+ "cityName": "丽水",
+ "keyword": "丽水LISHUI"
+ },
+ {
+ "cityName": "六盘水",
+ "keyword": "六盘水LIUPANSHUI"
+ },
+ {
+ "cityName": "柳州",
+ "keyword": "柳州LIUZHOU"
+ },
+ {
+ "cityName": "陇南",
+ "keyword": "陇南LONGNAN"
+ },
+ {
+ "cityName": "龙岩",
+ "keyword": "龙岩LONGYAN"
+ },
+ {
+ "cityName": "娄底",
+ "keyword": "娄底LOUDI"
+ },
+ {
+ "cityName": "六安",
+ "keyword": "六安LUAN"
+ },
+ {
+ "cityName": "洛阳",
+ "keyword": "洛阳LUOYANG"
+ },
+ {
+ "cityName": "泸州",
+ "keyword": "泸州LUZHOU"
+ },
+ {
+ "cityName": "吕梁",
+ "keyword": "吕梁LVLIANG"
+ }
+ ]
+ },
+ {
+ "letter": "M",
+ "data": [
+ {
+ "cityName": "马鞍山",
+ "keyword": "马鞍山MAANSHAN"
+ },
+ {
+ "cityName": "茂名",
+ "keyword": "茂名MAOMING"
+ },
+ {
+ "cityName": "眉山",
+ "keyword": "眉山MEISHAN"
+ },
+ {
+ "cityName": "梅州",
+ "keyword": "梅州MEIZHOU"
+ },
+ {
+ "cityName": "绵阳",
+ "keyword": "绵阳MIANYANG"
+ },
+ {
+ "cityName": "牡丹江",
+ "keyword": "牡丹江MUDANJIANG"
+ }
+ ]
+ },
+ {
+ "letter": "N",
+ "data": [
+ {
+ "cityName": "南昌",
+ "keyword": "南昌NANCHANG"
+ },
+ {
+ "cityName": "南充",
+ "keyword": "南充NANCHONG"
+ },
+ {
+ "cityName": "南京",
+ "keyword": "南京NANJING"
+ },
+ {
+ "cityName": "南宁",
+ "keyword": "南宁NANNING"
+ },
+ {
+ "cityName": "南平",
+ "keyword": "南平NANPING"
+ },
+ {
+ "cityName": "南通",
+ "keyword": "南通NANTONG"
+ },
+ {
+ "cityName": "南阳",
+ "keyword": "南阳NANYANG"
+ },
+ {
+ "cityName": "那曲",
+ "keyword": "那曲NAQU"
+ },
+ {
+ "cityName": "内江",
+ "keyword": "内江NEIJIANG"
+ },
+ {
+ "cityName": "宁波",
+ "keyword": "宁波NINGBO"
+ },
+ {
+ "cityName": "宁德",
+ "keyword": "宁德NINGDE"
+ },
+ {
+ "cityName": "怒江",
+ "keyword": "怒江NUJIANG"
+ }
+ ]
+ },
+ {
+ "letter": "O",
+ "data": [
+
+ ]
+ },
+ {
+ "letter": "P",
+ "data": [
+ {
+ "cityName": "盘锦",
+ "keyword": "盘锦PANJIN"
+ },
+ {
+ "cityName": "攀枝花",
+ "keyword": "攀枝花PANZHIHUA"
+ },
+ {
+ "cityName": "平顶山",
+ "keyword": "平顶山PINGDINGSHAN"
+ },
+ {
+ "cityName": "平凉",
+ "keyword": "平凉PINGLIANG"
+ },
+ {
+ "cityName": "萍乡",
+ "keyword": "萍乡PINGXIANG"
+ },
+ {
+ "cityName": "普洱",
+ "keyword": "普洱PUER"
+ },
+ {
+ "cityName": "莆田",
+ "keyword": "莆田PUTIAN"
+ },
+ {
+ "cityName": "濮阳",
+ "keyword": "濮阳PUYANG"
+ }
+ ]
+ },
+ {
+ "letter": "Q",
+ "data": [
+ {
+ "cityName": "黔东南",
+ "keyword": "黔东南QIANDONGNAN"
+ },
+ {
+ "cityName": "黔南",
+ "keyword": "黔南QIANNAN"
+ },
+ {
+ "cityName": "黔西南",
+ "keyword": "黔西南QIANXINAN"
+ },
+ {
+ "cityName": "青岛",
+ "keyword": "青岛QINGDAO"
+ },
+ {
+ "cityName": "庆阳",
+ "keyword": "庆阳QINGYANG"
+ },
+ {
+ "cityName": "清远",
+ "keyword": "清远QINGYUAN"
+ },
+ {
+ "cityName": "秦皇岛",
+ "keyword": "秦皇岛QINHUANGDAO"
+ },
+ {
+ "cityName": "钦州",
+ "keyword": "钦州QINZHOU"
+ },
+ {
+ "cityName": "齐齐哈尔",
+ "keyword": "齐齐哈尔QIQIHAER"
+ },
+ {
+ "cityName": "七台河",
+ "keyword": "七台河QITAIHE"
+ },
+ {
+ "cityName": "泉州",
+ "keyword": "泉州QUANZHOU"
+ },
+ {
+ "cityName": "曲靖",
+ "keyword": "曲靖QUJING"
+ },
+ {
+ "cityName": "衢州",
+ "keyword": "衢州QUZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "R",
+ "data": [
+ {
+ "cityName": "日喀则",
+ "keyword": "日喀则RIKAZE"
+ },
+ {
+ "cityName": "日照",
+ "keyword": "日照RIZHAO"
+ }
+ ]
+ },
+ {
+ "letter": "S",
+ "data": [
+ {
+ "cityName": "三门峡",
+ "keyword": "三门峡SANMENXIA"
+ },
+ {
+ "cityName": "三明",
+ "keyword": "三明SANMING"
+ },
+ {
+ "cityName": "三沙",
+ "keyword": "三沙SANSHA"
+ },
+ {
+ "cityName": "三亚",
+ "keyword": "三亚SANYA"
+ },
+ {
+ "cityName": "上海",
+ "keyword": "上海SHANGHAI"
+ },
+ {
+ "cityName": "商洛",
+ "keyword": "商洛SHANGLUO"
+ },
+ {
+ "cityName": "商丘",
+ "keyword": "商丘SHANGQIU"
+ },
+ {
+ "cityName": "上饶",
+ "keyword": "上饶SHANGRAO"
+ },
+ {
+ "cityName": "山南",
+ "keyword": "山南SHANNAN"
+ },
+ {
+ "cityName": "汕头",
+ "keyword": "汕头SHANTOU"
+ },
+ {
+ "cityName": "汕尾",
+ "keyword": "汕尾SHANWEI"
+ },
+ {
+ "cityName": "韶关",
+ "keyword": "韶关SHAOGUAN"
+ },
+ {
+ "cityName": "绍兴",
+ "keyword": "绍兴SHAOXING"
+ },
+ {
+ "cityName": "邵阳",
+ "keyword": "邵阳SHAOYANG"
+ },
+ {
+ "cityName": "沈阳",
+ "keyword": "沈阳SHENYANG"
+ },
+ {
+ "cityName": "深圳",
+ "keyword": "深圳SHENZHEN"
+ },
+ {
+ "cityName": "石家庄",
+ "keyword": "石家庄SHIJIAZHUANG"
+ },
+ {
+ "cityName": "十堰",
+ "keyword": "十堰SHIYAN"
+ },
+ {
+ "cityName": "石嘴山",
+ "keyword": "石嘴山SHIZUISHAN"
+ },
+ {
+ "cityName": "双鸭山",
+ "keyword": "双鸭山SHUANGYASHAN"
+ },
+ {
+ "cityName": "朔州",
+ "keyword": "朔州SHUOZHOU"
+ },
+ {
+ "cityName": "四平",
+ "keyword": "四平SIPING"
+ },
+ {
+ "cityName": "松原",
+ "keyword": "松原SONGYUAN"
+ },
+ {
+ "cityName": "绥化",
+ "keyword": "绥化SUIHUA"
+ },
+ {
+ "cityName": "遂宁",
+ "keyword": "遂宁SUINING"
+ },
+ {
+ "cityName": "随州",
+ "keyword": "随州SUIZHOU"
+ },
+ {
+ "cityName": "宿迁",
+ "keyword": "宿迁SUQIAN"
+ },
+ {
+ "cityName": "苏州",
+ "keyword": "苏州SUZHOU"
+ },
+ {
+ "cityName": "宿州",
+ "keyword": "宿州SUZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "T",
+ "data": [
+ {
+ "cityName": "塔城",
+ "keyword": "塔城TACHENG"
+ },
+ {
+ "cityName": "漯河",
+ "keyword": "漯河TAHE"
+ },
+ {
+ "cityName": "泰安",
+ "keyword": "泰安TAIAN"
+ },
+ {
+ "cityName": "太原",
+ "keyword": "太原TAIYUAN"
+ },
+ {
+ "cityName": "泰州",
+ "keyword": "泰州TAIZHOU"
+ },
+ {
+ "cityName": "台州",
+ "keyword": "台州TAIZHOU"
+ },
+ {
+ "cityName": "唐山",
+ "keyword": "唐山TANGSHAN"
+ },
+ {
+ "cityName": "天津",
+ "keyword": "天津TIANJIN"
+ },
+ {
+ "cityName": "天水",
+ "keyword": "天水TIANSHUI"
+ },
+ {
+ "cityName": "铁岭",
+ "keyword": "铁岭TIELING"
+ },
+ {
+ "cityName": "铜川",
+ "keyword": "铜川TONGCHUAN"
+ },
+ {
+ "cityName": "通化",
+ "keyword": "通化TONGHUA"
+ },
+ {
+ "cityName": "通辽",
+ "keyword": "通辽TONGLIAO"
+ },
+ {
+ "cityName": "铜陵",
+ "keyword": "铜陵TONGLING"
+ },
+ {
+ "cityName": "铜仁",
+ "keyword": "铜仁TONGREN"
+ },
+ {
+ "cityName": "吐鲁番",
+ "keyword": "吐鲁番TULUFAN"
+ }
+ ]
+ },
+ {
+ "letter": "W",
+ "data": [
+ {
+ "cityName": "潍坊",
+ "keyword": "潍坊WEIFANG"
+ },
+ {
+ "cityName": "威海",
+ "keyword": "威海WEIHAI"
+ },
+ {
+ "cityName": "渭南",
+ "keyword": "渭南WEINAN"
+ },
+ {
+ "cityName": "文山",
+ "keyword": "文山WENSHAN"
+ },
+ {
+ "cityName": "温州",
+ "keyword": "温州WENZHOU"
+ },
+ {
+ "cityName": "乌海",
+ "keyword": "乌海WUHAI"
+ },
+ {
+ "cityName": "武汉",
+ "keyword": "武汉WUHAN"
+ },
+ {
+ "cityName": "芜湖",
+ "keyword": "芜湖WUHU"
+ },
+ {
+ "cityName": "乌兰察布",
+ "keyword": "乌兰察布WULANCHABU"
+ },
+ {
+ "cityName": "乌鲁木齐",
+ "keyword": "乌鲁木齐WULUMUQI"
+ },
+ {
+ "cityName": "武威",
+ "keyword": "武威WUWEI"
+ },
+ {
+ "cityName": "无锡",
+ "keyword": "无锡WUXI"
+ },
+ {
+ "cityName": "吴忠",
+ "keyword": "吴忠WUZHONG"
+ },
+ {
+ "cityName": "梧州",
+ "keyword": "梧州WUZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "X",
+ "data": [
+ {
+ "cityName": "厦门",
+ "keyword": "厦门XIAMEN"
+ },
+ {
+ "cityName": "西安",
+ "keyword": "西安XIAN"
+ },
+ {
+ "cityName": "湘潭",
+ "keyword": "湘潭XIANGTAN"
+ },
+ {
+ "cityName": "湘西",
+ "keyword": "湘西XIANGXI"
+ },
+ {
+ "cityName": "襄阳",
+ "keyword": "襄阳XIANGYANG"
+ },
+ {
+ "cityName": "咸宁",
+ "keyword": "咸宁XIANNING"
+ },
+ {
+ "cityName": "咸阳",
+ "keyword": "咸阳XIANYANG"
+ },
+ {
+ "cityName": "孝感",
+ "keyword": "孝感XIAOGAN"
+ },
+ {
+ "cityName": "锡林郭勒",
+ "keyword": "锡林郭勒XILINGUOLE"
+ },
+ {
+ "cityName": "兴安",
+ "keyword": "大兴安岭DAXINGANLING"
+ },
+ {
+ "cityName": "兴安",
+ "keyword": "兴安XINGAN"
+ },
+ {
+ "cityName": "邢台",
+ "keyword": "邢台XINGTAI"
+ },
+ {
+ "cityName": "西宁",
+ "keyword": "西宁XINING"
+ },
+ {
+ "cityName": "新疆",
+ "keyword": "新疆XINJIANG"
+ },
+ {
+ "cityName": "新乡",
+ "keyword": "新乡XINXIANG"
+ },
+ {
+ "cityName": "信阳",
+ "keyword": "信阳XINYANG"
+ },
+ {
+ "cityName": "新余",
+ "keyword": "新余XINYU"
+ },
+ {
+ "cityName": "忻州",
+ "keyword": "忻州XINZHOU"
+ },
+ {
+ "cityName": "西双版纳",
+ "keyword": "西双版纳XISHUANGBANNA"
+ },
+ {
+ "cityName": "宣城",
+ "keyword": "宣城XUANCHENG"
+ },
+ {
+ "cityName": "许昌",
+ "keyword": "许昌XUCHANG"
+ },
+ {
+ "cityName": "徐州",
+ "keyword": "徐州XUZHOU"
+ }
+ ]
+ },
+ {
+ "letter": "Y",
+ "data": [
+ {
+ "cityName": "雅安",
+ "keyword": "雅安YAAN"
+ },
+ {
+ "cityName": "延安",
+ "keyword": "延安YANAN"
+ },
+ {
+ "cityName": "延边",
+ "keyword": "延边YANBIAN"
+ },
+ {
+ "cityName": "盐城",
+ "keyword": "盐城YANCHENG"
+ },
+ {
+ "cityName": "阳江",
+ "keyword": "阳江YANGJIANG"
+ },
+ {
+ "cityName": "阳泉",
+ "keyword": "阳泉YANGQUAN"
+ },
+ {
+ "cityName": "扬州",
+ "keyword": "扬州YANGZHOU"
+ },
+ {
+ "cityName": "烟台",
+ "keyword": "烟台YANTAI"
+ },
+ {
+ "cityName": "宜宾",
+ "keyword": "宜宾YIBIN"
+ },
+ {
+ "cityName": "宜昌",
+ "keyword": "宜昌YICHANG"
+ },
+ {
+ "cityName": "伊春",
+ "keyword": "伊春YICHUN"
+ },
+ {
+ "cityName": "宜春",
+ "keyword": "宜春YICHUN"
+ },
+ {
+ "cityName": "伊犁",
+ "keyword": "伊犁YILI"
+ },
+ {
+ "cityName": "银川",
+ "keyword": "银川YINCHUAN"
+ },
+ {
+ "cityName": "营口",
+ "keyword": "营口YINGKOU"
+ },
+ {
+ "cityName": "鹰潭",
+ "keyword": "鹰潭YINGTAN"
+ },
+ {
+ "cityName": "益阳",
+ "keyword": "益阳YIYANG"
+ },
+ {
+ "cityName": "永州",
+ "keyword": "永州YONGZHOU"
+ },
+ {
+ "cityName": "岳阳",
+ "keyword": "岳阳YUEYANG"
+ },
+ {
+ "cityName": "玉林",
+ "keyword": "玉林YULIN"
+ },
+ {
+ "cityName": "榆林",
+ "keyword": "榆林YULIN"
+ },
+ {
+ "cityName": "运城",
+ "keyword": "运城YUNCHENG"
+ },
+ {
+ "cityName": "云浮",
+ "keyword": "云浮YUNFU"
+ },
+ {
+ "cityName": "玉树",
+ "keyword": "玉树YUSHU"
+ },
+ {
+ "cityName": "玉溪",
+ "keyword": "玉溪YUXI"
+ }
+ ]
+ },
+ {
+ "letter": "Z",
+ "data": [
+ {
+ "cityName": "枣庄",
+ "keyword": "枣庄ZAOZHUANG"
+ },
+ {
+ "cityName": "张家界",
+ "keyword": "张家界ZHANGJIAJIE"
+ },
+ {
+ "cityName": "张家口",
+ "keyword": "张家口ZHANGJIAKOU"
+ },
+ {
+ "cityName": "张掖",
+ "keyword": "张掖ZHANGYE"
+ },
+ {
+ "cityName": "漳州",
+ "keyword": "漳州ZHANGZHOU"
+ },
+ {
+ "cityName": "湛江",
+ "keyword": "湛江ZHANJIANG"
+ },
+ {
+ "cityName": "肇庆",
+ "keyword": "肇庆ZHAOQING"
+ },
+ {
+ "cityName": "昭通",
+ "keyword": "昭通ZHAOTONG"
+ },
+ {
+ "cityName": "朝阳",
+ "keyword": "朝阳ZHAOYANG"
+ },
+ {
+ "cityName": "郑州",
+ "keyword": "郑州ZHENGZHOU"
+ },
+ {
+ "cityName": "镇江",
+ "keyword": "镇江ZHENJIANG"
+ },
+ {
+ "cityName": "中山",
+ "keyword": "中山ZHONGSHAN"
+ },
+ {
+ "cityName": "中卫",
+ "keyword": "中卫ZHONGWEI"
+ },
+ {
+ "cityName": "周口",
+ "keyword": "周口ZHOUKOU"
+ },
+ {
+ "cityName": "舟山",
+ "keyword": "舟山ZHOUSHAN"
+ },
+ {
+ "cityName": "珠海",
+ "keyword": "珠海ZHUHAI"
+ },
+ {
+ "cityName": "驻马店",
+ "keyword": "驻马店ZHUMADIAN"
+ },
+ {
+ "cityName": "株洲",
+ "keyword": "株洲ZHUZHOU"
+ },
+ {
+ "cityName": "淄博",
+ "keyword": "淄博ZIBO"
+ },
+ {
+ "cityName": "自贡",
+ "keyword": "自贡ZIGONG"
+ },
+ {
+ "cityName": "资阳",
+ "keyword": "资阳ZIYANG"
+ },
+ {
+ "cityName": "遵义",
+ "keyword": "遵义ZUNYI"
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/pages/home/city-select/index.js b/pages/home/city-select/index.js
index 3a2f5e8..9f2b0b1 100644
--- a/pages/home/city-select/index.js
+++ b/pages/home/city-select/index.js
@@ -1,17 +1,101 @@
// pages/home/about/index.js
+const util = require('../../../utils/util')
+const event = require('../../../utils/event')
+const city = require("./city.js")
+const app = getApp()
+
Page({
/**
* 页面的初始数据
*/
data: {
-
+ value: '',
+ height: app.globalData.fragmentHeight - 100,
+ localCity:'',//当前定位城市
+ hotCity: ['北京', '上海', '广州', '深圳', '杭州', '长沙', '武汉', '厦门', '西安', '昆明', '成都', '重庆'], // 热门城市
+ lists:[],//城市列表
+ searchResult:[],//查找列表
+ titleHeight: 240,
+ indexHeight: 0,
+ itemHeight: 0,
+ scrollViewId: '', // scroll-view滚动到的子元素的id 锚点
+ touchmove: false, // 是否在索引表上滑动
+ touchmoveIndex: -1
},
-
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
-
+ var height = app.globalData.fragmentHeight - 100
+ this.data.indexHeight = height - 48
+ var titleHeight = this.px2rpx(app.globalData.CustomBar) + 116
+ var itemHeight = parseInt(this.data.indexHeight / 25)
+ this.setData({ height, itemHeight, indexHeight: this.data.indexHeight, titleHeight,lists: city.list })
+ },
+ getInputValue(e){
+ this.setData({ value:e.detail.value },()=>{
+ this.searchCity()
+ })
+ },
+ closeInput(e){
+ this.setData({ value: '' })
+ },
+ searchCity(){
+ let result = []
+ city.list.forEach((item1, index1) => {
+ item1.data.forEach((item2, index2) => {
+ if (item2.keyword.indexOf(this.data.value.toLocaleUpperCase()) !== -1) {
+ result.push(item2)
+ }
+ })
+ })
+ this.setData({ searchResult: result })
+ },
+ rpx2px: function(rpx) {
+ return rpx / 750 * app.globalData.windowWidth
+ },
+ px2rpx: function(px) {
+ return px * 750 / app.globalData.windowWidth
+ },
+ touchStart: function(e) {
+ this.setData({ touchmove: true })
+ let pageY = this.px2rpx(e.touches[0].pageY)
+ let index = Math.floor((pageY - this.data.titleHeight) / this.data.itemHeight)
+ let item = this.data.lists[index]
+ if (item) {
+ this.setData({ scrollViewId: item.letter == '#' ? 'E_' : item.letter, touchmoveIndex: index })
+ }
+ },
+ touchMove: function(e) {
+ let pageY = this.px2rpx(e.touches[0].pageY)
+ let index = Math.floor((pageY - this.data.titleHeight) / this.data.itemHeight)
+ let item = this.data.lists[index]
+ if (item) {
+ this.setData({ scrollViewId: item.letter == '#' ? 'E_' : item.letter, touchmoveIndex: index })
+ }
+ },
+ touchEnd: function() {
+ this.setData({ touchmove: false, touchmoveIndex: -1 })
+ },
+ lookItem: function(e){
+ var item = null
+ if(util.isEmpty(this.data.value)){
+ if(!util.isEmpty(e.currentTarget.dataset.page)){
+ item = this.data.lists[e.currentTarget.dataset.page].data[e.currentTarget.dataset.index]
+ } else {
+ item = this.data.hotCity[e.currentTarget.dataset.index]
+ }
+ } else {
+ item = this.data.searchResult[e.currentTarget.dataset.index]
+ }
+ if(app.nowLocation) {
+ app.nowLocation.cityName = item.cityName.replace('市', '')
+ app.nowLocation.cityCode = item.code
+ } else {
+ app.nowLocation = { cityName: item.cityName.replace('市', ''), cityCode: item.code }
+ }
+ event.emit('EventMessage', { what: 444, desc: 'nowLocation' })
+ wx.navigateBack()
}
})
\ No newline at end of file
diff --git a/pages/home/city-select/index.json b/pages/home/city-select/index.json
index 1c10f0f..7ce2263 100644
--- a/pages/home/city-select/index.json
+++ b/pages/home/city-select/index.json
@@ -1,6 +1,6 @@
{
"usingComponents": {
- "wux-cell-group": "/components/cell-group/index",
+ "free-input":"/components/free-input/index",
"wux-cell": "/components/cell/index"
}
}
\ No newline at end of file
diff --git a/pages/home/city-select/index.wxml b/pages/home/city-select/index.wxml
index 89822b6..810b95a 100644
--- a/pages/home/city-select/index.wxml
+++ b/pages/home/city-select/index.wxml
@@ -1,10 +1,47 @@
- 关于纸通宝
+ 城市选择
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+ {{item.cityName}}
+
+
+
+
+ 定位城市
+
+
+ {{localCity}}
+
+
+
+
+ 热门城市
+
+ {{item}}
+
+
+
+
+
+ {{pageItem.letter}}
+
+ {{item.cityName}}
+
+
+
+
+
+
+
+ {{item.letter}}
+
+{{lists[touchmoveIndex].letter}}
diff --git a/pages/home/city-select/index.wxss b/pages/home/city-select/index.wxss
index 5b09acd..1a15d23 100644
--- a/pages/home/city-select/index.wxss
+++ b/pages/home/city-select/index.wxss
@@ -1 +1,69 @@
-/* pages/home/about/index.wxss */
\ No newline at end of file
+/* pages/home/about/index.wxss */
+.list-bar{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: flex-start;
+ z-index: 19;
+ position: absolute;
+ right: 0;
+ width: 60rpx;
+}
+.list-text{
+ font-size: 22rpx;
+}
+.list-alert{
+ position: absolute;
+ z-index: 20;
+ width: 160rpx;
+ height: 160rpx;
+ left: 50%;
+ top: 50%;
+ margin-left: -80rpx;
+ margin-top: -80rpx;
+ border-radius: 80rpx;
+ text-align: center;
+ line-height: 160rpx;
+ font-size: 70rpx;
+ color: #fff;
+ background-color: rgba(0, 0, 0, 0.5);
+}
+
+
+.city-names {
+ display: flex;
+ flex-wrap: wrap;
+ justify-content: space-between;
+ align-content: space-between;
+ /* width: 630rpx; */
+ padding: 12rpx 90rpx 26rpx 30rpx;
+}
+.city-name-item {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 140rpx;
+ height: 56rpx;
+ margin-top: 16rpx;
+ /* border: solid 1rpx #ccc; */
+ border-radius: 28rpx;
+ font-size: 28rpx;
+ color: #333;
+ position: relative;
+}
+.city-name-item::before {
+ content: "";
+ position: absolute;
+ width: 200%;
+ height: 200%;
+ -webkit-transform-origin: 0 0;
+ transform-origin: 0 0;
+ -webkit-transform: scale(0.5, 0.5);
+ transform: scale(0.5, 0.5);
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ left: 0;
+ top: 0;
+ border-radius: 56rpx;
+ border: 1px solid #ccc;
+}
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index ab2d8b4..eaa07dd 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -3,14 +3,20 @@ import { zconfig, loginToken, getBaseInfo, getPopupInfo } from "../api/ztb"
import { pconfig } from "../api/payment"
import { mconfig } from "../api/moment"
const util = require('../../utils/util')
+const wxqqmap = require('../../utils/qqmap-wx-jssdk.min')
const event = require('../../utils/event')
const storage = require('../../utils/storage')
const app = getApp()
+const qqwxmap = new wxqqmap({
+ key: 'GAMBZ-CBGCK-GB6J3-A6PJX-F6ZHH-IWFUD' // 必填,这里最好填自己申请的的
+ // key: 'NGOBZ-UL7ED-WJ34D-PMWW7-LBDI2-J5FYK'
+})
Page({
data: {
+ cityName: '',
TabList: [
- { index: 0, value: 'article', badge: 0, name: '情报' },
+ { index: 0, value: 'article', badge: 0, name: '首页' },
{ index: 1, value: 'mall', badge: 0, name: '行情' },
{ index: 2, value: 'agent', badge: 0, name: '交易' },
{ index: 3, value: 'home', badge: 0, name: '我的' }
@@ -48,7 +54,22 @@ Page({
this.toIndex()
}
},
+ alertMessage: function(content){
+ this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
+ this.wuxDialog.open({
+ resetOnClose: true,
+ title: '温馨提示',
+ content,
+ buttons: [{
+ text: '确定',
+ type: 'primary',
+ onTap(e) {
+ }
+ }]
+ })
+ },
defaultIndex: function () {
+ this.locationing()
this.onResume()
if (this.data.path) {
wx.navigateTo({ url: this.data.path })
@@ -59,6 +80,82 @@ Page({
}
})
},
+ locationing: function() {
+ var that = this
+ wx.getLocation({
+ type: 'gcj02',
+ success (res) {
+ app.nowLocation = res
+ qqwxmap.reverseGeocoder({
+ location: res,
+ success: function (res) {
+ app.nowLocation.cityName = res.result.address_component.city.replace('市', '')
+ app.nowLocation.cityCode = res.result.ad_info.city_code
+ that.setData({ cityName: app.nowLocation.cityName })
+ that.locate = true
+ },
+ fail: function (res) {
+ that.locate = true
+ }
+ })
+ },
+ fail (e){
+ that.locate = true
+ if (e && (e.errCode == 2 || e.errCode == 404)) {
+ that.alertMessage('位置信息获取失败,请检查手机“位置信息”是否未开启')
+ } else if (e && ((e.errMsg.indexOf('getLocation:fail auth deny') != -1) || (e.errMsg.indexOf('system permission denied') != -1))) {
+ wx.getSetting({
+ success(res){
+ if(res && (res.authSetting["scope.userLocation"] !== undefined && res.authSetting["scope.userLocation"] !==true)){
+ that.detectSettings()
+ } else {
+ that.alertMessage('位置信息获取失败,请检查微信是否有定位权限')
+ }
+ }
+ })
+ } else if (e && e.errMsg.indexOf('getLocation:fail connect ETIMEDOUT') != -1) {
+ that.alertMessage('位置信息获取失败,请检查网络是否连接')
+ }
+ }
+ })
+ },
+ detectSettings: function(){
+ var that = this
+ this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
+ this.wuxDialog.open({
+ resetOnClose: true,
+ title: '温馨提示',
+ content: '小程序没有定位权限,无法进行送餐服务,请前往设置微信小程序的定位权限。',
+ buttons: [{
+ text: '前往设置',
+ type: 'primary',
+ onTap(e) {
+ wx.openSetting({
+ success(result){
+ if(result && (result.authSetting["scope.userLocation"] !== undefined && result.authSetting["scope.userLocation"] ===true)){
+ // 成功设置
+ that.locationing()
+ } else {
+ that.detectSettings()
+ }
+ }
+ })
+ }
+ }]
+ })
+ Dialog.alert({ title: '温馨提示', message: '小程序没有定位权限,无法进行送餐服务,请前往设置微信小程序的定位权限。', confirmButtonText: '前往设置' }).then(() => {
+ wx.openSetting({
+ success(result){
+ if(result && (result.authSetting["scope.userLocation"] !== undefined && result.authSetting["scope.userLocation"] ===true)){
+ // 成功设置
+ that.locationing()
+ } else {
+ that.detectSettings()
+ }
+ }
+ })
+ })
+ },
toIndex: function () {
if (!app.globalData.token) {
wx.hideLoading()
@@ -97,12 +194,22 @@ Page({
this.setData({ pageIndex: Number(e.currentTarget.dataset.tab) })
this.onResume()
},
+ onAgentClick: function({detail}){
+ if(detail.what == 1) {
+ this.setData({ pageIndex: 2 })
+ this.onResume()
+ }
+ },
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
if (this.data.inited) {
this.onResume()
+ }
+ // 如果定位完成,但是还是没有获取城市信息,那么就要进行城市选择
+ if(this.locate && util.isEmpty(this.data.cityName)){
+
}
if(app.globalData.userInfo && !app.globalData.userInfo.identityTag){
wx.navigateTo({ url: '/pages/home/tab1/index' })
diff --git a/pages/index/index.json b/pages/index/index.json
index eb31f7e..16313a7 100644
--- a/pages/index/index.json
+++ b/pages/index/index.json
@@ -1,10 +1,11 @@
{
"usingComponents": {
- "mall": "/pages/mall/index/index",
+ "mall": "/pages/moment/fragment/index",
"article": "/pages/article/fragment/index",
"agent": "/pages/agent/fragment/index",
"home": "/pages/home/index/index",
"wux-image": "/components/image/index",
+ "wux-dialog": "/components/dialog/index",
"wux-popup": "/components/popup/index"
}
}
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 13760d5..929aa79 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -2,10 +2,10 @@
-
+
-
+
@@ -41,4 +41,6 @@
活动规则
-
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/pages/moment/fragment/index.js b/pages/moment/fragment/index.js
new file mode 100644
index 0000000..dcb8aae
--- /dev/null
+++ b/pages/moment/fragment/index.js
@@ -0,0 +1,130 @@
+// pages/message/index.js
+import { getFactoryPrice, getSuccessNotices } from "../../api/ztb"
+const event = require('../../../utils/event')
+const util = require('../../../utils/util')
+const app = getApp()
+
+Component({
+ options: {
+ addGlobalClass: true,
+ multipleSlots: true
+ },
+ properties:{
+ cityName: { //这个是可以自定义最外层的view的样式
+ type: String,
+ value: ''
+ }
+ },
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ height: app.globalData.safeFragmentHeight - 270,
+ kg: app.globalData.kg,
+ firstShow: false,
+ noticeList: [],
+ tabList: [ '推荐', '关注', '全部' , '资讯'],
+ tabIndex: 0,
+ },
+ lifetimes: {
+ // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+ attached: function () {
+ event.on('EventMessage', this, this.onEvent)
+ },
+ detached: function () {
+ event.remove('EventMessage', this)
+ }
+ },
+ methods: {
+ onRestart: function () {
+ if(!this.data.firstShow){
+ this.setData({
+ height: app.globalData.safeFragmentHeight - 270,
+ StatusBar: app.globalData.StatusBar || 40,
+ customHeight: app.globalData.customHeight,
+ tabIndex: 0,
+ firstShow: true
+ })
+ this.fetchAgentList()
+ }
+ this.data.firstShow = true
+ if(!this.data.noticeList.length){
+ this.fetchNoticeList()
+ }
+ },
+ onEvent: function (message) {
+ console.log('mall>>index>>onEvent', message)
+ if (message.what == 10 && app.globalData.isVIP == 1) {
+ // this.setData({ token: app.globalData.token })
+ // this.onRefreshList()
+ } else if(message.what == 1001){
+ this.setData({ kg: app.globalData.kg })
+ } else if(message.what == 888){
+ this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false })
+ this.fetchAgentList()
+ } else if(message.what == 444){
+ this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false, cityName: app.nowLocation.cityName })
+ this.fetchAgentList()
+ }
+ },
+ chooseCity: function(){
+ wx.navigateTo({url: `/pages/home/city-select/index?type=1` })
+ },
+ searchList: function(){
+
+ },
+ postList: function(){
+
+ },
+ onTabChange: function({detail}){
+ if(this.data.tabIndex == Number(detail.index)){
+ return
+ }
+ this.fetchAgentList()
+ },
+ fetchNoticeList: function(){
+ if (this.data.loopRequesting) {
+ return
+ }
+ this.data.loopRequesting = true
+ getSuccessNotices().then(result => {
+ this.data.loopRequesting = false
+ this.data.noticeList = []
+ if(result.data && result.data.length){
+ for (let index = 0; index < result.data.length; index++) {
+ this.data.noticeList.push(result.data[index].msg)
+ }
+ this.setData({noticeList: this.data.noticeList})
+ }
+ }).catch(err => {
+ this.data.loopRequesting = false
+ })
+ },
+ //*************************************************fetchAgentList************************************************//
+ fetchAgentList: function () {
+ if (this.data.requesting || this.data.finished) {
+ return
+ }
+ if (this.data.loading) {
+ this.data.requesting = true
+ } else {
+ this.setData({ requesting: true })
+ }
+ getFactoryPrice(this.data.form).then(result => {
+ if (result.data.records.length) {
+ var respList = result.data.records
+ let nowList = `orderList[${this.data.orderList.length}]`
+ var num = result.data.current
+ var finished = result.data.current >= result.data.pages
+ this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false })
+ } else {
+ this.setData({ requesting: false, finished: true, loading: false })
+ }
+ }).catch(err => {
+ //异常回调
+ this.setData({ requesting: false, finished: true, loading: false })
+ })
+ }
+ }
+
+})
\ No newline at end of file
diff --git a/pages/moment/fragment/index.json b/pages/moment/fragment/index.json
new file mode 100644
index 0000000..1e3e806
--- /dev/null
+++ b/pages/moment/fragment/index.json
@@ -0,0 +1,6 @@
+{
+ "component": true,
+ "usingComponents": {
+ "wux-tabi": "/components/tabi/index"
+ }
+}
\ No newline at end of file
diff --git a/pages/moment/fragment/index.wxml b/pages/moment/fragment/index.wxml
new file mode 100644
index 0000000..9c73a69
--- /dev/null
+++ b/pages/moment/fragment/index.wxml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ {{cityName}}
+
+
+
+
+ 输入纸名/品名/纸厂/规格
+
+
+
+
+
+
+
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/moment/fragment/index.wxss b/pages/moment/fragment/index.wxss
new file mode 100644
index 0000000..858aea0
--- /dev/null
+++ b/pages/moment/fragment/index.wxss
@@ -0,0 +1,34 @@
+.top-bg{
+ background-image: linear-gradient(127deg, rgba(0,122,255,0.67) 0%, rgba(13,100,227,0.95) 100%);
+}
+
+.banner{
+ border-radius: 16rpx;
+}
+
+.banner-left{
+ margin-left: 24rpx;
+ border-radius: 16rpx;
+}
+
+.item-content {
+ background: rgba(255, 255, 255, 1);
+ padding:32rpx
+}
+
+.tui-swiper {
+ margin-left: 8rpx;
+ font-size: 26rpx;
+ height: 60rpx;
+ flex: 1;
+}
+
+.tui-news-item {
+ line-height: 56rpx;
+ padding-top: 4rpx;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ color: #555;
+ text-align: center;
+}
\ No newline at end of file
diff --git a/pages/purchase/fragment/index.js b/pages/purchase/fragment/index.js
new file mode 100644
index 0000000..2621d79
--- /dev/null
+++ b/pages/purchase/fragment/index.js
@@ -0,0 +1,118 @@
+// pages/goods/index/index.js
+import { paperCategoryList, getProductList } from "../../api/ztb"
+const event = require('../../../utils/event')
+const app = getApp()
+
+Component({
+ options: {
+ addGlobalClass: true,
+ multipleSlots: true
+ },
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ height: app.globalData.fragmentHeight,
+ kg: app.globalData.kg,
+ loading: true,
+ requesting: false,
+ finished: false,
+ cateList: [],
+ cateScroll: false,
+ top: 0,
+ orderList: [],
+ form: {
+ firstCategoryId: '',
+ pageNum: 1,
+ pageSize:15
+ }
+ },
+ lifetimes: {
+ // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
+ attached: function () {
+ event.on('EventMessage', this, this.onEvent)
+ },
+ detached: function () {
+ event.remove('EventMessage', this)
+ }
+ },
+ methods: {
+ onRestart: function(){
+ if (!this.data.firstShow) {
+ this.setData({ height: app.globalData.fragmentHeight, kg: app.globalData.kg })
+ this.fetchCateList()
+ this.fetchGoodsList()
+ }
+ this.data.firstShow = true
+ },
+ fetchCateList: function(){
+ paperCategoryList({ type: 1 }).then(result => {
+ var cateList = [{id: '', name: '全部'}].concat(result.data)
+ this.setData({ cateList: cateList, cateScroll: cateList.length >= 5 })
+ })
+ },
+ onCategoryChange: function (e) {
+ if (this.data.form.firstCategoryId == e.detail.key) {
+ return
+ }
+ this.setData({ ['form.firstCategoryId']: e.detail.key })
+ this.onRefreshList()
+ },
+ // 下拉刷新...
+ onRefreshList: function () {
+ if (this.data.requesting) {
+ return
+ }
+ this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false })
+ this.fetchGoodsList()
+ },
+ // 获取特价列表
+ fetchGoodsList: function () {
+ if (this.data.requesting || this.data.finished) {
+ return
+ }
+ if (this.data.loading) {
+ this.data.requesting = true
+ } else {
+ this.setData({ requesting: true })
+ }
+ getProductList(this.data.form).then(result => {
+ //成功回调
+ if (result.data.records.length) {
+ var respList = result.data.records
+ let nowList = `orderList[${this.data.orderList.length}]`
+ var num = result.data.current
+ var finished = result.data.current >= result.data.pages
+ if(this.data.form.pageNum == 1){
+ this.setData({
+ [nowList]: respList,
+ total: result.data.total,
+ ['form.pageNum']: (num + 1),
+ top: 0,
+ finished,
+ requesting: false,
+ loading: false
+ })
+ } else {
+ this.setData({
+ [nowList]: respList,
+ total: result.data.total,
+ ['form.pageNum']: (num + 1),
+ finished,
+ requesting: false,
+ loading: false
+ })
+ }
+ } else {
+ this.setData({ finished: true, requesting: false, loading: false })
+ }
+ }).catch(err => {
+ this.setData({ requesting: false, loading: false })
+ })
+ },
+ lookItem: function (e) {
+ var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
+ wx.navigateTo({ url: '/pages/purchase/detail/index?id=' + item.id })
+ }
+ }
+})
\ No newline at end of file
diff --git a/pages/purchase/fragment/index.json b/pages/purchase/fragment/index.json
new file mode 100644
index 0000000..6e23f0d
--- /dev/null
+++ b/pages/purchase/fragment/index.json
@@ -0,0 +1,11 @@
+{
+ "usingComponents": {
+ "wux-skeleton": "/components/skeleton/index",
+ "wux-skeleton-avatar": "/components/skeleton-avatar/index",
+ "wux-skeleton-paragraph": "/components/skeleton-paragraph/index",
+ "refresh-view": "/components/refresher/index",
+ "wux-image": "/components/image/index",
+ "wux-divider": "/components/divider/index",
+ "purchase-item": "/pages/mall/purchase-item/index"
+ }
+}
\ No newline at end of file
diff --git a/pages/purchase/fragment/index.wxml b/pages/purchase/fragment/index.wxml
new file mode 100644
index 0000000..438317d
--- /dev/null
+++ b/pages/purchase/fragment/index.wxml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+ {{loading? '正在加载' : '暂无数据'}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{finished?'到底啦~':'加载中...'}}
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/purchase/fragment/index.wxss b/pages/purchase/fragment/index.wxss
new file mode 100644
index 0000000..47a9dca
--- /dev/null
+++ b/pages/purchase/fragment/index.wxss
@@ -0,0 +1 @@
+/* pages/goods/index/index.wxss */
diff --git a/pages/purchase/index/index.wxml b/pages/purchase/index/index.wxml
index 92133d1..22465ac 100644
--- a/pages/purchase/index/index.wxml
+++ b/pages/purchase/index/index.wxml
@@ -4,10 +4,9 @@
采购管理
-
+
-