初始化代码
This commit is contained in:
301
uniapp/uni-app/business/pages/order/detail.vue
Normal file
301
uniapp/uni-app/business/pages/order/detail.vue
Normal file
@@ -0,0 +1,301 @@
|
||||
<template>
|
||||
<view class="business-order-detail" v-if="detail.id">
|
||||
<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" color="#fff"
|
||||
:backgroundColor="scrollTop < 20 ?``:primaryColor" leftIcon="icon-left" title="订单详情">
|
||||
</uni-nav-bar>
|
||||
<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
|
||||
<image mode="aspectFill" lazy-load class="common-bg abs" src="https://lbqny.migugu.com/admin/farm/bg-cash.png">
|
||||
</image>
|
||||
<view class="pl-lg pr-lg c-base" style="height: 120rpx;">
|
||||
<view class="f-sm-title text-bold pt-md">{{statusType[detail.pay_type]}}</view>
|
||||
</view>
|
||||
<view class="order-text-info ml-md mr-md pd-lg fill-base f-paragraph c-title box-shadow radius-24"
|
||||
v-if="detail.send_type == 2">
|
||||
<view @tap.stop="toMap" class="flex-warp">
|
||||
<i class="iconfont icon-dingwei mr-sm" style="font-size: 28rpx;margin-top: 6rpx;"></i>
|
||||
<view class="flex-1">{{`${detail.address_info.address}${detail.address_info.address_info}`}}</view>
|
||||
</view>
|
||||
<view @tap.stop="$util.goUrl({url:detail.address_info.mobile,openType:'call'})"
|
||||
class="flex-y-baseline c-caption" style="margin:5rpx 0 0 38rpx;">{{detail.address_info.user_name}}
|
||||
<view class="ml-lg">
|
||||
{{detail.address_info.mobile}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="order-text-info mt-md ml-md mr-md pl-lg pr-lg fill-base f-paragraph c-title box-shadow radius-24">
|
||||
<view class="flex-between pt-lg pb-lg">
|
||||
<view class="text c-desc">{{detail.send_type == 1 ? '自提时间':'配送时间'}}</view>
|
||||
<view>{{detail.user_send_time}}</view>
|
||||
</view>
|
||||
<view class="pt-lg pb-lg b-1px-t" v-if="detail.text">
|
||||
<view class="text c-desc">备注</view>
|
||||
<view class="mt-sm">
|
||||
<text decode="emsp" style="word-break:break-all;">{{detail.text}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="mt-md ml-md mr-md pd-lg fill-base f-paragraph c-title box-shadow radius-24">
|
||||
<view class="flex-y-center pb-lg b-1px-b">
|
||||
<i class="iconfont icon-dianpu mr-sm"></i>
|
||||
<view class="f-title c-title text-bold ellipsis">{{detail.store_info.title}}</view>
|
||||
</view>
|
||||
<view class="order-item flex-center" :class="[{'mt-lg':index==0},{'mt-md':index!=0}]"
|
||||
v-for="(item,index) in detail.order_goods" :key="index">
|
||||
<image mode="aspectFill" lazy-load class="avatar box-shadow-mini radius-24" :src="item.goods_cover">
|
||||
</image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-paragraph c-title text-bold max-490 ellipsis"> {{item.goods_name}}
|
||||
</view>
|
||||
<view class="f-caption c-title" :class="[{'flex-center':item.refund_num*1>0}]">
|
||||
<view class="ellipsis" :style="{maxWidth:item.refund_num*1>0?'300rpx':'490rpx'}">
|
||||
{{item.spe_name}}
|
||||
</view>
|
||||
<view class="flex-1 c-warning text-right" v-if="item.refund_num*1>0">已退x{{item.refund_num}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-y-baseline mt-sm">
|
||||
<view class="flex-1 f-paragraph c-warning">¥{{item.goods_price}} </view>
|
||||
<view class="f-caption c-caption">x {{item.goods_num}} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-lg pt-lg pb-lg f-paragraph c-title b-1px-tb">
|
||||
<view class="flex-between">
|
||||
<view>商品金额</view>
|
||||
<view>¥{{detail.init_goods_price}}</view>
|
||||
</view>
|
||||
<block v-if="detail.send_type == 2">
|
||||
<view class="flex-between mt-sm">
|
||||
<view>配送费</view>
|
||||
<view>¥{{detail.freight}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="flex-between mt-sm" v-if="detail.kill_discount_price*1>0">
|
||||
<view>秒杀优惠</view>
|
||||
<view class="c-warning">-¥{{detail.kill_discount_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between mt-sm" v-if="detail.integral_discount_price*1>0">
|
||||
<view>积分抵扣</view>
|
||||
<view class="c-warning">-¥{{detail.integral_discount_price}}</view>
|
||||
</view>
|
||||
<view class="flex-between mt-sm" v-if="detail.discount*1>0">
|
||||
<view>卡券优惠</view>
|
||||
<view class="c-warning">-¥{{detail.discount}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="mt-lg f-paragraph c-title flex-between mt-sm">
|
||||
<view>合计</view>
|
||||
<view class="f-title c-warning text-bold">¥{{detail.pay_price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<video class="item-video mt-md ml-md mr-md radius-24" :loop="false" enable-play-gesture enable-progress-gesture
|
||||
:src="detail.video" @timeupdate="onTimeUpdate" @waiting="onWaiting" @progress="onProgress"
|
||||
@loadedmetadata="onLoadedMetaData" v-if="detail.video">
|
||||
</video>
|
||||
|
||||
<view class="order-text-info mt-md ml-md mr-md pd-lg fill-base f-caption c-title box-shadow radius-24">
|
||||
<view class="flex-warp pt-sm">
|
||||
<view class="text c-caption">订单编号</view>
|
||||
<view class="flex-1 flex-y-center">{{detail.order_code}}
|
||||
<view @tap="$util.goUrl( {url:`${detail.order_code}`,openType:'copy'})"
|
||||
class="copy-btn sm flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="detail.send_type == 2">
|
||||
<view class="flex-warp pt-md" v-if="detail.transaction_id">
|
||||
<view class="text c-caption">付款单号</view>
|
||||
<view class="flex-1 flex-y-center">{{detail.transaction_id}}
|
||||
<view @tap="$util.goUrl( {url:`${detail.transaction_id}`,openType:'copy'})"
|
||||
class="copy-btn sm flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-md" v-if="detail.pay_type == -1 && detail.refund_code">
|
||||
<view class="text c-caption">退款单号</view>
|
||||
<view class="flex-1 flex-y-center">{{detail.refund_code}}
|
||||
<view @tap="$util.goUrl( {url:`${detail.refund_code}`,openType:'copy'})"
|
||||
class="copy-btn sm flex-center fill-body" :style="{color:primaryColor}">复制</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="flex-warp pt-md">
|
||||
<view class="text c-caption">下单时间</view>
|
||||
<view class="flex-1">{{detail.create_time}}</view>
|
||||
</view>
|
||||
<block v-if="detail.send_type == 2">
|
||||
<view class="flex-warp pt-md" v-if="detail.pay_time">
|
||||
<view class="text c-caption">支付时间</view>
|
||||
<view class="flex-1">{{detail.pay_time}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-md">
|
||||
<view class="text c-caption">支付方式</view>
|
||||
<view class="flex-1">{{payType[detail.pay_model]}}</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view class="order-text-info mt-md ml-md mr-md pd-lg fill-base f-caption c-title box-shadow radius-24"
|
||||
v-if="detail.pay_type == 7">
|
||||
<view class="flex-warp pt-sm" v-if="detail.hx_time">
|
||||
<view class="text c-caption">收货时间</view>
|
||||
<view class="flex-1">{{detail.hx_time}}</view>
|
||||
</view>
|
||||
<view class="flex-warp pt-md">
|
||||
<view class="text c-caption">收货人</view>
|
||||
<view class="flex-1">{{detail.hx_user_name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="space-max-footer"></view>
|
||||
|
||||
<view class="footer-btn fix fill-base pl-lg pr-lg" v-if="detail.pay_type!=7">
|
||||
<view class="flex-between">
|
||||
<view></view>
|
||||
<view @tap.stop="toTel" class="common-btn flex-center f-caption c-base radius ml-lg"
|
||||
:style="{background:primaryColor}">联系买家
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-safe"></view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapActions,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
scrollTop: 0,
|
||||
options: {},
|
||||
detail: {},
|
||||
payType: {
|
||||
1: '微信支付',
|
||||
2: '余额支付',
|
||||
3: '支付宝支付'
|
||||
},
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
1: '待支付',
|
||||
2: '待发货',
|
||||
3: '已发货',
|
||||
7: '已完成',
|
||||
},
|
||||
sendType: {
|
||||
1: '自提',
|
||||
2: '快递'
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false,
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
haveOperItem: state => state.order.haveOperItem,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.options = options
|
||||
this.$util.showLoading()
|
||||
this.updateOrderItem({
|
||||
key: 'haveOperItem',
|
||||
val: false
|
||||
})
|
||||
this.initIndex()
|
||||
},
|
||||
onUnload() {
|
||||
if (!this.haveOperItem) return
|
||||
this.$util.back()
|
||||
},
|
||||
onPageScroll(e) {
|
||||
this.scrollTop = e.scrollTop
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getConfigInfo']),
|
||||
...mapMutations(['updateOrderItem']),
|
||||
async initIndex() {
|
||||
let {
|
||||
id,
|
||||
} = this.options
|
||||
let data = await this.$api.business.orderInfo({
|
||||
id
|
||||
})
|
||||
this.detail = data
|
||||
this.$util.hideAll()
|
||||
},
|
||||
initRefresh() {
|
||||
this.initIndex()
|
||||
},
|
||||
async toMap() {
|
||||
let {
|
||||
lat,
|
||||
lng,
|
||||
address
|
||||
} = this.detail
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
await uni.getLocation({
|
||||
type: 'gcj02',
|
||||
})
|
||||
await uni.openLocation({
|
||||
latitude: lat * 1,
|
||||
longitude: lng * 1,
|
||||
name: address,
|
||||
scale: 28
|
||||
})
|
||||
},
|
||||
toTel() {
|
||||
let {
|
||||
mobile: url
|
||||
} = this.detail.address_info
|
||||
this.$util.goUrl({
|
||||
url,
|
||||
openType: 'call'
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.business-order-detail {
|
||||
.order-seed-item {
|
||||
.seed-img {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.item-video {
|
||||
width: 710rpx;
|
||||
height: 380rpx;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.footer-btn {
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
|
||||
.flex-between {
|
||||
height: 98rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
211
uniapp/uni-app/business/pages/order/list.vue
Normal file
211
uniapp/uni-app/business/pages/order/list.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<view class="business-order-list" v-if="isLoad">
|
||||
<fixed>
|
||||
<tab @change="handerTabChange" :list="tabList" :activeIndex="activeIndex"
|
||||
:activeColor="primaryColor" :width="100/tabList.length + '%'" height="100rpx"></tab>
|
||||
<view class="b-1px-b"></view>
|
||||
</fixed>
|
||||
<view @tap.stop="goDetail(index)" class="fill-base mt-md ml-md mr-md pd-lg box-shadow-mini radius-16"
|
||||
v-for="(item,index) in list.data" :key="index">
|
||||
<view class="flex-between pb-lg">
|
||||
<view class="f-paragraph c-title"
|
||||
:class="[{'c-warning': item.pay_type < 3 && item.pay_type != -1},{'c-success': item.pay_type == 3}]">
|
||||
{{statusType[item.pay_type]}}
|
||||
</view>
|
||||
<i class="iconfont icon-right"></i>
|
||||
</view>
|
||||
<view class="order-item flex-center" :class="[{'mt-md':aindex!=0}]"
|
||||
v-for="(aitem,aindex) in item.order_goods" :key="aindex">
|
||||
<image mode="aspectFill" lazy-load class="avatar box-shadow-mini radius-24" :src="aitem.goods_cover">
|
||||
</image>
|
||||
<view class="flex-1 ml-lg">
|
||||
<view class="f-paragraph c-title text-bold max-490 ellipsis"> {{aitem.goods_name}}
|
||||
</view>
|
||||
<view class="f-caption c-title" :class="[{'flex-center':aitem.refund_num*1>0}]">
|
||||
<view class="ellipsis" :style="{maxWidth:aitem.refund_num*1>0?'300rpx':'490rpx'}">
|
||||
{{aitem.spe_name}}
|
||||
</view>
|
||||
<view class="flex-1 c-warning text-right" v-if="aitem.refund_num*1>0">已退x{{aitem.refund_num}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-y-baseline mt-sm">
|
||||
<view class="flex-1 f-paragraph c-warning">¥{{aitem.goods_price}} </view>
|
||||
<view class="f-caption c-caption">x {{aitem.goods_num}} </view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between mt-lg pt-md b-1px-t">
|
||||
<view class="c-title ml-sm mr-sm"> {{`共${item.all_goods_num}件`}}</view>
|
||||
<view class="flex-y-baseline f-desc c-title"> 实付:
|
||||
<view class="f-title c-warning">¥{{item.true_price}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-between mt-md" v-if="item.pay_type!=7">
|
||||
<view></view>
|
||||
<view @tap.stop="toTel(index)" class="common-btn flex-center f-caption c-base radius-4 ml-lg"
|
||||
:style="{background:primaryColor}">联系买家
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<load-more :noMore="list.current_page>=list.last_page&&list.data.length>0" :loading="loading" v-if="loading">
|
||||
</load-more>
|
||||
<abnor v-if="!loading&&list.data.length<=0&&list.current_page==1"></abnor>
|
||||
|
||||
<view class="space-footer"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
} from "vuex"
|
||||
export default {
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
isLoad: false,
|
||||
options: {},
|
||||
activeIndex: 0,
|
||||
tabList: [{
|
||||
id: 0,
|
||||
title: '全部'
|
||||
}, {
|
||||
id: 1,
|
||||
title: '待支付',
|
||||
number: 0,
|
||||
key: 'no_pay_count'
|
||||
}, {
|
||||
id: 2,
|
||||
title: '待发货',
|
||||
number: 0,
|
||||
key: 'no_send_count'
|
||||
}, {
|
||||
id: 3,
|
||||
title: '已发货',
|
||||
number: 0,
|
||||
key: 'have_send_count'
|
||||
}, {
|
||||
id: 7,
|
||||
title: '已完成'
|
||||
}],
|
||||
statusType: {
|
||||
'-1': '已取消',
|
||||
1: '待支付',
|
||||
2: '待发货',
|
||||
3: '已发货',
|
||||
7: '已完成',
|
||||
},
|
||||
param: {
|
||||
page: 1,
|
||||
},
|
||||
list: {
|
||||
data: []
|
||||
},
|
||||
loading: true,
|
||||
popupInfo: {},
|
||||
lockTap: false,
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
configInfo: state => state.config.configInfo,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad(options) {
|
||||
this.$util.showLoading()
|
||||
let {
|
||||
tab = 0,
|
||||
} = options
|
||||
this.options = options
|
||||
this.activeIndex = tab
|
||||
this.isLoad = true
|
||||
this.initIndex()
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showNavigationBarLoading()
|
||||
// #endif
|
||||
this.initRefresh()
|
||||
uni.stopPullDownRefresh()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.list.current_page >= this.list.last_page || this.loading) return
|
||||
this.param.page = this.param.page + 1
|
||||
this.loading = true
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
initIndex() {
|
||||
let {
|
||||
expressList
|
||||
} = this.configInfo
|
||||
expressList.map(item => {
|
||||
item.currentCheck = false
|
||||
item.preCheck = false
|
||||
})
|
||||
this.expressList = expressList
|
||||
this.getList()
|
||||
},
|
||||
initRefresh() {
|
||||
this.param.page = 1
|
||||
this.initIndex()
|
||||
},
|
||||
async getList() {
|
||||
let {
|
||||
list: oldList,
|
||||
param,
|
||||
tabList,
|
||||
activeIndex
|
||||
} = this
|
||||
param.pay_type = tabList[activeIndex].id
|
||||
let newList = await this.$api.business
|
||||
.orderList(param)
|
||||
|
||||
if (this.param.page == 1) {
|
||||
this.list = newList
|
||||
} else {
|
||||
newList.data = oldList.data.concat(newList.data)
|
||||
this.list = newList
|
||||
}
|
||||
this.loading = false
|
||||
this.tabList.map((item, index) => {
|
||||
if (!item.key) return
|
||||
this.tabList[index].number = newList[item.key]
|
||||
})
|
||||
this.$util.hideAll()
|
||||
},
|
||||
handerTabChange(index) {
|
||||
this.activeIndex = index
|
||||
this.$util.showLoading()
|
||||
this.param.page = 1
|
||||
this.list.data = []
|
||||
this.getList()
|
||||
},
|
||||
toTel(index) {
|
||||
let {
|
||||
mobile: url
|
||||
} = this.list.data[index].address_info
|
||||
this.$util.goUrl({
|
||||
url,
|
||||
openType: 'call'
|
||||
})
|
||||
},
|
||||
// 订单详情
|
||||
goDetail(index) {
|
||||
let {
|
||||
id
|
||||
} = this.list.data[index]
|
||||
let url = `/business/pages/order/detail?id=${id}`
|
||||
this.$util.goUrl({
|
||||
url
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
</style>
|
||||
295
uniapp/uni-app/business/pages/store-manage.vue
Normal file
295
uniapp/uni-app/business/pages/store-manage.vue
Normal file
@@ -0,0 +1,295 @@
|
||||
<template>
|
||||
<view class="mine-store-manage">
|
||||
<view class="fill-base pl-lg pb-sm flex-between b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">店铺头像</view>
|
||||
</view>
|
||||
<view class="flex-1 flex-between mr-lg">
|
||||
<upload @upload="imgUpload" :imagelist="subForm.cover" imgtype="cover" text="添加封面" :imgsize="1"
|
||||
imgclass="sm">
|
||||
</upload>
|
||||
<view></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fill-base pd-lg flex-between b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">店铺名称</view>
|
||||
</view>
|
||||
<input v-model="subForm.title" type="text" class="item-input flex-1" maxlength="20" placeholder-class="c-placeholder"
|
||||
:placeholder="rule[1].errorMsg" />
|
||||
</view>
|
||||
<view class="fill-base pd-lg flex-between b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">店铺地址</view>
|
||||
</view>
|
||||
<view class="item-input flex-1">
|
||||
<view @tap.stop="toChooseLocation" class="flex-y-center">
|
||||
<view class="flex-1" :class="[{'c-placeholder':!subForm.address},{'c-title':subForm.address}]">
|
||||
{{subForm.address || `点击右边图标设置`}}
|
||||
</view><i class="iconfont icon-dingwei ml-sm" :style="{color:primaryColor}"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="fill-base pd-lg">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">店铺描述</view>
|
||||
</view>
|
||||
<textarea v-model="subForm.desc" type="text" class="item-textarea mt-md flex-1" maxlength="200"
|
||||
placeholder-class="c-placeholder" :placeholder="rule[3].errorMsg"></textarea>
|
||||
</view>
|
||||
<view class="fill-base mt-md pd-lg flex-between b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">姓名</view>
|
||||
</view>
|
||||
<input v-model="subForm.user_name" type="text" class="item-input flex-1" placeholder-class="c-placeholder"
|
||||
:placeholder="rule[4].errorMsg" />
|
||||
</view>
|
||||
<view class="fill-base mt-md pd-lg flex-between b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">联系电话</view>
|
||||
</view>
|
||||
<input v-model="subForm.mobile" type="number" class="item-input flex-1" placeholder-class="c-placeholder"
|
||||
:placeholder="rule[5].errorMsg" />
|
||||
</view>
|
||||
<!-- <view class="fill-base pd-lg flex-between b-1px-b">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">开店时间</view>
|
||||
</view>
|
||||
<view class="flex-y-center f-paragraph c-title flex-1">
|
||||
<view @tap.stop="toShowTime('start_time')" :style="{color:subForm.start_time ? primaryColor : '#999'}">
|
||||
{{subForm.start_time || '选择开始时间'}}
|
||||
</view>
|
||||
<view class="ml-md mr-md">至</view>
|
||||
<view @tap.stop="toShowTime('end_time')" :style="{color:subForm.end_time ? primaryColor : '#999'}">
|
||||
{{subForm.end_time || '选择结束时间'}}
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="fill-base pd-lg flex-between">
|
||||
<view class="flex-y-center">
|
||||
<i class="iconfont icon-required c-warning"></i>
|
||||
<view class="item-text">是否营业</view>
|
||||
</view>
|
||||
<view class="flex-1 flex-between">
|
||||
<view class="f-desc">{{workType[subForm.business_status]}}</view>
|
||||
<view @tap.stop="toChangeItem('business_status')">
|
||||
<i class="iconfont icon-switch c-caption ml-sm"
|
||||
:class="[{'icon-switch-on':subForm.business_status==1}]"
|
||||
:style="{ color: subForm.business_status==1 ? primaryColor : ''}"></i>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="space-max-footer"></view>
|
||||
<w-picker :visible.sync="showTime" mode="time" :value="toDayTime" :current="false" :second="false"
|
||||
:themeColor="primaryColor" @confirm="onConfirm" ref="time"></w-picker>
|
||||
|
||||
<fix-bottom-button @confirm="submit" :text="[{text:'保存',type:'confirm'}]" bgColor="#fff"></fix-bottom-button>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapMutations
|
||||
} from "vuex"
|
||||
import wPicker from "@/components/w-picker/w-picker.vue";
|
||||
export default {
|
||||
components: {
|
||||
wPicker
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
toDay: '',
|
||||
toDayTime: '',
|
||||
showKey: '',
|
||||
showTime: false,
|
||||
workType: {
|
||||
0: '休息',
|
||||
1: '营业',
|
||||
},
|
||||
subForm: {
|
||||
id: 0,
|
||||
cover: [],
|
||||
title: '',
|
||||
address: '',
|
||||
lat: '',
|
||||
lng: '',
|
||||
desc: '',
|
||||
user_name: '',
|
||||
mobile: '',
|
||||
start_time: '',
|
||||
end_time: '',
|
||||
business_status: 0,
|
||||
},
|
||||
rule: [{
|
||||
name: "cover",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请上传店铺头像"
|
||||
}, {
|
||||
name: "title",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请输入店铺名称",
|
||||
regType: 2
|
||||
}, {
|
||||
name: "address",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请设置店铺地址"
|
||||
}, {
|
||||
name: "desc",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请输入店铺描述",
|
||||
regType: 2
|
||||
}, {
|
||||
name: "user_name",
|
||||
checkType: "isNotNull",
|
||||
errorMsg: "请输入您的姓名",
|
||||
regType: 2
|
||||
}, {
|
||||
name: "mobile",
|
||||
checkType: "isAllPhone",
|
||||
errorMsg: "请输入联系电话",
|
||||
regText: "联系电话"
|
||||
}],
|
||||
lockTap: false
|
||||
}
|
||||
},
|
||||
computed: mapState({
|
||||
primaryColor: state => state.config.configInfo.primaryColor,
|
||||
subColor: state => state.config.configInfo.subColor,
|
||||
userInfo: state => state.user.userInfo,
|
||||
}),
|
||||
onLoad() {
|
||||
this.initIndex()
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['updateUserItem']),
|
||||
async initIndex() {
|
||||
let cur_time = new Date(Math.ceil(new Date().getTime()))
|
||||
this.toDay = this.$util.formatTime(cur_time, 'YY-M-D')
|
||||
this.toDayTime = this.$util.formatTime(cur_time, 'h:m')
|
||||
let data = await this.$api.business.storeInfo()
|
||||
data.cover = data.cover && data.cover.length > 0 ? [{
|
||||
path: data.cover
|
||||
}] : []
|
||||
for (let key in this.subForm) {
|
||||
this.subForm[key] = data[key] == null ? '' : data[key]
|
||||
}
|
||||
},
|
||||
imgUpload(e) {
|
||||
let {
|
||||
imagelist,
|
||||
imgtype
|
||||
} = e;
|
||||
this.subForm[imgtype] = imagelist;
|
||||
},
|
||||
// 选择地区
|
||||
async toChooseLocation(e) {
|
||||
await this.$util.checkAuth({
|
||||
type: 'userLocation'
|
||||
})
|
||||
let [, {
|
||||
address = '',
|
||||
longitude,
|
||||
latitude
|
||||
} = {}] = await uni.chooseLocation();
|
||||
if (!address) return
|
||||
this.subForm.address = address
|
||||
this.subForm.lng = longitude
|
||||
this.subForm.lat = latitude
|
||||
},
|
||||
toChangeItem(key) {
|
||||
this.subForm[key] = this.subForm[key] == 1 ? 0 : 1
|
||||
},
|
||||
toShowTime(key) {
|
||||
this.showKey = key
|
||||
this.showTime = true
|
||||
},
|
||||
onConfirm(val) {
|
||||
this.subForm[this.showKey] = val.result;
|
||||
},
|
||||
//表单验证
|
||||
validate(param) {
|
||||
let validate = new this.$util.Validate();
|
||||
this.rule.map(item => {
|
||||
let {
|
||||
name,
|
||||
} = item
|
||||
validate.add(param[name], item);
|
||||
})
|
||||
let message = validate.start();
|
||||
console.log(message, "message");
|
||||
return message;
|
||||
},
|
||||
async submit() {
|
||||
let param = this.$util.deepCopy(this.subForm)
|
||||
let msg = this.validate(param);
|
||||
if (msg) {
|
||||
this.$util.showToast({
|
||||
title: msg
|
||||
})
|
||||
return
|
||||
}
|
||||
param.cover = param.cover.length > 0 ? param.cover[0].path : ''
|
||||
// if (!param.start_time || !param.end_time) {
|
||||
// this.$util.showToast({
|
||||
// title: !param.start_time ? `请选择开始时间` : `请选择结束时间`
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
// let start_time = `${this.toDay} ${param.start_time}`
|
||||
// let end_time = `${this.toDay} ${param.end_time}`
|
||||
// if (this.$util.DateToUnix(start_time) > this.$util.DateToUnix(end_time) - 1) {
|
||||
// this.$util.showToast({
|
||||
// title: `结束时间不能小于或等于开始时间`
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
await this.$api.business.storeUpdate(param)
|
||||
this.$util.showToast({
|
||||
title: `保存成功`
|
||||
});
|
||||
setTimeout(() => {
|
||||
this.$util.back()
|
||||
this.$util.goUrl({
|
||||
url: 1,
|
||||
openType: `navigateBack`
|
||||
})
|
||||
}, 1000)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss">
|
||||
.mine-store-manage {
|
||||
.item-text {
|
||||
width: 200rpx;
|
||||
}
|
||||
|
||||
.item-textarea {
|
||||
width: 690rpx;
|
||||
height: 300rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.icon-dingwei {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.icon-switch,
|
||||
.icon-switch-on {
|
||||
font-size: 80rpx;
|
||||
line-height: 34rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user