Browse Source

上传

master
前端-胡立永 7 months ago
parent
commit
278d9f4321
12 changed files with 368 additions and 144 deletions
  1. +18
    -0
      api/api.js
  2. +3
    -2
      api/http.js
  3. +3
    -0
      pages.json
  4. +1
    -1
      pages/index/index.vue
  5. +8
    -8
      pages/index/tourGuide.vue
  6. +130
    -0
      pages_order/components/product/cartAction.vue
  7. +4
    -4
      pages_order/components/product/productList.vue
  8. +8
    -123
      pages_order/mine/cart.vue
  9. +14
    -3
      pages_order/order/order.vue
  10. +90
    -0
      pages_order/product/productList.vue
  11. +0
    -0
      pages_order/static/product/favorable.png
  12. +89
    -3
      store/store.js

+ 18
- 0
api/api.js View File

@ -8,6 +8,24 @@ const config = {
// }, // },
getConfig : {url : '/api/getConfig', method : 'GET', limit : 500}, getConfig : {url : '/api/getConfig', method : 'GET', limit : 500},
// 微信登录接口
wxLogin: {
url: '/login/login',
method: 'POST',
limit : 500,
showLoading : true,
},
// 修改个人信息接口
updateInfo: {
url: '/info/updateInfo',
method: 'POST',
auth: true,
limit : 500,
showLoading : true,
},
} }


+ 3
- 2
api/http.js View File

@ -25,11 +25,12 @@ function http(uri, data, callback, method = 'GET', showLoading, title) {
} }
if(res.statusCode == 401 || if(res.statusCode == 401 ||
res.data.message == '操作失败,token非法无效!'){
res.data.message == '操作失败,token非法无效!' ||
res.data.message == '操作失败,用户不存在!'){
uni.removeStorageSync('token') uni.removeStorageSync('token')
console.error('登录过期'); console.error('登录过期');
uni.navigateTo({ uni.navigateTo({
url: '/pages/auth/login'
url: '/pages_order/auth/wxLogin'
}) })
} }


+ 3
- 0
pages.json View File

@ -68,6 +68,9 @@
}, },
{ {
"path": "mine/subscribe" "path": "mine/subscribe"
},
{
"path": "product/productList"
} }
] ]
}], }],


+ 1
- 1
pages/index/index.vue View File

@ -140,7 +140,7 @@
{ {
icon : '/static/image/home/g9.png', icon : '/static/image/home/g9.png',
title : '文创好物', title : '文创好物',
path : '',
path : '/pages_order/product/productList',
}, },
{ {
icon : '/static/image/home/g10.png', icon : '/static/image/home/g10.png',


+ 8
- 8
pages/index/tourGuide.vue View File

@ -96,12 +96,12 @@
// //
markertap(e) { markertap(e) {
console.log("===你点击了标记点===", e) console.log("===你点击了标记点===", e)
uni.getLocation({
success: res => {
uni.openLocation({
latitude: this.latitude + 0.01,
longitude: this.longitude + 0.01
})
this.markers.forEach(n => {
if(n.id == e.detail.markerId){
uni.openLocation({
latitude: n.latitude,
longitude: n.longitude,
})
} }
}) })
}, },
@ -116,8 +116,8 @@
let obj = { let obj = {
latitude: this.latitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2), latitude: this.latitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2),
longitude: this.longitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2), longitude: this.longitude + uni.$uv.random(1, 30) / 1000 * (uni.$uv.random(1, 3) - 2),
width: 30, //icon
height: 40 ,//icon
width: 20, //icon
height: 28 ,//icon
iconPath: `/static/image/tourGuide/${a}.png`, // iconPath: `/static/image/tourGuide/${a}.png`, //
id: i, id: i,
} }


+ 130
- 0
pages_order/components/product/cartAction.vue View File

