Commit 9d80fcc6 authored by June's avatar June

feat:登录,首页,分类

parent e603d9c2
...@@ -6,11 +6,11 @@ import { login_wx } from '@/utils/modules/login.js' ...@@ -6,11 +6,11 @@ import { login_wx } from '@/utils/modules/login.js'
export default { export default {
onLaunch: function() { onLaunch: function() {
this.setSystemInfo() // 获取系统信息 this.setSystemInfo() // 获取系统信息
this.setLocation() // 获取经纬度
this.setMenuButtonInfo() // 获取胶囊信息 this.setMenuButtonInfo() // 获取胶囊信息
this.checkUpdate() // 检查更新 this.checkUpdate() // 检查更新
const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync(): {} const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync(): {}
console.log(extConfig)
this.$store.state.user.appid = extConfig.appid this.$store.state.user.appid = extConfig.appid
const token = this.$getStorage('token') const token = this.$getStorage('token')
this.$store.state.user.token = token this.$store.state.user.token = token
...@@ -29,7 +29,7 @@ export default { ...@@ -29,7 +29,7 @@ export default {
methods: { methods: {
...mapActions('systemInfo', ['setSystemInfo', 'setMenuButtonInfo']), ...mapActions('systemInfo', ['setSystemInfo', 'setMenuButtonInfo']),
...mapActions('user', ['setLocation', 'setToken', 'setLoginStatus', 'getStoreInfo']), ...mapActions('user', ['setToken', 'setLoginStatus', 'getStoreInfo']),
...mapActions('cart', ['setCount']), ...mapActions('cart', ['setCount']),
// 检查更新 // 检查更新
......
...@@ -26,3 +26,13 @@ export function cateGoodsList(cat_id, keywords = '') { ...@@ -26,3 +26,13 @@ export function cateGoodsList(cat_id, keywords = '') {
} }
}) })
} }
/**
* @desc 首页展示栏商品接口
*/
export function homeCategory() {
return request({
url: 'zsxcx/indexGoodsXcx.htm',
method: 'post'
})
}
\ No newline at end of file
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
calVal(newVal) { calVal(newVal) {
this.$emit('change', { this.$emit('change', {
index: this.index, index: this.index,
val: Number(newVal) val: ~~newVal
}) })
} }
}, },
......
/**
* unipopup 的ref必须为goods_popup
*/
export default {
data() {
return {
// 弹窗商品的信息
popGoodInfo: {1: 11}
}
},
mounted() {
console.log(this.module1)
},
methods: {
// 打开弹出
openPopup() {
this.$refs.goods_popup.open()
},
closePopup() {
this.$refs.goods_popup.close()
this.popGoodInfo = {} // 清空弹窗商品的信息
}
}
}
\ No newline at end of file
<template> <template>
<view class="category-wrap w-100"> <view class="category-wrap w-100">
<!-- search bar --> <!-- search bar -->
<view class="searchBar-wrap w-100">搜索框</view> <view class="searchBar-wrap flex j-center a-center w-100">
<view class="search flex j-center a-center">
<image class="search-icon mr-1" src="/static/images/common/icon-search.png" mode="aspectFit" />
<text class="font-24">搜索商品</text>
</view>
</view>
<!-- category 未优化,可以递归组件 --> <!-- category 未优化,可以递归组件 -->
<view class="category flex j-between w-100 font-24"> <view class="category flex j-between w-100 font-24">
...@@ -11,30 +16,32 @@ ...@@ -11,30 +16,32 @@
:scroll-into-view="leftScrollName" :scroll-into-view="leftScrollName"
> >
<view <view
class="flex j-center flex-column a-center p-2" class="w-100 px-3 py-2"
v-for="(cate_1, cate_idx_1) in cate_list" v-for="(cate_1, cate_idx_1) in cate_list"
:key="cate_1.cat_id" :key="cate_1.cat_id"
:class="cate1_current === cate_1.cat_id ? 'cate-active' : null"
> >
<view>
<view <view
class="mb-2"
@click.stop="cateChange(1, cate_1.cat_id)" @click.stop="cateChange(1, cate_1.cat_id)"
:class="cate1_current === cate_1.cat_id ? 'cate-active' : null" :class="cate1_current === cate_1.cat_id ? 'cate-1_active' : null"
>{{cate_1.cat_name}}</view> >{{cate_1.cat_name}}</view>
<view v-show="cate1_current === cate_1.cat_id && cate_1.list.length > 0"> <view v-show="cate1_current === cate_1.cat_id && cate_1.list.length > 0">
<view <view
class="ml-2" class="ml-2 mb-2"
v-for="(cate_2, cate_idx_2) in cate_1.list" v-for="(cate_2, cate_idx_2) in cate_1.list"
:key="cate_2.cat_id" :key="cate_2.cat_id"
> >
<view <view
:class="cate2_current === cate_2.cat_id ? 'cate-active' : null" :class="cate2_current === cate_2.cat_id ? 'cate-2_active' : null"
@click.stop="cateChange(2, cate_2.cat_id)" @click.stop="cateChange(2, cate_2.cat_id)"
>{{cate_2.cat_name}}</view> >{{cate_2.cat_name}}</view>
</view> </view>
</view> </view>
</view>
</view> </view>
</scroll-view> </scroll-view>
...@@ -46,20 +53,27 @@ ...@@ -46,20 +53,27 @@
@tolower='tolower' @tolower='tolower'
> >
<view <view
class="goods-item flex j-start a-center"
v-for="good in goods_list" v-for="good in goods_list"
:key="good.goods_id" :key="good.goods_id"
@click="navDetail(good)" @click="navDetail(good)"
> >
<image <image
style="width: 300rpx;height: 300rpx;" class="goods-cover mr-2"
lazy-load lazy-load
:src="baseUrl + '/' + good.goods_thumb" :src="baseUrl + '/' + good.goods_thumb"
mode="aspectFit" mode="aspectFit"
/> />
<view>{{good.goods_name}}</view> <view class="goods-price flex-1 flex flex-column j-between font-28">
<view class="title">{{good.goods_name}}</view>
<view class="w-100 flex j-between a-center">
<text class="price-txt">¥152.50</text>
<image class="cart-icon" src="/static/images/common/icon-cart.png" mode="aspectFit"></image>
</view>
</view>
</view> </view>
<view>到底了,看看别的分类吧~</view> <view class="empty-text text-center mt-4 p-2">到底了,看看别的分类吧~</view>
</pull-list> </pull-list>
</view> </view>
</view> </view>
...@@ -116,6 +130,7 @@ export default { ...@@ -116,6 +130,7 @@ export default {
cateChange(type ,cate_id) { cateChange(type ,cate_id) {
if(type === 1) { if(type === 1) {
this.cate1_current = cate_id this.cate1_current = cate_id
this.cate2_current = null
} else if(type === 2) { } else if(type === 2) {
this.cate2_current = cate_id this.cate2_current = cate_id
} }
...@@ -157,18 +172,71 @@ export default { ...@@ -157,18 +172,71 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.category-wrap { .category-wrap {
border-top: 1rpx solid $line;
.searchBar-wrap { .searchBar-wrap {
height: 10vh; height: 112rpx;
background-color: red; background-color: #fff;
.search {
width: 690rpx;
height: 72rpx;
border-radius: 4rpx;
background-color: $mainBg;
.search-icon {
width: 32rpx;
height: 32rpx;
}
}
} }
.category{ .category{
height: 90vh; height: calc(100vh - 112rpx);
background-color: $mainBg;
overflow: hidden; overflow: hidden;
.scroll-left { .scroll-left {
flex: 0 0 240rpx; flex: 0 0 180rpx;
overflow: hidden;
.cate-1_active {
color: $primary;
font-weight: bold;
}
.cate-2_active {
color: $primary;
}
.cate-active { .cate-active {
color: red; background-color: #fff;
}
}
.scroll-right {
background-color: #fff;
.empty-text {
font-size: 20rpx;
color: $desc;
}
.goods-item {
@include borderBox(20rpx, 20rpx);
border-bottom: 1rpx solid $line;
.goods-cover {
flex: 0 0 160rpx;
width: 160rpx;
height: 160rpx;
}
.goods-price {
height: 160rpx;
.title {
@include text-ellipsis(2);
color: #343434;
font-weight: 500;
}
.price-txt {
color: $primary;
}
.cart-icon {
width: 34rpx;
height: 32rpx;
}
}
} }
} }
} }
......
<template> <template>
<view class="back-wrap flex j-center a-center" :style="menuSty" @click="handleBack"> <view class="back-wrap flex j-start a-center" :style="menuSty" @click="handleBack">
返回 <!-- <image class="icon" src="/static/images/common/icon-back.png" mode="aspectFit"></image> -->
<icon class="icon ml-1"></icon>
</view> </view>
</template> </template>
...@@ -29,11 +30,13 @@ export default { ...@@ -29,11 +30,13 @@ export default {
} }
</script> </script>
<style scoped> <style lang="scss" scoped>
.back-wrap { .back-wrap {
position: fixed; position: fixed;
z-index: 999; z-index: 999;
border-radius: 50%; border-radius: 50%;
background-color: red; .icon {
@include backBtn(18rpx, 34rpx)
}
} }
</style> </style>
...@@ -10,18 +10,16 @@ ...@@ -10,18 +10,16 @@
> >
<image <image
class="goods_cover w-100" class="goods_cover w-100"
:src="arr[item]" :src="baseUrl + '/' + item.goods_thumb"
mode="aspectFit" mode="aspectFit"
/> />
<view class="goods-info flex flex-column j-between"> <view class="goods-info flex flex-column j-between">
<view class="title font-28 my-1"> <view class="title font-28 my-1">{{item.goods_name}}</view>
标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题标题
</view>
<view class="flex j-between a-center mt-1 mb-2"> <view class="flex j-between a-center mt-1 mb-2">
<view class="price font-28">价格</view> <view class="price font-28">{{item.shop_price}}</view>
<image <image
class="cart-btn" class="cart-btn"
src="../../../static/images/common/icon-cart.png" src="/static/images/common/icon-cart.png"
mode="aspectFit" mode="aspectFit"
/> />
</view> </view>
...@@ -32,7 +30,7 @@ ...@@ -32,7 +30,7 @@
</template> </template>
<script> <script>
import { baseUrl } from '@/config/index.js'
export default { export default {
props: { props: {
title: { title: {
...@@ -44,11 +42,13 @@ export default { ...@@ -44,11 +42,13 @@ export default {
default: () => [] default: () => []
} }
}, },
data() { data() {
return { return {
arr: ['https://www.gelifood.com/upload/wxxcx_img/images/icon/dalian.png', 'https://www.gelifood.com/upload/wxxcx_img/images/icon/bijie.png'] baseUrl
} }
}, },
methods: { methods: {
nav() { nav() {
uni.navigateTo({ uni.navigateTo({
......
import { searchGoods } from '@/apis/goods.js' import { searchGoods } from '@/apis/goods.js'
import { homeCategory } from '@/apis/category.js'
const searchParams = { const searchParams = {
sort: 1, // 1综合优先 2销量优先 3价格升序 4价格降序 sort: 1, // 1综合优先 2销量优先 3价格升序 4价格降序
...@@ -21,6 +22,19 @@ async function searchData () { ...@@ -21,6 +22,19 @@ async function searchData () {
} }
} }
async function getHomeCate() {
try{
const { status, data } = await homeCategory()
if(status) {
this.cate_data = data
}
}catch(e){
console.log(e)
//TODO handle the exception
}
}
export default { export default {
searchData searchData,
getHomeCate
} }
\ No newline at end of file
...@@ -2,14 +2,18 @@ ...@@ -2,14 +2,18 @@
<view> <view>
<!-- 店铺信息 --> <!-- 店铺信息 -->
<view class="storeInfo-wrap w-100 flex j-start a-center"> <view class="storeInfo-wrap w-100 flex j-start a-center">
<view class="logo">
<image <image
class="logo mr-2" v-if="storeInfo.shop_img"
class="img"
:src="baseUrl + '/' + storeInfo.shop_img" :src="baseUrl + '/' + storeInfo.shop_img"
mode="aspectFit" mode="aspectFit"
/> />
<view class="introduct flex-1"> </view>
<view class="shop-name mb-2">{{storeInfo.shop_name}}</view> <view class="introduct flex-1 ml-2">
<view class="intro-deatil font-24">简介: {{storeInfo.shop_intro}}</view> <view class="shop-name mb-2">{{storeInfo.shop_name || ''}}</view>
<view>{{appid || ""}}</view>
<view class="intro-deatil font-24">简介: {{storeInfo.shop_intro || ''}}</view>
</view> </view>
</view> </view>
...@@ -83,14 +87,31 @@ ...@@ -83,14 +87,31 @@
/> />
</block> </block>
<block v-else> <block v-else>
<goods-module title="新品推荐" :list="module1" @purchase="purchase" /> <template v-if="cate_data">
<goods-module
v-if="cate_data.xplist.length > 0"
title="新品推荐"
:list="cate_data.xplist"
@purchase="purchase"
/>
<goods-module title="新品推荐" :list="module1" @purchase="purchase" /> <goods-module
v-if="cate_data.cxlist.length > 0"
title="促销商品"
:list="cate_data.cxlist"
@purchase="purchase"
/>
<goods-module title="新品推荐" :list="module1" @purchase="purchase" /> <goods-module
v-if="cate_data.bklist.length > 0"
title="爆款商品"
:list="cate_data.bklist"
@purchase="purchase"
/>
</template>
<!-- 综合商品 --> <!-- 综合商品 -->
<template v-show="searchList.length > 0"> <template v-if="searchList.length > 0">
<view class="w-100"> <view class="w-100">
<view class="font-bold font-36 px-3 py-2">综合商品</view> <view class="font-bold font-36 px-3 py-2">综合商品</view>
<view class="list-wrap w-100 flex j-start a-center flex-wrap"> <view class="list-wrap w-100 flex j-start a-center flex-wrap">
...@@ -106,6 +127,7 @@ ...@@ -106,6 +127,7 @@
:url="'/pages/goods/detail?goods_id=' + good.goods_id" :url="'/pages/goods/detail?goods_id=' + good.goods_id"
> >
<image <image
lazy-load
class="goods_cover w-100" class="goods_cover w-100"
:src="baseUrl + '/' + good.goods_thumb" :src="baseUrl + '/' + good.goods_thumb"
mode="aspectFit" mode="aspectFit"
...@@ -145,7 +167,6 @@ import LoadMore from '@/utils/load-more.js' ...@@ -145,7 +167,6 @@ import LoadMore from '@/utils/load-more.js'
import { checkLogin } from '@/utils/modules/login.js' import { checkLogin } from '@/utils/modules/login.js'
import indexModule from './index.js' import indexModule from './index.js'
import { baseUrl } from '@/config/index.js' import { baseUrl } from '@/config/index.js'
import goods_popup from '@/mixins/goods_popup.js'
import { mapState, mapActions } from 'vuex' import { mapState, mapActions } from 'vuex'
export default { export default {
...@@ -154,12 +175,11 @@ export default { ...@@ -154,12 +175,11 @@ export default {
baseUrl, baseUrl,
module1: [2,1,1], module1: [2,1,1],
select_goods: null, select_goods: null,
cate_data: null,
searchList: [] searchList: []
} }
}, },
mixins: [goods_popup],
components: { components: {
searchBar, searchBar,
goodsModule, goodsModule,
...@@ -170,21 +190,25 @@ export default { ...@@ -170,21 +190,25 @@ export default {
...mapState({ ...mapState({
isOverdue: state => state.user.isOverdue, isOverdue: state => state.user.isOverdue,
token: state => state.user.token, token: state => state.user.token,
storeInfo: state => state.user.storeInfo storeInfo: state => state.user.storeInfo,
appid: state => state.user.appid
}) })
}, },
created() { created() {
// 实例化分页方法 // 实例化分页方法
this.loadmore = new LoadMore() this.loadmore = new LoadMore()
// 获取店铺信息 this.getHomeCate()
uni.setNavigationBarTitle({
title: '测试店铺'
})
}, },
mounted() { mounted() {
console.log(this.popGoodInfo) const storeInfo = this.storeInfo
if(storeInfo.shop_name) {
// 获取店铺信息
uni.setNavigationBarTitle({
title: storeInfo.shop_name
})
}
}, },
// 下拉刷新 // 下拉刷新
...@@ -225,9 +249,19 @@ export default { ...@@ -225,9 +249,19 @@ export default {
checkLogin(() => { checkLogin(() => {
switch(type) { switch(type) {
case 'contact': case 'contact':
const storeInfo = this.storeInfo
if(storeInfo && storeInfo.shop_tel) {
uni.showModal({ uni.showModal({
content: '' content: `是否拨打${storeInfo.shop_tel}`,
success: res => {
if(res.confirm) {
uni.makePhoneCall({
phoneNumber: storeInfo.shop_tel
}) })
}
}
})
}
break; break;
case 'collect': case 'collect':
uni.navigateTo({ uni.navigateTo({
...@@ -257,6 +291,11 @@ export default { ...@@ -257,6 +291,11 @@ export default {
width: 140rpx; width: 140rpx;
height: 140rpx; height: 140rpx;
border-radius: 8rpx; border-radius: 8rpx;
overflow: hidden;
.img {
width: 100%;
height: 100%;
}
} }
.introduct { .introduct {
height: 140rpx; height: 140rpx;
......
<template> <template>
<view class="wrapper"> <view class="wrap">
<view class="title font-36 font-bold ml-4">欢迎来到{{storeInfo.shop_name || '格利专属小程序'}}</view> <view class="title font-36 font-bold ml-4">欢迎来到{{storeInfo.shop_name || '格利专属小程序'}}</view>
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
v-model="form.yzm" v-model="form.yzm"
/> />
<view <view
class="sms-btn font-28 py-2" class="sms-btn font-28"
@click="handleSms" @click="handleSms"
:class="smsDisabled ? 'disabledSmsBtn' : null" :class="smsDisabled ? 'disabledSmsBtn' : null"
>{{smsMsg}}</view> >{{smsMsg}}</view>
...@@ -40,8 +40,16 @@ ...@@ -40,8 +40,16 @@
<view class="forget font-24 py-1" @click="handleForget">忘记密码</view> <view class="forget font-24 py-1" @click="handleForget">忘记密码</view>
</view> </view>
<view class="login-btn login-btn_active">短信验证码注册/登录</view> <view
<view class="login-btn">密码登录</view> class="login-btn"
:class="form.lgtype === 2 ? 'login-btn_active' : null"
@click="handleLogin(2)"
>短信验证码注册/登录</view>
<view
class="login-btn"
:class="form.lgtype === 3 ? 'login-btn_active' : null"
@click="handleLogin(3)"
>密码登录</view>
</view> </view>
...@@ -51,6 +59,7 @@ ...@@ -51,6 +59,7 @@
<image class="wx-login_icon mb-4" src="/static/images/common/icon_wx.png" mode="aspectFit" /> <image class="wx-login_icon mb-4" src="/static/images/common/icon_wx.png" mode="aspectFit" />
</label> </label>
<view class="agreement flex j-start a-center"> <view class="agreement flex j-start a-center">
<view class="p-1" @click="handleAgree">{{agree ? '同意' : 'no'}}</view>
<text class="mr-1">同意</text> <text class="mr-1">同意</text>
<navigator <navigator
class="agr_text" class="agr_text"
...@@ -66,39 +75,6 @@ ...@@ -66,39 +75,6 @@
open-type="getPhoneNumber" open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber" @getphonenumber="getPhoneNumber"
></button> ></button>
<!-- <view>
<input
:type="form.lgtype === 3 ? 'text' : 'number'"
:placeholder="userPlachelder"
v-model="form.user"
/>
</view>
<view v-show="form.lgtype === 2">
<input
type="text"
placeholder="请输入验证码"
v-model="form.yzm"
/>
<button @click="handleSms">{{smsMsg}}</button>
</view>
<view v-show="form.lgtype === 3">
<input
type="password"
placeholder="请输入密码"
v-model="form.pwd"
/>
</view>
<view>
<button :class="form.lgtype === 2 ? 'btn_active' : null" type="default" @click="handleLogin(2)">短信验证码注册登录</button>
<button :class="form.lgtype === 1 ? 'btn_active' : null" open-type="getPhoneNumber" @click="handleLogin(1)" @getphonenumber="getPhoneNumber">微信快捷登录</button>
<button :class="form.lgtype === 3 ? 'btn_active' : null" type="default" @click="handleLogin(3)">密码登录</button>
</view>
<button type="default" >忘记密码</button> -->
</view> </view>
</template> </template>
...@@ -112,12 +88,13 @@ import { mapState, mapActions } from 'vuex' ...@@ -112,12 +88,13 @@ import { mapState, mapActions } from 'vuex'
const userPlachelderStr = { const userPlachelderStr = {
1: '', 1: '',
2: '请输入手机号码', 2: '请输入手机号码',
3: '请输入用户名' 3: '请输入用户名或手机号码'
} }
export default { export default {
data() { data() {
return { return {
smsDisabled: false, // sms按钮是否禁用 smsDisabled: false, // sms按钮是否禁用
agree: false, // 同意平台协议
smsMsg: '获取验证码', smsMsg: '获取验证码',
form: { form: {
lgtype: 2, // 1微信登录 2短信验证码登录 3账号密码登录 lgtype: 2, // 1微信登录 2短信验证码登录 3账号密码登录
...@@ -142,7 +119,8 @@ export default { ...@@ -142,7 +119,8 @@ export default {
...mapActions('user', ['login']), ...mapActions('user', ['login']),
async handleLogin(type) { async handleLogin(type) {
if(type !== this.form.lgtype) return this.$set(this.form, 'lgtype', type) if(type !== this.form.lgtype) this.$set(this.form, 'lgtype', type)
if(!this.agree) return this.$toast({title: '请先同意平台协议'})
switch (type) { switch (type) {
case 2: case 2:
const smsValidaErr = this.smsValidate() const smsValidaErr = this.smsValidate()
...@@ -161,6 +139,7 @@ export default { ...@@ -161,6 +139,7 @@ export default {
getPhoneNumber (e) { getPhoneNumber (e) {
if(!this.agree) return this.$toast({title: '请先同意平台协议'})
if(e.detail.errMsg === 'getPhoneNumber:fail user deny') return if(e.detail.errMsg === 'getPhoneNumber:fail user deny') return
const { iv, encryptedData } = e.detail const { iv, encryptedData } = e.detail
this.loginCommon({ this.loginCommon({
...@@ -198,15 +177,22 @@ export default { ...@@ -198,15 +177,22 @@ export default {
uni.navigateTo({ uni.navigateTo({
url: `/subPages/resetPwd/index` url: `/subPages/resetPwd/index`
}) })
},
// 是否同意平台协议
handleAgree() {
this.agree = !this.agree
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.wrapper { .wrap {
background-color: #fff; background-color: #fff;
border-top: 1rpx solid $line; border-top: 1rpx solid $line;
height: 100vh;
overflow: hidden;
.title { .title {
padding-top: 80rpx; padding-top: 80rpx;
margin-bottom: 190rpx; margin-bottom: 190rpx;
...@@ -220,11 +206,12 @@ export default { ...@@ -220,11 +206,12 @@ export default {
border-bottom: 1rpx solid $line; border-bottom: 1rpx solid $line;
.sms-btn { .sms-btn {
position: absolute; position: absolute;
right: 0; right: 20rpx;
top: 50%; top: 50%;
height: 88rpx;
line-height: 88rpx;
z-index: 20; z-index: 20;
transform: translateY(-50%); transform: translateY(-50%);
background-color: #fff;
color: $primary; color: $primary;
} }
.disabledSmsBtn { .disabledSmsBtn {
...@@ -271,17 +258,4 @@ export default { ...@@ -271,17 +258,4 @@ export default {
} }
} }
} }
.btn_active {
background-color: yellow;
}
.test {
position: fixed;
right: 20rpx;
top: 20rpx;
z-index: 2;
}
</style> </style>
...@@ -154,7 +154,7 @@ export default { ...@@ -154,7 +154,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.user-wrap { .user-wrap {
@include borderBox(20rpx, 20rpx); @include borderBox(20rpx, 20rpx);
height: 240rpx; height: 454rpx;
background-color: red; background-color: red;
.avatar { .avatar {
width: 160rpx; width: 160rpx;
......
...@@ -26,6 +26,10 @@ ...@@ -26,6 +26,10 @@
- 仅次于小程序原生弹窗 zIndex 100 - 仅次于小程序原生弹窗 zIndex 100
#### 未完成 #### 未完成
+ 请求状态码 + 呼叫老板提取公共方法
+ 分页封装未处理页数 + 分类页面选中名称显示
+ 封装数量递增/递减 分类树形递归 首页 + 一级分类无商品 二级分类却有商品
\ No newline at end of file + 商品弹窗组件封装(根据sku打开购物弹窗组件)
+ 商品的价格展示处理
+ 购物
+ 购物车step组件
...@@ -9,7 +9,7 @@ const state = { ...@@ -9,7 +9,7 @@ const state = {
unionid: null, unionid: null,
session_key: '', session_key: '',
userInfo: {},// 昵称,头像,手机号码 userInfo: {},// 昵称,头像,手机号码
location: {}, // location: {}, // 经纬度
appid: '', appid: '',
storeInfo: {}, storeInfo: {},
...@@ -46,15 +46,15 @@ const actions = { ...@@ -46,15 +46,15 @@ const actions = {
setLoginStatus: ({commit}, status) => { setLoginStatus: ({commit}, status) => {
commit('SETLOGINSTATUS', status) commit('SETLOGINSTATUS', status)
}, },
setLocation: async ({state}) => { // setLocation: async ({state}) => {
uni.getLocation({ // uni.getLocation({
type: 'gcj02', // type: 'gcj02',
success: res => { // success: res => {
state.location.longitude = res.longitude || null // state.location.longitude = res.longitude || null
state.location.latitude = res.latitude || null // state.location.latitude = res.latitude || null
} // }
}) // })
}, // },
setUserInfo: async ({commit}, userInfo) => { setUserInfo: async ({commit}, userInfo) => {
try{ try{
const { status, data } = await getUserInfo() const { status, data } = await getUserInfo()
......
...@@ -24,3 +24,13 @@ ...@@ -24,3 +24,13 @@
box-sizing: border-box; box-sizing: border-box;
padding: $row $vertical; padding: $row $vertical;
} }
// 返回background
@mixin backBtn($w, $h) {
width: $w;
height: $h;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAABECAMAAADXwceKAAAAjVBMVEUAAAAzMzM0NDRJSUkzMzMzMzM2NjY0NDQzMzMzMzMzMzM0NDQ8PDw+Pj4zMzMzMzMzMzMzMzMzMzM0NDQzMzMzMzMzMzM0NDQzMzM0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ1NTU0NDQzMzM1NTU3Nzc0NDQzMzMzMzM0NDQ0NDQzMzM0NDQ1NTUzMzM0NDQzMzPceya4AAAALnRSTlMA8hMG5Pcb/OuwpIcPC+jb19LOwLWpgHVvZ2FVUElEOTUsIyDFlvrJu5AxMMSY+uhUcQAAASBJREFUSMeE0lcSglAQRFGSCogYyTmYy7f/5anT383M77HKhou1cE5gB86C7+7GmNDiF5jf2dyf5n8e9dzIpcxr+MMl3q/EjxHxKRaP18Sjg7j9Iu6exTcNGxhiYME8hW+Zl/CEeXsTn13igy2+ZxXXnrg/ssIn8VXHBlwwsGJ+hWfMM/iHeQW/MO9Q+LQjPvriHivs7FF4YIVnFG7ZgAQDS+ZbpXABD5k3G/EzK/xG4UO0XDieiDs+CvdswBEDa4sdPLf0H+h/oY/UH1N9Ufqr1mPpudUPhp37LbQOjQAAQBgGToNj//kQ6NxrJG3SjchFaBF7FsfVQ3knzqg/AAIEAWLAIEAqFBvm1oGFYiW11P731CLFSjVT7pwHHBicKAdvqE0z/uTTsgAAAABJRU5ErkJggg==);
background-position: 0 0;
background-repeat: no-repeat;
background-size: 100% 100%;
}
\ No newline at end of file
...@@ -12,7 +12,7 @@ function validateForm() { ...@@ -12,7 +12,7 @@ function validateForm() {
const form = this.form const form = this.form
smsValidator.add(form.phone, [{strategy: 'notEmpty', errorMsg: '手机号码不能为空'}, {strategy: 'isMobile', errorMsg: '手机号码格式不正确'}]) smsValidator.add(form.phone, [{strategy: 'notEmpty', errorMsg: '手机号码不能为空'}, {strategy: 'isMobile', errorMsg: '手机号码格式不正确'}])
smsValidator.add(form.f_code, [{strategy: 'notEmpty', errorMsg: '验证码不能为空'}]) smsValidator.add(form.f_code, [{strategy: 'notEmpty', errorMsg: '验证码不能为空'}])
smsValidator.add(form.upwd, [{strategy: 'notEmpty', errorMsg: '密码不能为空'}, {strategy: 'minLength:8', errorMsg: '密码不能少于8位数字或字母'}], smsValidator.add(form.upwd, [{strategy: 'notEmpty', errorMsg: '密码不能为空'}, {strategy: 'minLength:6', errorMsg: '密码不能少于6位数字或字母'}],
smsValidator.add(form.upwd2, [{strategy: 'notEmpty', errorMsg: '确认密码不能为空'}, {strategy: `unique:${form.upwd}`, errorMsg: '两次输入的密码不一致'}])) smsValidator.add(form.upwd2, [{strategy: 'notEmpty', errorMsg: '确认密码不能为空'}, {strategy: `unique:${form.upwd}`, errorMsg: '两次输入的密码不一致'}]))
return smsValidator.validate() return smsValidator.validate()
} }
......
<template> <template>
<view> <view class="wrap">
<view>
<view class="title font-36 font-bold ml-4">欢迎来到{{storeInfo.shop_name || '格利专属小程序'}}</view>
<view class="input-wrap">
<view class="item mb-4 pl-2">
<input <input
class="font-28 py-2"
type="number" type="number"
placeholder="请输入手机号码"
maxlength="11" maxlength="11"
placeholder="请输入手机号码"
v-model="form.phone" v-model="form.phone"
/> />
</view> </view>
<view> <view class="item mb-4">
<input <input
class="font-28 py-2 pl-2"
type="text" type="text"
placeholder="请输入验证码" placeholder="请输入验证码"
v-model="form.f_code" v-model="form.f_code"
/> />
<view
class="sms-btn font-28"
@click="handleSms"
:class="smsDisabled ? 'disabledSmsBtn' : null"
>{{smsMsg}}</view>
</view> </view>
<view> <view class="item mb-4">
<input <input
type="text" class="font-28 py-2 pl-2"
type="password"
placeholder="请输入新密码" placeholder="请输入新密码"
v-model="form.upwd" v-model="form.upwd"
/> />
<view class="psd-visibility">icon</view>
</view> </view>
<view> <view class="item mb-2">
<input <input
type="text" class="font-28 py-2 pl-2"
placeholder="请再次输入密码" type="password"
placeholder="再次输入密码"
v-model="form.upwd2" v-model="form.upwd2"
/> />
<view class="psd-visibility">icon</view>
</view>
<view class="tips">密码由6-12位英文字母或数字组成</view>
</view> </view>
<button type="default" @click="handleSms">{{smsMsg}}</button> <view class="submit font-bold font-32 text-center" @click="handleReset">提交</view>
<button type="default" @click="handleReset">重置</button>
</view> </view>
</template> </template>
0
<script> <script>
import { mapState } from 'vuex' import { mapState } from 'vuex'
...@@ -103,5 +121,56 @@ export default { ...@@ -103,5 +121,56 @@ export default {
} }
</script> </script>
<style> <style lang="scss" scoped>
.wrap {
background-color: #fff;
border-top: 1rpx solid $line;
height: 100vh;
overflow: hidden;
.title {
padding-top: 80rpx;
margin-bottom: 190rpx;
}
.input-wrap {
width: 550rpx;
margin: 0 auto;
.item {
position: relative;
height: 88rpx;
border-radius: 8rpx;
background-color: #f7f7f7;
.sms-btn, .psd-visibility {
position: absolute;
right: 20rpx;
top: 50%;
height: 88rpx;
line-height: 88rpx;
z-index: 20;
transform: translateY(-50%);
color: $primary;
}
.disabledSmsBtn {
color: $desc;
}
}
.tips {
font-size: 20rpx;
margin-bottom: 60rpx;
color: $desc;
}
}
.submit {
width: 360rpx;
height: 88rpx;
line-height: 88rpx;
margin: 0 auto;
border-radius: 8rpx;
background-color: $primary;
color: #fff;
}
}
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment