Authored by 王水玲

ufo

@@ -80,9 +80,15 @@ @@ -80,9 +80,15 @@
80 "query": "" 80 "query": ""
81 }, 81 },
82 { 82 {
83 - "id": -1, 83 + "id": 8,
84 "name": "出售", 84 "name": "出售",
85 - "pathName": "pages/sell/index", 85 + "pathName": "page/subPackage/pages/sell/index",
  86 + "query": ""
  87 + },
  88 + {
  89 + "id": -1,
  90 + "name": "订单列表",
  91 + "pathName": "pages/orderList/index",
86 "query": "" 92 "query": ""
87 } 93 }
88 ] 94 ]
@@ -3,7 +3,6 @@ import { Provider, connect } from '@tarojs/redux' @@ -3,7 +3,6 @@ import { Provider, connect } from '@tarojs/redux'
3 import { bindActionCreators } from 'redux'; 3 import { bindActionCreators } from 'redux';
4 import Index from './pages/index' 4 import Index from './pages/index'
5 import createStore from './store' 5 import createStore from './store'
6 -import userUtil from './utils/user';  
7 import * as globalData from './actions/globalData'; 6 import * as globalData from './actions/globalData';
8 import udid from './utils/udid'; 7 import udid from './utils/udid';
9 import './app.scss' 8 import './app.scss'
@@ -25,13 +24,13 @@ class App extends Component { @@ -25,13 +24,13 @@ class App extends Component {
25 'pages/search/index', 24 'pages/search/index',
26 'pages/searchList/index', 25 'pages/searchList/index',
27 'pages/filter/index', 26 'pages/filter/index',
28 - // 'pages/brand/index',  
29 'pages/productDetail/index', 27 'pages/productDetail/index',
30 'pages/sell/index', 28 'pages/sell/index',
31 'pages/classify/index', 29 'pages/classify/index',
32 'pages/message/index', 30 'pages/message/index',
33 'pages/userCenter/index', 31 'pages/userCenter/index',
34 - 'pages/login/index' 32 + 'pages/login/index',
  33 + 'pages/orderList/index'
35 ], 34 ],
36 window: { 35 window: {
37 backgroundTextStyle: 'light', 36 backgroundTextStyle: 'light',
1 -import Taro, {Component} from '@tarojs/taro';  
2 -import {View, ScrollView, Text, Navigator} from '@tarojs/components';  
3 -import './index.scss'  
4 -import {brand as brandModel} from '../../models';  
5 -import { SideIndex } from '../../components';  
6 -import { connect } from '@tarojs/redux';  
7 -import { modifyZoom } from '../../actions/brand'  
8 -  
9 -@connect(({ brand }) => ({  
10 - brand  
11 -}), (dispatch) => ({  
12 - modifyZoom (curData) {  
13 - dispatch(modifyZoom(curData))  
14 - }  
15 -}))  
16 -  
17 -export default class Brand extends Component {  
18 - constructor(props) {  
19 - super(props);  
20 - this.state = {  
21 - brandList: [],  
22 - indexList: []  
23 - };  
24 - }  
25 -  
26 - config = {  
27 - navigationBarTitleText: 'BRANDS'  
28 - }  
29 -  
30 - componentWillMount () { }  
31 -  
32 - componentDidMount () {  
33 - this.getBrandList();  
34 - }  
35 -  
36 - componentWillUnmount () { }  
37 -  
38 - componentDidShow () { }  
39 -  
40 - componentDidHide () { }  
41 -  
42 - getBrandList () {  
43 - brandModel.getBrandList({  
44 - channel: this.$router.params.channel || ''  
45 - }).then(res => {  
46 - this.setState({  
47 - brandList: res.brandList,  
48 - indexList: res.indexList  
49 - });  
50 - });  
51 - }  
52 -  
53 - onChangeBrandIndex (e) {  
54 - this.props.modifyZoom(e.target.id);  
55 - }  
56 -  
57 - render () {  
58 - const {indexList, brandList} = this.state;  
59 - let toView = this.props.brand.curZoom;  
60 -  
61 - return (  
62 - <View className='brand'>  
63 - <ScrollView className='brand-list-box'  
64 - scrollY  
65 - scrollWithAnimation  
66 - scrollTop='0'  
67 - lowerThreshold='20'  
68 - upperThreshold='20'  
69 - scrollIntoView={toView}>  
70 - {  
71 - brandList.map((item, brandKey) => {  
72 - return (  
73 - <View key={brandKey} className="per-brand-box">  
74 - <View className="index">  
75 - <Text id={item.index == '0~9' ? 'zero' : item.index} name={item.index} onClick={this.onChangeBrandIndex}>{item.index}</Text>  
76 - </View>  
77 - <View ClassName="brand-big-box clearfix">  
78 - {  
79 - item.brands.map(brand => {  
80 - return (  
81 - <View className="brand-box" key={brand.name}>  
82 - <Navigator>  
83 - <Text className="brand-name">{brand.name}</Text>  
84 - </Navigator>  
85 - </View>  
86 - )  
87 - })  
88 - }  
89 - </View>  
90 - </View>  
91 - )  
92 - })  
93 - }  
94 - </ScrollView>  
95 -  
96 - <SideIndex indexList={indexList}></SideIndex>  
97 - </View>  
98 - )  
99 - }  
100 -}  
1 -.brand {  
2 - .brand-list-box {  
3 - width: 100%;  
4 - height: 100vh;  
5 - background: #f6f6f6;  
6 -  
7 - .per-brand-box {  
8 - background: #fff;  
9 -  
10 - .index {  
11 - height: 60px;  
12 - line-height: 60px;  
13 - background-color: #f6f7f6;  
14 - padding: 0 30px;  
15 - font-family: "PingFang-SC-Medium";  
16 -  
17 - a {  
18 - font-size: 32px;  
19 - }  
20 - }  
21 - }  
22 -  
23 - .brand-big-box {  
24 - width: 100%;  
25 - }  
26 -  
27 - .brand-box {  
28 - width: 100%;  
29 - height: 80px;  
30 - line-height: 80px;  
31 - border-bottom: 1px solid #f6f6f6;  
32 - box-sizing: border-box;  
33 - overflow: hidden;  
34 -  
35 - .brand-logo {  
36 - margin: 0 auto;  
37 - width: 136px;  
38 - height: 136px;  
39 - overflow: hidden;  
40 -  
41 - img {  
42 - width: 100%;  
43 - }  
44 - }  
45 -  
46 - .brand-name {  
47 - font-size: 28px;  
48 - color: #000;  
49 - overflow: hidden;  
50 - display: inline-block;  
51 - padding: 0 30px;  
52 - font-family: "PingFang-SC-Regular" !important;  
53 - font-weight: normal;  
54 - }  
55 -  
56 - a {  
57 - height: 100%;  
58 - width: 100%;  
59 - display: inline-block;  
60 - font-weight: bold;  
61 - }  
62 - }  
63 - }  
64 -}  
  1 +import Taro, {Component} from '@tarojs/taro';
  2 +import {View} from '@tarojs/components';
  3 +
  4 +import './index.scss';
  5 +
  6 +export default class OrderList extends Component {
  7 + constructor() {
  8 + super(...arguments);
  9 +
  10 + this.state = {
  11 + tabs: ['出售', '代发货', '已发货', '交易成功', '交易失败'],
  12 + curTab: '代发货'
  13 + };
  14 + }
  15 +
  16 + render() {
  17 + let {tabs, curTab} = this.state;
  18 +
  19 + return (
  20 + <View className="order-list-page">
  21 + <View className="tabs">
  22 + {
  23 + tabs.map((item, index) => {
  24 + return (
  25 + <View className={curTab === item ? 'tabs-item actived' : 'tabs-item'} key={index}>{item}</View>
  26 + )
  27 + })
  28 + }
  29 + </View>
  30 + </View>
  31 + )
  32 + }
  33 +}
  1 +.tabs {
  2 + width: 100%;
  3 + height: 100px;
  4 + padding: 0 5px;
  5 + box-sizing: border-box;
  6 + background: #fff;
  7 + display: flex;
  8 + justify-content: space-between;
  9 +
  10 + .tabs-item {
  11 + font-family: PingFang-SC-Medium;
  12 + font-size: 32px;
  13 + color: #999;
  14 + letter-spacing: 0;
  15 + text-align: center;
  16 + line-height: 96px;
  17 + display: inline-block;
  18 + padding: 0 20px;
  19 +
  20 + &.actived {
  21 + font-size: 40px;
  22 + color: #000;
  23 + box-sizing: border-box;
  24 + border-bottom: 6px solid #000;
  25 + }
  26 + }
  27 +}
1 -import jumpToMiniapp from './jump-to-miniapp';  
2 -import rules from './rules';  
3 -import Taro from '@tarojs/taro';  
4 -import {stringify} from 'query-string';  
5 -  
6 -let pageNameMap = {};  
7 -  
8 -for (let i in rules) {  
9 - if (rules.hasOwnProperty(i) && rules[i].path) {  
10 - pageNameMap[rules[i].path] = i;  
11 - }  
12 -}  
13 -  
14 -export default {  
15 - // go(name, qs, type) {  
16 - // qs = qs || {};  
17 -  
18 - // const rule = rules[name];  
19 -  
20 - // if (!rule) {  
21 - // return Promise.reject(`router rules mismatch : ${name}`);  
22 - // }  
23 -  
24 - // // 添加yas上报【fromPage】参数  
25 - // let pages = Taro.getCurrentPages();  
26 - // let currentPage = pages[pages.length - 1];  
27 - // let path = `/${currentPage.route}`;  
28 - // let options = currentPage.options;  
29 -  
30 - // if (pageNameMap[path]) {  
31 - // qs.fromPage = pageNameMap[path];  
32 - // qs.fromParam = stringify(options);  
33 - // }  
34 -  
35 - // // 跳转类型  
36 - // const jumpFn = jump[type] || rule.type || jump.navigateTo;  
37 -  
38 - // return jumpFn(rule.path, qs);  
39 - // },  
40 - goUrl(url) {  
41 - if (!url) {  
42 - return Promise.reject('error url');  
43 - }  
44 -  
45 - const [uri, search] = url.split('?');  
46 - const path = uri.split(MINI_APP_DOMAIN)[1];  
47 - const qs = parse(search);  
48 -  
49 - if (qs.app && path) {  
50 - return jumpToMiniapp({  
51 - app: qs.app,  
52 - path: `${path}?${stringify(qs)}`  
53 - });  
54 - }  
55 - }  
56 -}  
1 -import Taro from '@tarojs/taro';  
2 -import {stringify} from 'query-string';  
3 -  
4 -const appData = {  
5 - yohobuyLimitChannel: {  
6 - appId: 'wxed31f9e8705fb8d1',  
7 - page: {  
8 - limitProductList: 'pages/index/index'  
9 - }  
10 - },  
11 - anotherApp: {  
12 - appId: 'wx084ab813d88c594b',  
13 - page: {  
14 - home: '/pages/product/detail/detail'  
15 - }  
16 - },  
17 -};  
18 -  
19 -export default function(params) {  
20 - let navigateToMiniParams = {  
21 - appId: appData[params.app].appId,  
22 - path: params.path || `${appData[params.app].page[params.page]}?${stringify(params.data)}`  
23 - };  
24 -  
25 - return Taro.navigateToMiniProgram(navigateToMiniParams);  
26 -}  
1 -import Taro from '@tarojs/taro';  
2 -import {stringify} from 'query-string';  
3 -  
4 -export default {  
5 - navigateTo(path, qs) {  
6 - return Taro.navigateTo({url: `${path}?${stringify(qs)}`});  
7 - },  
8 - redirectTo(path, qs) {  
9 - return Taro.redirectTo({url: `${path}?${stringify(qs)}`});  
10 - },  
11 - switchTab(path) {  
12 - return Taro.switchTab({url: path});  
13 - }  
14 -};  
1 -export default {  
2 - index: {path: '/pages/index/index'},  
3 - search: {path: '/pages/search/index'},  
4 -}  
1 -import {stringify} from 'query-string';  
2 -import router from '../router/index';  
3 -  
4 -const GO_LIST = 'go.list';  
5 -const GO_PRODUCTPOOL = 'go.poollist';  
6 -const GO_SHOP = 'go.shop';  
7 -const GO_BRAND = 'go.brand';  
8 -const GO_CATEGORY = 'go.category';  
9 -const GO_DETAIL = 'go.productDetail';  
10 -const GO_COUPON = 'go.coupon';  
11 -const GO_MINE = 'go.mine';  
12 -const GO_NEW = 'go.new';  
13 -const GO_SHOPCART = 'go.shopcart';  
14 -const GO_H5 = 'go.h5';  
15 -const GO_ACTIVITY = 'go.activitytemplate';  
16 -const GO_MINIAPP = 'go.miniapp';  
17 -const GO_ZEROSELL = 'go.zerosell';  
18 -const GO_COLLAGEHOME = 'go.collagehome';//拼团购首页  
19 -  
20 -const MINI_APP_DOMAIN = 'miniapp.yohobuy.com';  
21 -  
22 -  
23 -  
24 -export default {  
25 - jumpByUrl(jumpUrl, pageName) {  
26 - if (!jumpUrl) {  
27 - return;  
28 - }  
29 -  
30 - // 跳小程序  
31 - if (jumpUrl.indexOf(MINI_APP_DOMAIN)>=0) {  
32 - router.goUrl(jumpUrl);  
33 - return;  
34 - }  
35 -  
36 - let url = "";  
37 - let startIndex = jumpUrl.indexOf('openby:yohobuy=');  
38 - if (startIndex < 0) {  
39 - return;  
40 - }  
41 -  
42 - let jsonRule = jumpUrl.substring(startIndex + 'openby:yohobuy='.length);  
43 - let json = JSON.parse(jsonRule);  
44 - let action = json.action;  
45 -  
46 - let path = '';  
47 -  
48 - if (GO_LIST === action) {  
49 - let actionType = json.params.actiontype;  
50 - if (1 == actionType) {  
51 - path = "../goodsList/goodsList";  
52 - } else if (2 == actionType) {  
53 - path = "../goodsList/activtyDetail";  
54 - }  
55 - } else if (GO_BRAND === action) {  
56 - path = "../goodsList/brand";  
57 - } else if (GO_PRODUCTPOOL === action) {  
58 - path = "../goodsList/productPool";  
59 - } else if (GO_SHOP === action) {  
60 - path = "../goodsList/brandStore";  
61 - } else if (GO_DETAIL === action) {  
62 - let actionType = '';  
63 - if (json.params && json.params.activity_type){  
64 - actionType = json.params.activity_type;  
65 - }  
66 - if (actionType && actionType == 'groupPurchase'){  
67 - path = "/pages/groupPurchase/groupPurchaseDetail"  
68 - }else{  
69 - path = "../goodsDetail/goodsDetail";  
70 - }  
71 - } else if (GO_COUPON === action) {  
72 - path = "../page/subPackage/pages/couponList/couponList";  
73 - }else if (GO_NEW === action) {  
74 - path = "../goodsList/newArrival";  
75 - } else if (GO_ZEROSELL == action) {  
76 - path = "/page/subPackage/pages/zeroSell/index";  
77 - } else if (GO_SHOPCART === action) {  
78 - Taro.switchTab({  
79 - url: "/pages/shopCart/shopCart"  
80 - })  
81 - return;  
82 - }else if (GO_CATEGORY === action) {  
83 - Taro.switchTab({  
84 - url: "/pages/classify/category"  
85 - })  
86 - return;  
87 - }else if (GO_MINE === action) {  
88 - Taro.switchTab({  
89 - url: "/pages/userCenter/userCenter"  
90 - })  
91 - return;  
92 - } else if (GO_H5 === action) {  
93 - path = "/pages/webview/webview";  
94 - } else if (GO_ACTIVITY === action) {  
95 - let actionType;  
96 - if (json.params && json.params.type){  
97 - actionType = json.params.type;  
98 - }  
99 - if (actionType == 2) {  
100 - path = "../groupPurchase/groupPurchase";  
101 - } else if (actionType == 3) {  
102 - path = "../assist/assist";  
103 - }  
104 - }else if (GO_MINIAPP === action){  
105 - //跳转到小程序必须有appid和path  
106 - if(!json.params||!json.params.appId||!json.params.path ||json.params.appId.length===0 ||json.params.path.length===0){return}  
107 - let app_id = json.params.appId;  
108 - let target_path = json.params.path;  
109 - //如果appid的值为miniapp则表示要跳转到当前小程序中给定的path界面  
110 - if (app_id && 'miniapp' == app_id && target_path){  
111 - if (target_path.indexOf(0) != '/'){  
112 - target_path = '/' + target_path;  
113 - }  
114 - Taro.navigateTo({  
115 - url: target_path,  
116 - })  
117 - return;  
118 - }  
119 - let navigateToMiniParams = {  
120 - appId: json.params.appId,  
121 - path: json.params.path  
122 - };  
123 - Taro.navigateToMiniProgram(navigateToMiniParams);  
124 - return  
125 - } else if (GO_COLLAGEHOME == action){  
126 - path = "/pages/groupPurchase/groupPurchaseHome"  
127 - }  
128 -  
129 - let params = stringify(json.params, false);  
130 - console.log(path)  
131 - url = path + "?page_name=" + pageName + "&" + params;  
132 - console.log(url)  
133 - if (!path) {  
134 - return;  
135 - }  
136 -  
137 -  
138 - if (url) {  
139 - Taro.navigateTo({  
140 - url: url,  
141 - })  
142 - }  
143 - }  
144 -}