@ -0,0 +1,130 @@
<template>
<view class="action">
<view class="icon">
<image src="/static/image/cart/1.png" mode=""></image>
<view class="num">
{{ cartCheckboxValue.length }}
</view>
</view>
<view class="price">
<view class="count">
合计
<view class="">
<text>{{ totalPrice }}</text>
</view>
</view>
<view class="text">
{{ cartCheckboxValue.length }}已享受更低优惠
</view>
</view>
<view class="btn">
去结算
</view>
</view>
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
}
},
computed: {
totalPrice() {
if (!this.cartCheckboxValue.length) {
return 0
}
let price = 0
this.cartList.forEach(n => {
if (this.cartCheckboxValue.includes(n.id)) {
price += n.price * n.num
}
})
return price
},
...mapState(['cartList', 'cartCheckboxValue']),
},
methods: {
}
}
</script>
<style scoped lang="scss">
.action {
width: 700rpx;
position: fixed;
bottom: 220rpx;
left: 25rpx;
background-color: #fff;
height: 100rpx;
border-radius: 50rpx;
box-shadow: 0 0 6rpx 6rpx #00000010;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
.icon {
position: relative;
width: 80rpx;
height: 80rpx;
margin: 0 20rpx;
image {
width: 80rpx;
height: 80rpx;
}
.num {
position: absolute;
right: 10rpx;
top: 0rpx;
background-color: $uni-color;
color: #fff;
font-size: 18rpx;
border-radius: 50%;
height: 30rpx;
width: 30rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
.price {
.count {
display: flex;
font-size: 26rpx;
align-items: center;
view {
color: $uni-color;
margin-left: 10rpx;
text {
font-size: 32rpx;
font-weight: 900;
}
}
}
.text {
font-size: 20rpx;
color: #717171;
}
}
.btn {
margin-left: auto;
background-color: $uni-color;
height: 100%;
padding: 0 50rpx;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
}
</style>

+ 4
- 4
pages_order/components/product/productList.vue View File

@ -22,9 +22,6 @@
48 48
</view> </view>
</view> </view>
<view class="num">
已售卖5000+
</view>
</view> </view>
<view class="btn"> <view class="btn">
<uv-icon name="shopping-cart" <uv-icon name="shopping-cart"
@ -35,6 +32,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name:"productList", name:"productList",
data() { data() {
@ -42,6 +40,8 @@
}; };
}, },
computed : {
},
methods : { methods : {
}, },
@ -82,7 +82,7 @@
} }
.favorable{ .favorable{
display: flex; display: flex;
background-image: url(/static/image/product/favorable.png);
background-image: url(../../static/product/favorable.png);
background-size: 100% 100%; background-size: 100% 100%;
width: fit-content; width: fit-content;
padding: 5rpx 10rpx; padding: 5rpx 10rpx;


+ 8
- 123
pages_order/mine/cart.vue View File

@ -5,11 +5,11 @@
<view class="user"> <view class="user">
<uv-checkbox-group <uv-checkbox-group
shape="circle" shape="circle"
v-model="checkboxValue">
v-model="cartCheckboxValue">
<uv-swipe-action> <uv-swipe-action>
<view <view
v-for="(item, index) in list"
v-for="(item, index) in cartList"
:key="index"> :key="index">
<view style="margin-top: 20rpx;"></view> <view style="margin-top: 20rpx;"></view>
<uv-swipe-action-item <uv-swipe-action-item
@ -53,28 +53,7 @@
</uv-swipe-action> </uv-swipe-action>
</uv-checkbox-group> </uv-checkbox-group>
<view class="action">
<view class="icon">
<image src="/static/image/cart/1.png" mode=""></image>
<view class="num">
{{ checkboxValue.length }}
</view>
</view>
<view class="price">
<view class="count">
合计
<view class="">
<text>{{ totalPrice }}</text>
</view>
</view>
<view class="text">
{{ checkboxValue.length }}已享受更低优惠
</view>
</view>
<view class="btn">
去结算
</view>
</view>
<cartAction/>
</view> </view>
<tabber select="3" /> <tabber select="3" />
@ -82,54 +61,26 @@
</template> </template>
<script> <script>
import tabber from '@/components/base/tabbar.vue'
import cartAction from '../components/product/cartAction.vue'
import { mapState } from 'vuex'
export default { export default {
components: { components: {
tabber,
cartAction
}, },
data() { data() {
return { return {
value : 0,
checkboxValue : [],
options: [ options: [
{ {
text: '删除', text: '删除',
style: { style: {
backgroundColor: '#FA5A0A' backgroundColor: '#FA5A0A'
} }
},
],
list : [
{
id : 1,
title : '桌布租赁',
num : 1,
price : 299,
unit : '120*40*75【桌子尺寸】',
},
{
id : 2,
title : '桌布租赁',
num : 1,
price : 299,
unit : '120*40*75【桌子尺寸】',
}, },
], ],
} }
}, },
computed: { computed: {
totalPrice(){
if (!this.checkboxValue.length) {
return 0
}
let price = 0
this.list.forEach(n => {
if(this.checkboxValue.includes(n.id)){
price += n.price * n.num
}
})
return price
},
...mapState(['cartList', 'cartCheckboxValue']),
}, },
methods: { methods: {
valChange(){ valChange(){
@ -185,72 +136,6 @@
} }
} }
} }
.action{
width: 700rpx;
position: fixed;
bottom: 220rpx;
left: 25rpx;
background-color: #fff;
height: 100rpx;
border-radius: 50rpx;
box-shadow: 0 0 6rpx 6rpx #00000010;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
.icon{
position: relative;
width: 80rpx;
height: 80rpx;
margin: 0 20rpx;
image{
width: 80rpx;
height: 80rpx;
}
.num{
position: absolute;
right: 10rpx;
top: 0rpx;
background-color: $uni-color;
color: #fff;
font-size: 18rpx;
border-radius: 50%;
height: 30rpx;
width: 30rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
.price{
.count{
display: flex;
font-size: 26rpx;
align-items: center;
view{
color: $uni-color;
margin-left: 10rpx;
text{
font-size: 32rpx;
font-weight: 900;
}
}
}
.text{
font-size: 20rpx;
color: #717171;
}
}
.btn{
margin-left: auto;
background-color: $uni-color;
height: 100%;
padding: 0 50rpx;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
}
}
} }
</style> </style>

+ 14
- 3
pages_order/order/order.vue View File

@ -119,6 +119,7 @@
state_dictText : '已完成', state_dictText : '已完成',
} }
], // ], //
state : -1,
} }
}, },
computed : { computed : {
@ -127,9 +128,9 @@
//tab //tab
clickTabs(index) { clickTabs(index) {
if (index == 0) { if (index == 0) {
this.queryParams.state = -1;
this.state = -1;
} else { } else {
this.queryParams.state = index - 1;
this.state = index - 1;
} }
this.getOrderList() this.getOrderList()
}, },
@ -140,7 +141,17 @@
}) })
}, },
getOrderList(){ getOrderList(){
let queryParams = {
...this.queryParams,
}
if(this.state != -1){
queryParams.state = this.state
}
this.$api('orderPage', queryParams, res => {
if(res.code == 200){
this.orderList = res.result
}
})
}, },
} }
} }


