积分列表,充值列表

This commit is contained in:
chenhui0212
2019-02-28 19:16:13 +08:00
36 changed files with 407 additions and 328 deletions

4
.idea/encodings.xml generated
View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

6
.idea/misc.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="JSX" />
</component>
</project>

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/espier-taro-fenxiao.iml" filepath="$PROJECT_DIR$/.idea/espier-taro-fenxiao.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

186
.idea/workspace.xml generated
View File

@@ -2,10 +2,42 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="c4b5bd0d-fb3c-48cd-90a1-e84add737e52" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/components/filter-bar/index.js" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/components/filter-bar/index.scss" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/pages/home/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/encodings.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/espier-taro-fenxiao.iml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/member/integral.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/member/integral.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/member/integral.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/member/integral.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/config/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/config/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package-lock.json" beforeDir="false" afterPath="$PROJECT_DIR$/package-lock.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/api/item.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/item.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/api/req.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/req.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/address/picker.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/address/picker.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/goods-buy-panel/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/goods-buy-panel/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/goods-item/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/goods-item/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/goods-item/index.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/goods-item/index.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/loading/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/loading/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/price/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/price/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/price/price.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/price/price.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/components/timer/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/timer/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/index/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/index/index.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/item/comps/item.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/item/comps/item.scss" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/item/detail.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/item/detail.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/item/list.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/item/list.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/item/list.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/item/list.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/trade/comps/item.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/trade/comps/item.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/trade/comps/order-item.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/trade/comps/order-item.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/trade/comps/order-item.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/trade/comps/order-item.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/pages/trade/list.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/trade/list.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/style/_mixins.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/style/_mixins.scss" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/utils/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/index.js" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/dist/" />
<ignored path="$PROJECT_DIR$/.tmp/" />
@@ -23,7 +55,7 @@
<entry file="file://$PROJECT_DIR$/src/components/note/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="35" column="1" lean-forward="true" selection-start-line="35" selection-start-column="1" selection-end-line="35" selection-end-column="1" />
<caret line="35" column="1" selection-start-line="35" selection-start-column="1" selection-end-line="35" selection-end-column="1" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
@@ -51,8 +83,8 @@
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/pages/member/integral.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="528">
<caret line="157" column="41" selection-start-line="157" selection-start-column="41" selection-end-line="157" selection-end-column="41" />
<state relative-caret-position="234">
<caret line="92" column="49" lean-forward="true" selection-start-line="92" selection-start-column="49" selection-end-line="92" selection-end-column="49" />
<folding>
<element signature="e#1#47#0" expanded="true" />
</folding>
@@ -64,7 +96,7 @@
<entry file="file://$PROJECT_DIR$/src/pages/category/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-357">
<caret line="32" column="6" lean-forward="true" selection-start-line="32" selection-start-column="6" selection-end-line="32" selection-end-column="6" />
<caret line="32" column="6" selection-start-line="32" selection-start-column="6" selection-end-line="32" selection-end-column="6" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
@@ -163,132 +195,20 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="645" />
<option name="y" value="87" />
<option name="x" value="280" />
<option name="y" value="118" />
<option name="width" value="1400" />
<option name="height" value="937" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator proportions="" version="1">
<showMembers ProjectPane="false" />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="api" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="assets" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="assets" type="462c0819:PsiDirectoryNode" />
<item name="fonts" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="components" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="components" type="462c0819:PsiDirectoryNode" />
<item name="address" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="components" type="462c0819:PsiDirectoryNode" />
<item name="icon-menu" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="components" type="462c0819:PsiDirectoryNode" />
<item name="note" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="hocs" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="auth" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="category" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="index" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="member" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="pages" type="462c0819:PsiDirectoryNode" />
<item name="trade" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="espier-taro-fenxiao" type="b2602c69:ProjectViewProjectNode" />
<item name="espier-taro-fenxiao" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="style" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
<pane id="ProjectPane" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -326,19 +246,19 @@
<updated>1551168703692</updated>
<workItem from="1551168706548" duration="6029000" />
<workItem from="1551178435380" duration="33108000" />
<workItem from="1551332673381" duration="15217000" />
<workItem from="1551332673381" duration="15434000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="54354000" />
<option name="totallyTimeSpent" value="54571000" />
</component>
<component name="ToolWindowManager">
<frame x="645" y="87" width="1400" height="937" extended-state="0" />
<frame x="280" y="118" width="1400" height="937" extended-state="0" />
<editor active="true" />
<layout>
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.13560551" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info active="true" content_ui="combo" id="Project" order="0" sideWeight="0.49940827" visible="true" weight="0.13560551" />
<window_info id="Structure" order="1" sideWeight="0.5005917" side_tool="true" weight="0.13560551" />
<window_info id="npm" order="2" side_tool="true" />
<window_info id="Favorites" order="3" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
@@ -677,7 +597,7 @@
<entry file="file://$PROJECT_DIR$/src/components/note/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="525">
<caret line="35" column="1" lean-forward="true" selection-start-line="35" selection-start-column="1" selection-end-line="35" selection-end-column="1" />
<caret line="35" column="1" selection-start-line="35" selection-start-column="1" selection-end-line="35" selection-end-column="1" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
@@ -707,7 +627,7 @@
<entry file="file://$PROJECT_DIR$/src/pages/category/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-357">
<caret line="32" column="6" lean-forward="true" selection-start-line="32" selection-start-column="6" selection-end-line="32" selection-end-column="6" />
<caret line="32" column="6" selection-start-line="32" selection-start-column="6" selection-end-line="32" selection-end-column="6" />
<folding>
<element signature="e#0#46#0" expanded="true" />
</folding>
@@ -716,8 +636,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/pages/member/integral.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="528">
<caret line="157" column="41" selection-start-line="157" selection-start-column="41" selection-end-line="157" selection-end-column="41" />
<state relative-caret-position="234">
<caret line="92" column="49" lean-forward="true" selection-start-line="92" selection-start-column="49" selection-end-line="92" selection-end-column="49" />
<folding>
<element signature="e#1#47#0" expanded="true" />
</folding>

