1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view>
- <u-navbar
- title="停车场列表"
- title-color="#fff"
- :custom-back="customBack"
- :border-bottom="false"
- back-icon-color="#CCE8FF"
- :background="{background: 'linear-gradient(145deg, #41AFF9 0%, #2D8CFB 100%)' }"></u-navbar>
-
- <view class="road-list">
- <view class="road-list-item" v-for="item in Roads" :key="item.id" @click="handleModifyRoad(item.id)">
- <view class="name">{{item.roadName}}</view>
- <view class="position">{{item.roadName}}</view>
- <view class="distance">{{item.roadName}}</view>
- </view>
- </view>
-
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default{
- data(){
- return{
- Roads:[],
- }
- },
- onLoad(){
- this.Roads = this.$store.state.vuex_user?.roadList;
- console.log('Roads',JSON.parse(JSON.stringify(this.Roads)));
- },
- onShow(){
-
- },
- methods:{
- customBack(){
- this.$u.route({
- // type:'switchTab',
- url: 'pages/index/index'
- });
- },
- handleModifyRoad(id){
- this.$u.api.modifyRoad({roadId:id})
- .then(res=>{
- this.$refs.uToast.show({
- title: res.msg,
- type: 'success',
- url: 'pages/index/index'
- });
- let userdata = this.$store.state.vuex_user;
- userdata.roadList = res.data?.roadList;
- this.$u.vuex('vuex_user', res.data);
- uni.setStorageSync('payee_roadinfo', JSON.stringify(userdata.roadList?.[0] || []));
- }).catch(err=>{
- this.$refs.uToast.show({
- title: err.msg,
- type: 'error',
- });
- console.log('modifyRoad ',err)
- });
- }
-
- }
- }
- </script>
- <style lang="scss">
- @import './roadlist.scss'
- </style>
|