+ 90
- 0
pages_order/product/productList.vue View File

@ -0,0 +1,90 @@
<template>
<view class="page">
<navbar title="文创好物" leftClick @leftClick="$utils.navigateBack" />
<view class="search">
<uv-search
placeholder="请输入搜索服务"
:showAction="false"
search-icon-size="40rpx"
v-model="keyword"></uv-search>
</view>
<view class="dropDown">
<uv-tabs :list="tabs"
lineColor="#B12026"
lineHeight="8rpx"
lineWidth="50rpx"
:scrollable="false"
@click="clickTabs"></uv-tabs>
</view>
<view class="list">
<productList/>
</view>
<cartAction/>
<tabber/>
</view>
</template>
<script>
import cartAction from '../components/product/cartAction.vue'
import productList from '../components/product/productList.vue'
export default {
components : {
productList,
cartAction,
},
data() {
return {
tabs: [
{
name: '综合'
},
{
name: '销量'
},
{
name: '价格'
},
{
name: '上新'
},
],
queryParams: {
pageNo: 1,
pageSize: 10,
},
state : 0,
}
},
methods: {
//tab
clickTabs(index) {
if (index == 0) {
this.queryParams.state = -1;
} else {
this.queryParams.state = index - 1;
}
// this.getOrderList()
},
}
}
</script>
<style scoped lang="scss">
.page{
.search{
background-color: #fff;
padding: 20rpx 30rpx;
/deep/ .uv-search__content__icon{
padding: 15rpx 0;
}
}
.dropDown{
background-color: #fff;
}
.list{
padding: 0 20rpx;
}
}
</style>

static/image/product/favorable.png → pages_order/static/product/favorable.png View File


+ 89
- 3
store/store.js View File

@ -4,24 +4,110 @@ import Vuex from 'vuex'
Vue.use(Vuex); //vue的插件机制 Vue.use(Vuex); //vue的插件机制
import api from '@/api/api.js' import api from '@/api/api.js'
import Position from '@/utils/position.js'
//Vuex.Store 构造器选项 //Vuex.Store 构造器选项
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
configList: [], //配置列表 configList: [], //配置列表
image : 'https://img-s-msn-com.akamaized.net/tenant/amp/entityid/BB1msKSi.img',
shop : false,
position : {//定位信息
latitude : 0,
longitude : 0,
},
userInfo : {},//用户信息
cartList : [//购物车列表
{
id : 1,
title : '桌布租赁',
num : 1,
price : 299,
unit : '120*40*75【桌子尺寸】',
},
{
id : 2,
title : '桌布租赁',
num : 1,
price : 299,
unit : '120*40*75【桌子尺寸】',
},//购物车列表
],
cartCheckboxValue : [],//选中的购物车
}, },
getters: { getters: {
// 角色 true为水洗店 false为酒店
userShop(state){
return state.shop
}
}, },
mutations: { mutations: {
// 初始化配置 // 初始化配置
initConfig(state){ initConfig(state){
api('getConfig', res => {
// api('getConfig', res => {
// if(res.code == 200){
// state.configList = res.result
// }
// })
let config = ['getPrivacyPolicy', 'getUserAgreement']
config.forEach(k => {
api(k, res => {
if (res.code == 200) {
state.configList[k] = res.result
}
})
})
},
login(state){
uni.showLoading({
title: '登录中...'
})
uni.login({
success(res) {
if(res.errMsg != "login:ok"){
return
}
api('wxLogin', {
code : res.code,
latitude : state.position.latitude,
longitude : state.position.longitude,
}, res => {
uni.hideLoading()
if(res.code != 200){
return
}
state.userInfo = res.result.userInfo
uni.setStorageSync('token', res.result.token)
// if(!state.userInfo.nickName || !state.userInfo.headImage){
// uni.navigateTo({
// url: '/pages_order/auth/wxUserInfo'
// })
// }else{
uni.navigateBack(-1)
// }
})
}
})
},
getUserInfo(state){
api('infoGetInfo', res => {
if(res.code == 200){ if(res.code == 200){
state.configList = res.result
state.userInfo = res.result
} }
}) })
}, },
getPosition(state){
Position.getLocation(res => {
console.log(res);
state.position = res
})
},
}, },
actions: {}, actions: {},
}) })


Loading…
Cancel
Save