View File

@@ -35,8 +35,7 @@ const config = {
})
},
alias: {
'@': path.join(__dirname, '..', '/src'),
'lodash$': 'lodash-es'
'@': path.join(__dirname, '..', '/src')
},
copy: {
patterns: [

7
package-lock.json generated
View File

@@ -6258,14 +6258,9 @@
},
"lodash": {
"version": "4.17.11",
"resolved": "https://r.cnpmjs.org/lodash/download/lodash-4.17.11.tgz",
"resolved": "http://registry.npm.taobao.org/lodash/download/lodash-4.17.11.tgz",
"integrity": "sha1-s56mIp72B+zYniyN8SU2iRysm40="
},
"lodash-es": {
"version": "4.17.11",
"resolved": "https://r.cnpmjs.org/lodash-es/download/lodash-es-4.17.11.tgz",
"integrity": "sha1-FFq0p6xcXlKjUx+08xAlWhUrS+A="
},
"lodash._baseassign": {
"version": "3.2.0",
"resolved": "https://r.cnpmjs.org/lodash._baseassign/download/lodash._baseassign-3.2.0.tgz",

View File

@@ -35,7 +35,7 @@
"axios": "^0.18.0",
"classnames": "^2.2.6",
"copy-to-clipboard": "^3.0.8",
"lodash-es": "^4.17.11",
"lodash": "^4.17.11",
"memoize-one": "^5.0.0",
"moment": "^2.24.0",
"nerv-devtools": "^1.3.9",

View File

@@ -1,7 +1,7 @@
import req from './req'
export function search (params = {}) {
return req.get('/item.search', params)
return req.get('http://pjj.aixue7.com/index.php/api/wxapp/goods/items', params)
}
export function detail (item_id) {

View File

@@ -30,7 +30,8 @@ class API {
makeReq (config) {
const { url, data, header = {}, method = 'GET', showLoading, showError = true } = config
const methodIsGet = method.toLowerCase() === 'get'
let reqUrl = `${this.baseURL}${url.replace(/^\//, '')}`
let reqUrl = /^http/.test(url) ? url : `${this.baseURL}${url.replace(/^\//, '')}`
const query = (!data || typeof data === 'string')
? data
: qs.stringify(data)
@@ -69,7 +70,7 @@ class API {
}
if (statusCode >= 200 && statusCode < 300) {
if (data.code === '200') {
if (data.data !== undefined) {
return data.data
} else {
const errMsg = data.msg || data.err_msg || '操作失败,请稍后重试'

View File

@@ -4,7 +4,7 @@ import { AtNavBar } from 'taro-ui'
import { SpCell, SpToast, Note } from '@/components'
import { classNames, log } from '@/utils'
import api from '@/api'
import { find } from 'lodash'
import find from 'lodash/find'
import AddressEdit from './edit'

View File

@@ -0,0 +1,71 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import { classNames } from '@/utils'
import './index.scss'
export default class FilterBar extends Component {
static options = {
addGlobalClass: true
}
static defaultProps = {
sort: {},
current: 0,
list: []
}
constructor (props) {
super(props)
const { current } = props
this.state = {
curIdx: current,
sortOrder: null
}
}
handleClickItem (idx) {
const item = this.props.list[idx]
let sortOrder = null
if (item.sort) {
sortOrder = idx === this.state.curIdx ? this.state.sortOrder * -1 : item.sort
}
this.setState({
curIdx: idx,
sortOrder
})
this.props.onChange({
current: idx,
sort: sortOrder
})
}
render () {
const { list, className } = this.props
const { sortOrder, curIdx } = this.state
return (
<View className={classNames('filter-bar', className)}>
{
list.map((item, idx) => {
const isCurrent = curIdx === idx
return (
<View
className={classNames('filter-bar__item', isCurrent && 'filter-bar__item-active', item.key && `filter-bar__item-${item.key}`, item.sort ? `filter-bar__item-sort filter-bar__item-sort-${sortOrder > 0 ? 'asc' : 'desc'}` : null)}
onClick={this.handleClickItem.bind(this, idx)}
key={idx}
>
<Text className='filter-bar__item-text'>{item.title}</Text>
</View>
)
})
}
</View>
)
}
}

View File

@@ -0,0 +1,76 @@
@import "../../style/imports";
.filter-bar {
$self: &;
background: #fff;
height: $tabbar-height;
display: flex;
align-items: center;
justify-content: center;
align-content: center;
&__item {
flex: 1;
text-align: center;
position: relative;
&:after {
background: $color-link;
content: '';
display: block;
opacity: 0;
position: absolute;
height: 4px;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 20%;
transition: all .15s ease-in;
}
&-text {
position: relative;
display: block;
height: $tabbar-height;
line-height: $tabbar-height;
}
&-sort {
.filter-bar__item-text {
&:before, &:after {
@include arrow(6px);
position: absolute;
right: 20px;
top: 50%;
}
&:before {
// up
transform: translateY(-100%) rotate(-135deg);
}
&:after {
// down
transform: translateY(20%) rotate(45deg);
}
}
}
&-active {
color: $color-link;
&:after {
opacity: 1;
width: 90%;
}
&#{$self}__item-sort {
&-asc {
.filter-bar__item-text {
&:before {
border-color: $color-link;
}
}
}
&-desc {
.filter-bar__item-text {
&:after {
border-color: $color-link;
}
}
}
}
}
}
}

View File

@@ -1,7 +1,7 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, Button, ScrollView } from '@tarojs/components'
import { AtInputNumber } from 'taro-ui'
import { find } from 'lodash'
import find from 'lodash/find'
import { Price } from '@/components'
import { classNames } from '@/utils'

View File

@@ -20,8 +20,8 @@ export default class GoodsItem extends Component {
return null
}
const img = info.img || info.image_default_id
const price = isObject(info.price) ? info.price.total_price : info.price
const img = info.img || info.image_default_id
return (
<View className='goods-item'>
@@ -29,19 +29,27 @@ export default class GoodsItem extends Component {
{this.props.children}
</View>
<View className='goods-item__bd'>
<Image className='goods-item__img'
onClick={onClickImg}
mode='aspectFill'
src={img}
/>
<View className='goods-item__img-wrap'>
<Image className='goods-item__img'
onClick={onClickImg}
mode='aspectFill'
src={img}
/>
</View>
<View className='goods-item__cont'>
<Text className='goods-item__title'>{info.title}</Text>
<Text className='goods-item__desc'>{info.desc}</Text>
<View className='goods-item__prices'>
<Price
primary
symbol={info.curSymbol}
value={price}
/>
<Price
symbol={info.curSymbol}
className='goods-item__price-market'
value={info.market_price}
/>
</View>
</View>
</View>

View File

@@ -1,5 +1,7 @@
@import '../../style/imports';
$item-img-size: 180px !default;
.goods-item {
display: flex;
align-items: center;
@@ -19,12 +21,18 @@
justify-content: space-between;
}
&__img {
width: 180px;
height: 180px;
margin-right: $edge-size;
width: $item-img-size;
height: $item-img-size;
&-wrap {
width: $item-img-size;
height: $item-img-size;
display: block;
text-align: center;
margin-right: $edge-size;
}
}
&__title {
@include mult-ellipsis(2);
@include multi-ellipsis(2);
line-height: 1.4;
color: #111;
margin: 0 0 16px;
@@ -32,7 +40,19 @@
&__desc {
color: $color-gray;
font-size: $font-size-small;
@include multi-ellipsis(2);
}
&__prices {
}
.price {
&__primary {
font-size: floor(1.28 * $font-size);
}
margin-right: 24px;
}
.goods-item__price-market {
font-size: $font-size-small;
color: $color-gray;
text-decoration: line-through;
}
}

View File

@@ -7,6 +7,7 @@ export { default as GoodsBuyPanel } from './goods-buy-panel'
export { default as GoodsItem } from './goods-item'
export { default as AddressPicker } from './address/picker'
export { default as TabBar } from './tab-bar'
export { default as FilterBar } from './filter-bar'
export { default as SearchPanel } from './search'
export { default as Timer } from './timer'

View File

@@ -1,5 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Image, Text } from '@tarojs/components'
import { classNames } from '@/utils'
import loadingImg from './loading.gif'
import './index.scss'
@@ -9,10 +10,11 @@ export default class Loading extends Component {
}
render () {
const { className } = this.props
return (
<View className='loading'>
<View className={classNames('loading', className)}>
<Image src={loadingImg} className='loading-img' />
<Text clasName='loading-text'>{this.props.children}</Text>
<Text className='loading-text'>{this.props.children}</Text>
</View>
)
}

View File

@@ -6,7 +6,11 @@ import './price.scss'
export default class Price extends Component {
static options = {
addGlobalClass: true
addGlobalClass: true,
className: null,
value: null,
primary: false,
noSymbol: false
}
static externalClasses = ['classes']

View File

@@ -1,7 +1,6 @@
@import '../../style/imports';
.price {
font-weight: bold;
&__primary {
color: $color-brand-primary;
}

View File

@@ -10,7 +10,7 @@ export default class Timer extends Component {
}
static defaultProps = {
duration: 10,
duration: 60,
defaultMsg: '发送验证码',
msg: '重新发送'
}

10
src/pages/home/index.js Normal file
View File

@@ -0,0 +1,10 @@
import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
export default class HomeIndex extends Component {
render () {
return (
<View></View>
)
}
}

View File

@@ -1,7 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text } from '@tarojs/components'
import './index.scss'
import S from '@/spx'
export default class Index extends Component {
config = {
@@ -11,7 +10,7 @@ export default class Index extends Component {
componentWillMount () {
if (process.env.NODE_ENV === 'development') {
Taro.redirectTo({
url: '/pages/member/integral'
url: '/pages/item/list?cateId=20'
})
}
}

View File

@@ -1,43 +0,0 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
import { Price } from '@/components'
import './item.scss'
export default class Item extends Component {
static options = {
addGlobalClass: true
}
render () {
const { info, onClick } = this.props
return (
<View className='goods-item' onClick={onClick}>
<View className='goods-item__hd'>
<Image
className='goods-item__img'
mode='aspectFit'
src={info.image_default_id}
/>
</View>
<View className='goods-item__bd'>
<Text className='goods-item__title'>{info.title}</Text>
<View className='goods-item__extra'>
<Text className='goods-item__sold'>{info.sold_quantity} 人已购买</Text>
</View>
<View className='goods-item__prices'>
<Price
value={info.price}
primary
/>
<Price
classes='goods-item__price-market'
value={info.price}
/>
</View>
</View>
</View>
)
}
}

View File

@@ -1,49 +0,0 @@
@import "../../../style/imports";
$img-size: 240px;
.goods-item {
background: #fff;
display: flex;
border-radius: 20px;
overflow: hidden;
margin: 0 0 $edge-size;
height: $img-size;
&__hd {
}
&__bd {
flex: 1;
padding: 24px;
display: flex;
flex-direction: column;
}
&__img {
width: $img-size;
height: $img-size;
display: block;
}
&__title {
color: #111;
line-height: 1.4;
@include mult-ellipsis(2);
margin: 0 0 10px;
}
&__extra {
color: #888;
font-size: $font-size-small;
flex: 1;
}
&__prices {
font-size: $font-size-large;
line-height: 1;
display: flex;
align-items: flex-end;
}
&__price-market {
font-size: $font-size-small;
color: $color-gray;
text-decoration: line-through;
font-weight: normal;
margin-left: 12px;
}
}

View File

@@ -58,7 +58,7 @@
font-weight: bold;
font-size: $font-size-large;
color: #000;
@include mult-ellipsis(2);
@include multi-ellipsis(2);
line-height: 1.2;
&__wrap {
display: flex;

View File

@@ -1,9 +1,9 @@
import Taro, { Component } from '@tarojs/taro'
import { View, ScrollView } from '@tarojs/components'
import api from '@/api'
import { withPager, withBackToTop } from '@/hocs'
import { BackToTop, Loading } from '@/components'
import GoodsItem from './comps/item'
import { BackToTop, Loading, FilterBar, GoodsItem } from '@/components'
import api from '@/api'
import { pickBy } from '@/utils'
import './list.scss'
@@ -15,24 +15,89 @@ export default class List extends Component {
this.state = {
...this.state,
curFilterIdx: 0,
filterList: [
{ title: '综合' },
{ title: '销量' },
{ title: '价格', sort: -1 }
],
query: null,
list: []
}
}
componentDidMount () {
this.nextPage()
this.setState({
query: {
keywords: '',
distributor_id: 16,
item_type: 'normal',
approve_status: 'onsale,only_show',
category: this.$router.params.cateId
}
}, () => {
this.nextPage()
})
}
async fetch (params) {
const { list, total_count: total } = await api.item.search(params)
const nList = this.state.list.concat(list)
this.setState({ list: nList })
const { page_no: page, page_size: pageSize } = params
const query = {
...this.state.query,
page,
pageSize
}
const { list, total_count: total } = await api.item.search(query)
const nList = pickBy(list, {
img: 'pics[0]',
item_id: 'item_id',
title: 'itemName',
desc: 'brief',
price: ({ price }) => (price/100).toFixed(2),
market_price: ({ market_price }) => (market_price/100).toFixed(2)
})
console.log(nList)
this.setState({
list: [...this.state.list, ...nList],
query
})
return {
total
}
}
handleFilterChange = (data) => {
const { current, sort } = data
const query = {
...this.state.query,
goodsSort: current === 0
? null
: current === 1
? 1
: (sort > 0 ? 3 : 2)
}
if (current !== this.state.curFilterIdx || (current === this.state.curFilterIdx && query.goodsSort !== this.state.query.goodsSort)) {
this.resetPage()
this.setState({
list: []
})
}
this.setState({
curFilterIdx: current,
query
}, () => {
this.nextPage()
})
}
handleClickItem = (item) => {
const url = `/pages/item/detail?id=${item.item_id}`
Taro.navigateTo({
@@ -41,12 +106,19 @@ export default class List extends Component {
}
render () {
const { list, showBackToTop, scrollTop, page } = this.state
const { list, curFilterIdx, filterList, showBackToTop, scrollTop, page } = this.state
return (
<View className='page-goods-list'>
<FilterBar
className='goods-list__tabs'
current={curFilterIdx}
list={filterList}
onChange={this.handleFilterChange}
/>
<ScrollView
className='goods-list'
className='goods-list__scroll'
scrollY
scrollTop={scrollTop}
scrollWithAnimation
@@ -70,6 +142,7 @@ export default class List extends Component {
: null
}
</ScrollView>
<BackToTop
show={showBackToTop}
onClick={this.scrollBackToTop}

View File

@@ -2,7 +2,18 @@
.page-goods-list {
.goods-list {
height: 100vh;
&__tabs {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: $z-index-toolbar;
}
&__scroll {
height: 100vh;
box-sizing: border-box;
padding: $tabbar-height 0 $edge-margin/2;
}
}
.goods-item {
margin: $edge-size;

View File

@@ -2,7 +2,7 @@ import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components'
import { AtButton } from 'taro-ui'
import { Price } from '@/components'
import { OrderItem } from './order-item'
import OrderItem from './order-item'
import './item.scss'

View File

@@ -30,7 +30,7 @@ export default class OrderItem extends Component {
</View>
<View className='order-item__ft'>
<Price className='order-item__price' value={info.price}></Price>
<Text className="order-item__num">x {info.num}</Text>
<Text className='order-item__num'>x {info.num}</Text>
</View>
</View>
)

View File

@@ -21,7 +21,7 @@
}
&__title {
font-size: floor(0.95 * $font-size);
@include mult-ellipsis(2);
@include multi-ellipsis(2);
line-height: 1.4;
margin: 0 0 4px;
}

View File

@@ -4,7 +4,7 @@ import { AtTabs, AtTabsPane } from 'taro-ui'
import { Loading, SpNote } from '@/components'
import api from '@/api'
import { withPager } from '@/hocs'
import { TradeItem } from './comps/item'
import TradeItem from './comps/item'
import './list.scss'
@@ -23,8 +23,7 @@ export default class TradeList extends Component {
{title: '待收货', status: 'WAIT_BUYER_CONFIRM_GOODS'},
{title: '待评价', status: 'WAIT_RATE'}
],
list: [],
isLoading: false
list: []
}
}
@@ -44,7 +43,6 @@ export default class TradeList extends Component {
}
async fetch (params) {
this.setState({ isLoading: true })
const { tabList, curTabIdx } = this.state
params = {
...params,
@@ -54,15 +52,14 @@ export default class TradeList extends Component {
const nList = this.state.list.concat(list)
this.setState({
list: nList,
isLoading: false
list: nList
})
return { total }
}
handleClickTab = (idx) => {
if (this.state.isLoading || this.state.page.isLoading) return
if (this.state.page.isLoading) return
if (idx !== this.state.curTabIdx) {
this.resetPage()

View File

@@ -11,17 +11,18 @@
overflow: hidden;
}
@mixin mult-ellipsis($line) {
@mixin multi-ellipsis($line) {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: $line;
/* autoprefixer: ignore next */
-webkit-box-orient: vertical;
}
@mixin arrow ($size:4px) {
content: "";
border: $size / 2 solid $color-border-gray;
@mixin arrow ($size:4px, $color: $color-border-gray) {
content: '';
border: $size solid $color;
display: block;
width: $size;
height: $size;

View File

@@ -5,8 +5,8 @@ import qs from 'qs'
import moment from 'moment'
import copy from 'copy-to-clipboard'
import S from '@/spx'
export { default as log } from './log'
import _get from 'lodash/get'
import log from './log'
const isPrimitiveType = (val, type) => Object.prototype.toString.call(val) === type
@@ -57,6 +57,28 @@ export function normalizeQuerys (params = {}) {
return ret
}
export function pickBy (arr, keyMaps = {}) {
const picker = (item) => {
const ret = {}
Object.keys(keyMaps).forEach(key => {
const val = keyMaps[key]
if (isString(val)) {
ret[key] = _get(item, val)
} else if (isFunction(val)) {
ret[key] = val(item)
} else {
ret[key] = val
}
})
return ret
}
return arr.map(picker)
}
export function resolvePath (baseUrl, params = {}) {
const queryStr = typeof params === 'string'
? params
@@ -74,12 +96,15 @@ export function copyText (text, msg = '内容已复制') {
if (process.env.TARO_ENV === 'weapp') {
Taro.setClipboardData({
data: text,
success: resolve
success: resolve,
error: reject
})
} else {
if (copy(Text)) {
S.toast(msg)
resolve(text)
} else {
reject()
}
}
})
@@ -87,5 +112,6 @@ export function copyText (text, msg = '内容已复制') {
export {
classNames,
styleNames
styleNames,
log
}