Browse Source

上传

master
前端-胡立永 9 months ago
parent
commit
3ca9b27607
20 changed files with 679 additions and 679 deletions
  1. +1
    -0
      App.vue
  2. +129
    -14
      api/api.js
  3. +3
    -2
      api/http.js
  4. +21
    -14
      components/base/tabbar.vue
  5. +2
    -2
      components/config/PrivacyAgreementPoup.vue
  6. +9
    -8
      components/user/productList.vue
  7. +2
    -2
      config.js
  8. +0
    -1
      pages/index/cart.vue
  9. +48
    -62
      pages/index/category.vue
  10. +0
    -1
      pages/index/center.vue
  11. +43
    -18
      pages/index/index.vue
  12. +73
    -27
      pages/index/order.vue
  13. +1
    -1
      pages_order/auth/wxLogin.vue
  14. +1
    -1
      pages_order/auth/wxUserInfo.vue
  15. +91
    -46
      pages_order/components/address/addressList.vue
  16. +106
    -92
      pages_order/components/address/redactAddress.vue
  17. +23
    -36
      pages_order/components/product/submitUnitSelect.vue
  18. +31
    -337
      pages_order/mine/address.vue
  19. +27
    -12
      pages_order/product/productDetail.vue
  20. +68
    -3
      store/store.js

+ 1
- 0
App.vue View File

@ -4,6 +4,7 @@
},
onShow: function() {
// this.$store.commit('initConfig')
this.$store.commit('getPosition')
},
onHide: function() {
}


+ 129
- 14
api/api.js View File

@ -6,39 +6,154 @@ const config = {
// auth : false, showLoading : true, loadingTitle : '加载中...',
// limit : 1000
// },
getConfig: {
url: '/api/getConfig',
method: 'GET'
},
// banner列表
bannerList: {
url: '/banner/list',
method: 'GET',
showLoading : true,
},
// 公告列表
noticeList: {
url: '/notice/list',
method: 'GET',
showLoading : true,
},
// 公告详情
noticeOne: {
url: '/notice/one',
method: 'GET',
showLoading : true,
},
// 商品列表
goodsPage: {
url: '/goods/page',
method: 'GET',
showLoading : true,
},
// 商品详情
goodsOne: {
url: '/goods/one',
method: 'GET',
showLoading : true,
},
//分类列表
categoryList: {
url: '/category/list',
method: 'GET',
showLoading : true,
},
//新增地址
addressAdd: {
url: '/address/add',
method: 'POST',
limit: 500,
// auth : true,
showLoading : true,
},
//修改默认地址
addressDefault: {
url: '/address/default',
method: 'POST',
// auth : true,
showLoading : true,
},
//删除地址
addressDelete: {
url: '/address/delete',
method: 'POST',
// auth : true,
showLoading : true,
},
//修改地址
addressEdit: {
url: '/address/edit',
method: 'POST',
limit: 500,
// auth : true,
showLoading : true,
},
//分页查询地址
addressPage: {
url: '/address/page',
method: 'GET',
// auth : true,
showLoading : true,
},
getConfig : {url : '/api/getConfig', method : 'GET', limit : 500},
//分页查询订单
orderPage: {
url: '/order/page',
method: 'GET',
// auth : true,
showLoading : true,
},
//查询订单详情
orderOne: {
url: '/order/one',
method: 'GET',
// auth : true,
showLoading : true,
},
// 微信登录接口
wxLogin: {
url: '/login/login',
method: 'POST',
limit : 500,
showLoading : true,
},
// 修改个人信息接口
updateInfo: {
url: '/info/updateInfo',
method: 'POST',
auth: true,
limit : 500,
showLoading : true,
},
}
export function api(key, data, callback, loadingTitle){
export function api(key, data, callback, loadingTitle) {
let req = config[key]
if (!req) {
console.error('无效key' + key);
return
}
if(typeof callback == 'string'){
if (typeof callback == 'string') {
loadingTitle = callback
}
if(typeof data == 'function'){
if (typeof data == 'function') {
callback = data
data = {}
}
// 接口限流
if(req.limit){
if (req.limit) {
let storageKey = 'limit:' + req.url
let storage = uni.getStorageSync(storageKey)
if(storage && new Date().getTime() - parseInt(storage) < req.limit){
if (storage && new Date().getTime() - parseInt(storage) < req.limit) {
return
}
uni.setStorageSync(storageKey, new Date().getTime())
}
//必须登录
if (req.auth) {
if (!uni.getStorageSync('token')) {
@ -49,9 +164,9 @@ export function api(key, data, callback, loadingTitle){
return
}
}
http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}


+ 3
- 2
api/http.js View File

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


+ 21
- 14
components/base/tabbar.vue View File

@ -1,18 +1,21 @@
<template>
<view class="tabbar">
<view
:class="{item : true, active : select == index}"
v-for="(item, index) in list"
:key="index"
v-if="!item.isNotShop || !userShop"
@click="toPath(item, index)">
<view class="icon">
<image :src="select == index ?
item.selectedIconPath :
item.iconPath" class="icon-image" mode=""></image>
</view>
<view class="title">
{{ item.title }}
<view class="">
<view class="tabbar-box"></view>
<view class="tabbar">
<view
:class="{item : true, active : select == index}"
v-for="(item, index) in list"
:key="index"
v-if="!item.isNotShop || !userShop"
@click="toPath(item, index)">
<view class="icon">
<image :src="select == index ?
item.selectedIconPath :
item.iconPath" class="icon-image" mode=""></image>
</view>
<view class="title">
{{ item.title }}
</view>
</view>
</view>
</view>
@ -78,6 +81,10 @@
</script>
<style scoped lang="scss">
.tabbar-box{
height: 120rpx;
padding-bottom: env(safe-area-inset-bottom);
}
.tabbar{
position: fixed;
width: 750rpx;


+ 2
- 2
components/config/PrivacyAgreementPoup.vue View File

@ -10,7 +10,7 @@
</view>
<view class="content_pri">
<view class="text">
欢迎来到酒店布草!我们根据最新的法律法规监管政策要求更新了用户协议隐私政策,请您认真阅读
欢迎来到布周到!我们根据最新的法律法规监管政策要求更新了用户协议隐私政策,请您认真阅读
</view>
</view>
<view class="config">
@ -18,7 +18,7 @@
<view class="content">
<view style="display: flex;">
<!-- <uv-checkbox size="30rpx" :name="1"></uv-checkbox> -->
同意<text @click="goToPrivacy">酒店布草隐私政策</text>
同意<text @click="goToPrivacy">布周到隐私政策</text>
</view>
<view class="">
以及<text @click="goToPrivacy">用户协议</text>


+ 9
- 8
components/user/productList.vue View File

@ -1,29 +1,29 @@
<template>
<view class="list">
<view class="item"
v-for="(item, index) in 10"
@click="$utils.navigateTo('/pages_order/product/productDetail?id=123')"
v-for="(item, index) in productList"
@click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)"
:key="index">
<image
class="image"
src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg" mode=""></image>
:src="item.pic" mode="aspectFill"></image>
<view class="info">
<view class="title">
桌布租赁
{{ item.name }}
</view>
<view class="price">
<text>58</text>/
<text>{{ item.originalPrice }}</text>/
</view>
<view class="favorable">
<view class="favorable" v-if="item.goodsSku">
<view class="t">
限时优惠
</view>
<view class="p">
48
{{ item.goodsSku.price }}
</view>
</view>
<view class="num">
已售卖5000+
已售卖{{ item.soldNum }}+
</view>
</view>
<view class="btn">
@ -37,6 +37,7 @@
<script>
export default {
name:"productList",
props : ['productList'],
data() {
return {


+ 2
- 2
config.js View File

@ -13,10 +13,10 @@ const type = 'dev'
// 环境配置
const config = {
dev : {
baseUrl : 'http://www.gcosc.fun:82',
baseUrl : 'http://dev.java996.icu/hotel',
},
prod : {
baseUrl : 'http://xxx.xxx.xxx/xxx',
baseUrl : 'http://dev.java996.icu/hotel',
}
}


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

@ -141,7 +141,6 @@
<style scoped lang="scss">
.page {
padding-bottom: 200rpx;
}
.user {


+ 48
- 62
pages/index/category.vue View File

@ -6,7 +6,6 @@
<uv-vtabs
:chain="chain"
:list="category"
height="1000px"
:barItemBadgeStyle="{right:'20px',top:'12px'}"
@change="change">
<uv-vtabs-item>
@ -14,15 +13,15 @@
租赁
</view>
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index"
@click="$utils.navigateTo('/pages_order/product/productDetail?id=123')">
<view class="item" v-for="(item,index) in productList" :key="index"
@click="$utils.navigateTo('/pages_order/product/productDetail?id=' + item.id)">
<view class="item-image">
<image
:src="item.image"
:src="item.pic"
mode="aspectFill"></image>
</view>
<view class="item-unit">
<text class="text">{{item.unit}}</text>
<text class="text">{{item.name}}</text>
</view>
</view>
</view>
@ -43,73 +42,61 @@
},
data() {
return {
category: [
{
name : '桌布'
},
{
name : '桌布'
},
{
name : '桌布'
},
],
list : [
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
{
unit : '100*50*60',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
},
],
category: [],
queryParams: {
pageNo: 1,
pageSize: 10,
},
list : {
records : [],
total : 0,
},
chain: false,
value: 0
categoryIndex: 0
}
},
computed: {
list2() {
const _list = this.list[this.value]?.childrens;
return _list ? _list : [];
productList(){
return this.category.length ? this.category[this.categoryIndex].hotelGoodsList || [] : []
}
},
onShow() {
this.categoryList()
},
//
onReachBottom() {
if(this.queryParams.pageSize < this.list.total){
this.queryParams.pageSize += 10
this.getGoodsPage()
}
},
onReady() {
},
methods: {
categoryList(){
this.$api('categoryList', res => {
if(res.code == 200){
this.category = res.result
this.getGoodsPage()
}
})
},
getGoodsPage(){
this.$api('goodsPage', {
...this.queryParams,
categoryId : this.category[this.categoryIndex].id
}, res => {
if(res.code == 200){
this.list = res.result
}
})
},
change(index) {
console.log('选项改变:', index)
this.value = index;
}
this.categoryIndex = index;
// this.queryParams.pageSize = 10
// this.getGoodsPage()
},
}
}
</script>
@ -118,7 +105,6 @@
.category {
font-size: 30rpx;
color: #333;
min-height: 100vh;
.category-title{
position: relative;
display: flex;


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

@ -227,7 +227,6 @@
<style scoped lang="scss">
.page {
padding-bottom: 200rpx;
.warp {
display: flex;


+ 43
- 18
pages/index/index.vue View File

@ -33,7 +33,7 @@
:list="bannerList"
indicator
height="320rpx"
keyName="url"></uv-swiper>
keyName="pic"></uv-swiper>
</view>
<!-- 水洗店 -->
@ -63,7 +63,7 @@
v-else>
<uv-notice-bar
fontSize="28rpx"
:text="text"></uv-notice-bar>
:text="notice"></uv-notice-bar>
<view class="shop">
<image
@ -102,7 +102,7 @@
</view>
<view class="productList">
<productList/>
<productList :productList="productList.records"/>
</view>
</view>
@ -130,30 +130,56 @@
data() {
return {
area: '长沙',
text : '长沙市刘师傅在服务过程中客户投诉“服务过程中有不文明的行为”.....',
notice : '长沙市刘师傅在服务过程中客户投诉“服务过程中有不文明的行为”.....',
queryParams: {
pageNo: 1,
pageSize: 10,
title: ''
title: '',
},
bannerList: [
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
},
{
url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
},
],
productList: [],
bannerList: [],
productList: {
records : [],
total : 0,
},
}
},
onShow() {
this.getGoodsPage()
this.noticeList()
this.banner()
},
//
onReachBottom() {
if(this.queryParams.pageSize < this.productList.total){
this.queryParams.pageSize += 10
this.getGoodsPage()
}
},
computed : {
...mapGetters(['userShop']),
},
methods: {
banner(){
this.$api('bannerList', res => {
if(res.code == 200){
this.bannerList = res.result
}
})
},
noticeList(){
this.$api('noticeList', res => {
if(res.code == 200){
this.notice = res.result.content
}
})
},
getGoodsPage(){
this.$api('goodsPage', this.queryParams, res => {
if(res.code == 200){
this.productList = res.result
}
})
},
//
showSelectArea() {
// this.$refs.selectArea.open()
@ -292,7 +318,6 @@
margin: 20rpx;
}
.page{
padding-bottom: 200rpx;
& /deep/ .uv-icon__icon{
font-size: 30rpx !important;
}


+ 73
- 27
pages/index/order.vue View File

@ -12,9 +12,9 @@
lineWidth="50rpx"
@click="clickTabs"></uv-tabs>
<view v-if="orderList.length > 0" class="list">
<view v-if="orderList.records.length > 0" class="list">
<view class="item"
v-for="(item, index) in orderList"
v-for="(item, index) in orderList.records"
@click="toOrderDetail(item.id)"
:key="index">
@ -31,18 +31,18 @@
<view class="content">
<view class="left">
<image mode="aspectFill" :src="item.image"></image>
<image mode="aspectFill" :src="item.pic"></image>
</view>
<view class="right">
<view class="text-hidden-1">
客户姓名{{item.name}}
客户姓名{{item.userName}}
</view>
<view class="text-hidden-1">
产品规格{{item.unit}}
</view>
<view class="text-hidden-1">
租赁地址{{item.address}}
租赁地址{{item.userAddress}}
</view>
<!-- <view class="text-hidden-1">
总计时间{{item.useTime}}分钟
@ -53,11 +53,28 @@
</view>
<view class="bottom">
<view class="price">
总价格<text class="num">{{item.money}}</text>
<view class="pay">
<view class="price"
v-if="!userShop && item.type != 1">
总金额<text class="num">{{ item.orderPay }}</text>
</view>
<view
v-if="item.type == 1">
水洗费用{{ item.rentPay }}
</view>
<view
v-if="!userShop && item.type == 1">
租赁费用{{ item.rentPay }}
</view>
</view>
<view class="b1">
查看物流
<view class="">
<view class="price"
v-if="!userShop && item.type == 1">
总金额<text class="num">{{ item.orderPay }}</text>
</view>
<view class="b1">
查看物流
</view>
</view>
<!-- <view @click.stop="toPayOrder(item)" class="b2" v-if="item.state == 0">
立即付款
@ -112,30 +129,57 @@
pageNo: 1,
pageSize: 10
},
orderList: [
{
money : 99.99,
address : '广东省广州市越秀区城南故事C3栋2802',
name : '李**',
phone : '150*****091',
unit : '120*40*75【桌子尺寸】',
image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
state_dictText : '已完成',
}
], //
// orderList: [
// {
// money : 99.99,
// address : '广广C32802',
// name : '**',
// phone : '150*****091',
// unit : '120*40*75',
// image : 'https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg',
// state_dictText : '',
// }
// ], //
orderList : {
records : [],
total : 0,
},
state : -1,
}
},
computed : {
onShow() {
this.orderPage()
},
//
onReachBottom() {
if(this.queryParams.pageSize < this.orderList.total){
this.queryParams.pageSize += 10
this.orderPage()
}
},
methods: {
orderPage(){
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
}
})
},
//tab
clickTabs(index) {
clickTabs({ index, name }) {
if (index == 0) {
this.queryParams.state = -1;
this.state = -1;
} else {
this.queryParams.state = index - 1;
this.state = index - 1;
}
this.getOrderList()
this.queryParams.pageSize = 10
this.orderPage()
},
//
toOrderDetail(id) {
@ -152,7 +196,6 @@
<style scoped lang="scss">
.page{
padding-bottom: 200rpx;
}
.list {
.item {
@ -218,6 +261,9 @@
border: 1px solid #777;
color: #777;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
}
.b2 {
@ -225,7 +271,7 @@
color: #fff;
}
view {
.b1,.b2 {
margin: 12rpx;
border-radius: 28rpx;
padding: 8rpx 28rpx;


+ 1
- 1
pages_order/auth/wxLogin.vue View File

@ -4,7 +4,7 @@
<!-- <image src="/static/image/login/logo.png" mode=""></image> -->
</view>
<view class="title">
欢迎使用酒店桌布租赁平台
欢迎使用布周到
</view>
<view class="btn mt"
@click="wxLogin">


+ 1
- 1
pages_order/auth/wxUserInfo.vue View File

@ -1,7 +1,7 @@
<template>
<view class="login">
<view class="title">
酒店桌布租赁平台
布周到
</view>
<view class="title">
申请获取你的头像昵称


+ 91
- 46
pages_order/components/address/addressList.vue View File

@ -1,52 +1,67 @@
<template>
<uv-radio-group v-model="selectAddress">
<view v-for="item in addressList" :key="item.id" class="address-item">
<view class="address-item-top"
@click="select(item)">
<view class="img-box">
<image src="../../static/address/icon.png" mode="aspectFill"></image>
</view>
<view class="address-info">
<view class="user-info">
<text class="user-name">{{ item.name }}</text>
<text class="user-phone">{{ item.phone }}</text>
<text v-if="item.defaultId == '1'" class="is-default">默认</text>
<scroll-view
scroll-y="true"
:style="{height: height}"
@scrolltolower="moreAddress">
<uv-radio-group v-model="selectAddress"
@change="editDefault"
v-if="addressList.length > 0">
<view v-for="item in addressList" :key="item.id" class="address-item">
<view class="address-item-top"
@click="select(item)">
<view class="img-box">
<image src="../../static/address/icon.png" mode="aspectFill"></image>
</view>
<view class="address-detail">
{{ item.address + " " + item.addressDetail }}
<view class="address-info">
<view class="user-info">
<text class="user-name">{{ item.name }}</text>
<text class="user-phone">{{ item.phone }}</text>
<text v-if="item.id == selectAddress" class="is-default">默认</text>
</view>
<view class="address-detail">
{{ item.address + " " + item.addressDetail }}
</view>
</view>
</view>
</view>
<view class="controls"
v-if="controls">
<view class="default-checkbox">
<uv-radio @click="editDefault(item)"
:name="item.id"
label-disabled
size="30rpx"
icon-size="30rpx">
默认地址
</uv-radio>
</view>
<view class="edit-btn">
<uv-icon name="edit-pen"></uv-icon>
<text @click="editAddress(item.id)" class="control-title">编辑</text>
</view>
<view class="del-btn">
<uv-icon name="trash"></uv-icon>
<text class="control-title" @click="deleteAddress(item.id)">删除</text>
<view class="controls"
v-if="controls">
<view class="default-checkbox">
<uv-radio
:name="item.id"
label-disabled
size="30rpx"
icon-size="30rpx">
默认地址
</uv-radio>
</view>
<view class="edit-btn">
<uv-icon name="edit-pen"></uv-icon>
<text @click="editAddress(item)" class="control-title">编辑</text>
</view>
<view class="del-btn">
<uv-icon name="trash"></uv-icon>
<text class="control-title" @click="deleteAddress(item.id)">删除</text>
</view>
</view>
</view>
</uv-radio-group>
<view
style="padding: 100rpx 0;"
v-else>
<uv-empty
mode="history"
textSize="28rpx"
iconSize="100rpx"/>
</view>
</uv-radio-group>
</scroll-view>
</template>
<script>
@ -56,17 +71,47 @@
default : false,
type : Boolean,
},
addressList : {
default : [],
type : Array,
height : {
default : 'calc(90vh - 180rpx)'
}
},
data() {
return {
selectAddress : 0,
queryParams: {
pageNo: 1,
pageSize: 10,
},
addressList: [],
total : 0,
}
},
methods: {
//
getAddressList() {
return new Promise((success, fail) => {
this.$api('addressPage', this.queryParams, res => {
if (res.code == 200) {
this.addressList = res.result.records || [];
this.total = res.result.total || 0;
this.addressList.forEach(n => { //
if (n.defaultFlag == 1) {
this.selectAddress = n.id
}
})
success(res.result)
}
})
})
},
//
moreAddress(){
if(this.queryParams.pageSize > this.total){
return
}
this.queryParams.pageSize += 10
this.getAddressList()
},
//
deleteAddress(e){
this.$emit('deleteAddress', e)
@ -82,7 +127,7 @@
//
select(e){
this.$emit('select', e)
}
},
}
}
</script>


+ 106
- 92
pages_order/components/address/redactAddress.vue View File

@ -1,126 +1,140 @@
<template>
<view class="redact-address">
<uv-popup round="40rpx" ref="addressPopup" :customStyle="{ height: 'auto' , width : '100%' , padding : '20rpx'}">
<view class="redact-address">
<view class="redact-address-title">{{title}}</view>
<uv-form label-width="210rpx"
:model="addressDetail"
ref="form" :rules="rules">
<!-- <uv-field v-model="addressDetail.name" name="联系人" label="联系人" placeholder="请输入联系人姓名"
:rules="[{ required: true, message: '请填写联系人' }]" />
<uv-field v-model="addressDetail.phone" name="手机号" label="手机号" placeholder="请输入手机号"
:rules="[{ required: true, message: '请填写手机号' }]" />
<uv-field @click="$emit('clickAddressIcon')" v-model="addressDetail.address" name="所在地区" label="所在地区" placeholder="选择省市区街道"
:rules="[{ required: true, message: '请选择省市区街道' }]">
<template #right-icon>
<image @click.stop="$emit('clickAddressIcon')" src="../static/address/selectIcon.png" mode="aspectFit"></image>定位
</template>
</uv-field>
<uv-field v-model="addressDetail.addressDetail" name="详细地址" label="详细地址" placeholder="小区楼栋、门牌号、村等"
:rules="[{ required: true, message: '请填写详细地址' }]" /> -->
<uv-form-item label="联系人"
prop="name"
>
<uv-input v-model="addressDetail.name"
placeholder="请输入联系人姓名"
border="none">
<uv-form label-width="210rpx" :model="addressDetail" ref="form">
<uv-form-item label="联系人" prop="name">
<uv-input v-model="addressDetail.name" placeholder="请输入联系人姓名" border="none">
</uv-input>
</uv-form-item>
<uv-form-item label="手机号"
prop="phone"
>
<uv-input v-model="addressDetail.phone"
placeholder="请输入手机号"
border="none">
<uv-form-item label="手机号" prop="phone">
<uv-input v-model="addressDetail.phone" placeholder="请输入手机号" border="none">
</uv-input>
</uv-form-item>
<uv-form-item label="所在地区"
prop="address"
>
<uv-input
v-model="addressDetail.address"
placeholder="请选择所在地区"
border="none">
<uv-form-item label="所在地区" prop="address">
<uv-input v-model="addressDetail.address" placeholder="请选择所在地区" border="none">
</uv-input>
<template #right>
<view style="padding-right: 40rpx;color: #FBAB32;"
@click.stop="$emit('clickAddressIcon')">
<image
src="../../static/address/selectIcon.png"
mode="aspectFit"></image>定位
<view style="padding-right: 40rpx;color: #FBAB32;" @click.stop="selectAddr">
<image src="../../static/address/selectIcon.png" mode="aspectFit"></image>定位
</view>
</template>
</uv-form-item>
<uv-form-item label="详细地址"
prop="addressDetail"
>
<uv-input v-model="addressDetail.addressDetail"
placeholder="请输入详细地址"
border="none">
<uv-form-item label="详细地址" prop="addressDetail">
<uv-input v-model="addressDetail.addressDetail" placeholder="请输入详细地址" border="none">
</uv-input>
</uv-form-item>
</uv-form>
<view @click="onSubmit" class="save">{{ addressDetail.id ? '修改地址' : '新增地址'}}</view>
</view>
</view>
</uv-popup>
</template>
<script>
import Position from '@/utils/position.js'
export default {
data() {
return {
rules: {
'name': {
type: 'string',
required: true,
message: '请填写姓名',
trigger: ['blur', 'change']
},
'addressDetail': {
type: 'string',
max: 50,
required: true,
message: '请输入详细地址',
trigger: ['blur', 'change']
},
},
addressDetail: {}
}
},
props : {
addressDetail : {
type : Object,
default : function(){ return {} }
},
title : {
type : String,
default : '新增地址'
props: {
title: {
type: String,
default: '新增地址'
}
},
methods: {
open(addressDetail) {
this.addressDetail = addressDetail
this.$refs.addressPopup.open('bottom')
},
close(){
this.$refs.addressPopup.close()
},
//
onSubmit() {
this.$refs.form.validate().then(res => {
console.log(res);
uni.showToast({
icon: 'success',
title: '校验通过'
let isOk = this.parameterVerification(this.addressDetail)
if (isOk && !isOk.auth) {
return uni.showToast({
icon: 'none',
title: isOk.title,
'zIndex': 10000
})
}).catch(errors => {
uni.showToast({
icon: 'error',
title: '校验失败'
}
this.$emit('saveOrUpdate', this.addressDetail)
},
//
parameterVerification(addressDetaila) {
let {
name,
phone,
address,
addressDetail
} = addressDetaila
if (name.trim() == '') {
return {
title: '请填写联系人',
auth: false
}
} else if (phone.trim() == '') {
return {
title: '请填写手机号',
auth: false
}
} else if (address.trim() == '') {
return {
title: '请填写所在地区',
auth: false
}
} else if (addressDetail.trim() == '') {
return {
title: '请填写详细地址',
auth: false
}
} else if (phone.trim() != '') {
if (!this.$utils.verificationPhone(phone)) {
return {
title: '手机号格式不合法',
auth: false
}
}
}
return {
title: '验证通过',
auth: true
}
},
//
selectAddr() {
Position.getLocation(res => {
Position.selectAddress(res.longitude, res.latitude, success => {
this.setAddress(success)
})
})
// this.$emit('saveOrUpdate', this.addressDetail)
}
},
//
setAddress(res) {
//
this.addressDetail.latitude = res.latitude
this.addressDetail.longitude = res.longitude
if (!res.address && res.name) { //
return this.addressDetail.address = res.name
}
if (res.address || res.name) {
return this.addressDetail.address = res.address + res.name
}
this.addressDetail.address = '' //
},
}
}
</script>


+ 23
- 36
pages_order/components/product/submitUnitSelect.vue View File

@ -29,12 +29,12 @@
<view class="box">
<image
class="image"
src="https://img95.699pic.com/photo/50058/1378.jpg_wh860.jpg"
:src="unit.pic"
mode=""></image>
<view class="info">
<view class="price">
<text>299</text>
<text>{{ unit.depositPrice }}</text>
</view>
<view class="unit">
请选择规格
@ -53,10 +53,10 @@
</view>
<view class="list">
<view :class="{act : unitIndex == index}"
v-for="(item, index) in 10"
v-for="(item, index) in detail.hotelGoodsSkuList"
@click="selectUnit(item, index)"
:key="index">
120*40*75桌子尺寸
{{ item.title }}
</view>
</view>
</view>
@ -69,7 +69,7 @@
费用明细
</view>
<view class="detail">
押金200
押金{{ unit.depositPrice }}
</view>
</view>
@ -82,7 +82,8 @@
<uv-popup ref="addressPopup" :round="30">
<addressList
:addressList="addressList"
ref="addressList"
height="60vh"
@select="selectAddress"
/>
</uv-popup>
@ -93,40 +94,20 @@
import addressList from '../address/addressList.vue'
export default {
components : {
addressList
addressList,
},
props : {
submiitTitle : {
default : '立即租赁',
type : String,
},
detail : {
default : {}
}
},
data() {
return {
unitIndex : 0,
addressList: [
{
id : 1,
name : 'xx',
phone : '1305xxxx802',
address : '广东省广州市越秀区',
addressDetail : '城南故事C3栋2802',
},
{
id : 2,
name : 'xx',
phone : '1305xxxx802',
address : '广东省广州市越秀区',
addressDetail : '城南故事C3栋2802',
},
{
id : 3,
name : 'xx',
phone : '1305xxxx802',
address : '广东省广州市越秀区',
addressDetail : '城南故事C3栋2802',
},
],
address : {
name : '请选择联系人',
addressDetail : '',
@ -139,6 +120,9 @@
//
open(){
this.$refs.popup.open('bottom')
if(!this.unit.id){
this.selectUnit(this.detail.hotelGoodsSkuList[0], 0)
}
},
//
close(){
@ -146,12 +130,15 @@
},
//
openAddress(){
if (!this.addressList.length) {
return uni.navigateTo({
url: '/pages_order/mine/address'
})
}
this.$refs.addressPopup.open('bottom')
//
this.$refs.addressList.getAddressList().then(res => {
if (res.total == 0) {
return uni.navigateTo({
url: '/pages_order/mine/address'
})
}
this.$refs.addressPopup.open('bottom')
})
},
//
selectAddress(e){


+ 31
- 337
pages_order/mine/address.vue View File

@ -3,77 +3,22 @@
<navbar title="地址管理" leftClick @leftClick="leftClick" />
<view v-if="addressList.length > 0" class="address-list">
<!-- <uv-radio-group v-model="selectAddress">
<view v-for="item in addressList" :key="item.id" class="address-item">
<view class="address-item-top">
<view class="img-box">
<image src="../static/address/icon.png" mode="aspectFill"></image>
</view>
<view class="address-info">
<view class="user-info">
<text class="user-name">{{ item.name }}</text>
<text class="user-phone">{{ item.phone }}</text>
<text v-if="item.defaultId == '1'" class="is-default">默认</text>
</view>
<view class="address-detail">
{{ item.address + " " + item.addressDetail }}
</view>
</view>
</view>
<view class="controls">
<view class="default-checkbox">
<uv-radio @click="addDefault(item)"
:name="item.id"
label-disabled
size="30rpx"
icon-size="30rpx">
默认地址
</uv-radio>
</view>
<view class="edit-btn">
<uv-icon name="edit-pen"></uv-icon>
<text @click="getAddressDetail(item.id)" class="control-title">编辑</text>
</view>
<view class="del-btn">
<uv-icon name="trash"></uv-icon>
<text class="control-title" @click="deleteAddress(item.id)">删除</text>
</view>
</view>
</view>
</uv-radio-group> -->
<view class="address-list">
<addressList
controls
ref="addressList"
@deleteAddress="deleteAddress"
@editAddress="getAddressDetail"
@editDefault="addDefault"
:addressList="addressList"/>
@editAddress="editAddress"
@editDefault="editDefault"/>
</view>
<view
style="padding: 100rpx 0;"
v-else>
<uv-empty
mode="history"
textSize="28rpx"
iconSize="100rpx"/>
</view>
<uv-popup
round="40rpx"
<redactAddress
ref="addressPopup"
:customStyle="{ height: 'auto' , width : '100%' , padding : '20rpx'}">
<redactAddress :addressDetail="addressDetail" @saveOrUpdate="saveOrUpdate" :title="title"
@clickAddressIcon="selectAddr"></redactAddress>
</uv-popup>
:addressDetail="addressDetail"
@saveOrUpdate="saveOrUpdate"
:title="title"></redactAddress>
<view class="add-btn">
<view @click="addBtn" class="btn">
@ -86,7 +31,6 @@
<script>
import redactAddress from '../components/address/redactAddress.vue'
import addressList from '../components/address/addressList.vue'
import Position from '@/utils/position.js'
export default {
components: {
@ -95,81 +39,22 @@
},
data() {
return {
selectAddress: 0, //
queryParams: {
pageNo: 1,
pageSize: 10
},
addressList: [
{
id : 1,
name : 'xx',
phone : '1305xxxx802',
address : '广东省广州市越秀区',
addressDetail : '城南故事C3栋2802',
},
{
id : 2,
name : 'xx',
phone : '1305xxxx802',
address : '广东省广州市越秀区',
addressDetail : '城南故事C3栋2802',
},
{
id : 3,
name : 'xx',
phone : '1305xxxx802',
address : '广东省广州市越秀区',
addressDetail : '城南故事C3栋2802',
},
],
addressDetail: {},
title: '新增地址'
}
},
onShow() {
// if (this.$route.query.current == 'payOrder') {
// this.$refs.addressPopup.open('bottom')
// }
// this.getAddressList()
this.getAddressList()
},
methods: {
//list
onLoad() {
this.queryParams.pageSize += 10
this.getAddressList()
},
//
getAddressList() {
this.$api('getAddressList', this.queryParams, res => {
if (res.code == 200) {
this.addressList = res.result.records || [];
this.addressList.forEach(n => { //
if (n.defaultId == '1') {
this.selectAddress = n.id
}
})
if (this.queryParams.pageSize > res.result.total) {
this.finished = true
}
}
this.loading = false
})
this.$refs.addressList.getAddressList()
},
//
getAddressDetail(id) {
this.title = '修改地址'
this.$api('getAddressDetail', {
id
}, res => {
if (res.code == 200) {
this.addressDetail = res.result;
this.$refs.addressPopup.open('bottom')
}
})
editAddress(address) {
this.$refs.addressPopup.open({...address})
},
//
@ -178,31 +63,23 @@
},
//
saveOrUpdate() {
let isOk = this.parameterVerification()
if (isOk && !isOk.auth) {
return showNotify({
type: 'warning',
message: isOk.title,
'z-index': 10000
});
}
saveOrUpdate(addressDetail) {
let data = {
name: this.addressDetail.name,
phone: this.addressDetail.phone,
address: this.addressDetail.address,
addressDetail: this.addressDetail.addressDetail,
defaultId: this.addressDetail.defaultId || '0',
latitude: this.addressDetail.latitude,
longitude: this.addressDetail.longitude
name: addressDetail.name,
phone: addressDetail.phone,
address: addressDetail.address,
addressDetail: addressDetail.addressDetail,
defaultId: addressDetail.defaultId || '0',
latitude: addressDetail.latitude,
longitude: addressDetail.longitude
}
if (this.addressDetail.id) {
data.id = this.addressDetail.id
if (addressDetail.id) {
data.id = addressDetail.id
}
this.$api('addOrUpdateAddress', data, res => {
this.$api(data.id ? 'addressEdit' : 'addressAdd', data, res => {
if (res.code == 200) {
this.$refs.addressPopup.close()
this.getAddressList()
@ -210,21 +87,14 @@
title: '操作成功',
icon: 'none'
})
if (this.$route.query.current == 'payOrder') { //
uni.navigateTo({
url: `/pages/order/payOrder?orderId=${this.$route.query.orderId}`
})
}
}
})
},
//
addDefault(item) {
this.selectAddress = item.id
this.$api('addOrUpdateAddress', {
id: item.id,
defaultId: '1',
//
editDefault(id) {
this.$api('addressDefault', {
id: id,
}, res => {
if (res.code == 200) {
this.$refs.addressPopup.close()
@ -245,7 +115,7 @@
content: '确认删除此地址?删除后数据不可恢复',
success(e) {
if(e.confirm){
self.$api('deleteAddress', {
self.$api('addressDelete', {
id
}, res => {
if (res.code == 200) {
@ -264,7 +134,7 @@
//
addBtn() {
this.title = '新增地址'
this.addressDetail = { //
this.$refs.addressPopup.open({ //
name: '',
phone: '',
address: '',
@ -272,75 +142,8 @@
defaultId: '',
latitude: '',
longitude: ''
}
this.$refs.addressPopup.open('bottom')
},
//
parameterVerification() {
let {
name,
phone,
address,
addressDetail
} = this.addressDetail
if (name.trim() == '') {
return {
title: '请填写联系人',
auth: false
}
} else if (phone.trim() == '') {
return {
title: '请填写手机号',
auth: false
}
} else if (address.trim() == '') {
return {
title: '请填写所在地区',
auth: false
}
} else if (addressDetail.trim() == '') {
return {
title: '请填写详细地址',
auth: false
}
} else if (phone.trim() != '') {
if (!this.$utils.verificationPhone(phone)) {
return {
title: '手机号格式不合法',
auth: false
}
}
}
return {
title: '验证通过',
auth: true
}
},
//
selectAddr() {
Position.getLocation(res => {
Position.selectAddress(res.longitude, res.latitude, success => {
this.setAddress(success)
})
})
},
//
setAddress(res) {
//
this.addressDetail.latitude = res.latitude
this.addressDetail.longitude = res.longitude
if (!res.address && res.name) { //
return this.addressDetail.address = res.name
}
if (res.address || res.name) {
return this.addressDetail.address = res.address + res.name
}
this.addressDetail.address = '' //
}
}
}
</script>
@ -355,115 +158,6 @@
.address-list {
padding: 40rpx 20rpx 120rpx 20rpx;
// .address-item {
// background: white;
// border-radius: 20rpx;
// overflow: hidden;
// margin-bottom: 20rpx;
// padding: 15rpx 15rpx 0rpx 15rpx;
// width: 680rpx;
// .address-item-top {
// border-bottom: 1px dashed #D3D1D1;
// display: flex;
// align-items: center;
// padding: 0rpx 0rpx 15rpx 0rpx;
// .img-box {
// width: 120rpx;
// height: 120rpx;
// image {
// width: 75%;
// height: 75%;
// display: block;
// margin: 12.5% auto;
// }
// }
// .address-info {
// width: calc(100% - 120rpx);
// height: 100%;
// display: flex;
// flex-direction: column;
// justify-content: space-between;
// .user-info {
// display: flex;
// align-items: center;
// text {
// display: block;
// line-height: 40rpx;
// margin-right: 20rpx;
// }
// .user-name,
// .user-phone {
// font-size: 30rpx;
// }
// .is-default {
// display: flex;
// align-items: center;
// justify-content: center;
// background: #FEB773;
// color: white;
// width: 80rpx;
// height: 35rpx;
// border-radius: 20rpx;
// font-size: 22rpx;
// }
// }
// .address-detail {
// color: #4a4a4a;
// font-size: 26rpx;
// overflow: hidden;
// display: -webkit-box;
// -webkit-box-orient: vertical;
// -webkit-line-clamp: 2;
// text-overflow: ellipsis;
// }
// }
// }
// .controls {
// display: flex;
// align-items: center;
// justify-content: space-between;
// align-items: center;
// font-size: 26rpx;
// padding: 15rpx 15rpx 25rpx 15rpx;
// .default-checkbox {
// display: flex;
// text {
// margin-left: 8rpx;
// }
// }
// .control-title {
// height: 30rpx;
// line-height: 30rpx;
// color: #666666;
// }
// view {
// display: flex;
// align-items: center;
// }
// image {
// width: 23rpx;
// height: 23rpx;
// vertical-align: middle;
// margin-right: 8rpx;
// }
// }
// }
}
.add-btn {


+ 27
- 12
pages_order/product/productDetail.vue View File

@ -4,21 +4,22 @@
<view class="swipe">
<uv-swiper
:list="productDetail.image.split(',')"
:list="detail.hotelGoodsSkuList"
indicator
keyName="pic"
height="350rpx"></uv-swiper>
</view>
<view class="info">
<view class="title">
桌布租赁
{{ detail.name }}
</view>
<view class="info-line">
<view class="price">
<text>45.9</text>
<text>{{ detail.originalPrice }}</text>
</view>
<view class="num">
已售1000+
已售{{ detail.soldNum }}+
<image src="../static/product/like.png" mode=""></image>
</view>
</view>
@ -59,16 +60,18 @@
<view class="title">
商品详情
</view>
<uv-parse :content="productDetail.content"></uv-parse>
<uv-parse :content="detail.detail"></uv-parse>
</view>
<!-- 分享和租赁按钮 -->
<submit
@submit="$refs.submitUnitSelect.open()"
@submit="handleSubmit"
@share="share"/>
<!-- 选择规格 -->
<submitUnitSelect ref="submitUnitSelect"/>
<submitUnitSelect ref="submitUnitSelect"
v-if="detail.id"
:detail="detail"/>
</view>
</template>
@ -82,14 +85,14 @@
},
data() {
return {
productDetail : {
image : 'https://cdn.uviewui.com/uview/swiper/swiper3.png,https://cdn.uviewui.com/uview/swiper/swiper2.png',
content : '',
}
detail : {},
id : 0,
}
},
onLoad(args) {
console.log(args);
this.id = args.id
this.getData()
},
methods: {
//
@ -99,7 +102,19 @@
//
submit(){
}
},
handleSubmit(){
this.$refs.submitUnitSelect.open()
},
getData(){
this.$api('goodsOne', {
id : this.id
}, res => {
if(res.code == 200){
this.detail = res.result
}
})
},
}
}
</script>


+ 68
- 3
store/store.js View File

@ -4,12 +4,18 @@ import Vuex from 'vuex'
Vue.use(Vuex); //vue的插件机制
import api from '@/api/api.js'
import Position from '@/utils/position.js'
//Vuex.Store 构造器选项
const store = new Vuex.Store({
state: {
configList: [], //配置列表
shop : false
shop : false,
position : {//定位信息
latitude : 0,
longitude : 0,
},
userInfo : {},//用户信息
},
getters: {
// 角色 true为水洗店 false为酒店
@ -20,12 +26,71 @@ const store = new Vuex.Store({
mutations: {
// 初始化配置
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){
state.configList = res.result
state.userInfo = res.result
}
})
},
getPosition(state){
Position.getLocation(res => {
console.log(res);
state.position = res
})
},
},
actions: {},
})


Loading…
Cancel
Save