123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <template>
- <view class="center">
- <view class="">
- <view class="" v-for="(item,index) in routeData">
- {{item.sendCity ? item.sendCity: item.sendProvince}} {{item.sendArea}} ----> {{item.unloadCity ? item.unloadCity: item.unloadProvince}} {{item.unloadArea}}
- <view class="" @click="addRoute(item)">修改</view>
- <view class="" @click="del(item.id)">删除</view>
- </view>
- </view>
- <view class="">
- <u-button type="primary" @click="addRoute(1)">创建常用路线</u-button>
- </view>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- routeData: []
- }
- },
- onShow() {},
- onLoad() {
- this.getList()
- },
- methods: {
- del(ids) {
- this.$request.baseRequest('post', '/commonRoute/api/delete', {
- id: ids
- }).then(res => {
- if (res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: "删除成功!",
- })
- this.getList()
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- getList() {
- this.$request.baseRequest('get', '/commonRoute/select', {
- commonId: uni.getStorageSync("firstAuthentication").id,
- pageSize: 10,
- currentPage: 1
- }).then(res => {
- if (res.code == 200) {
- this.routeData = res.data.records
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- addRoute(item) {
- if(item == 1 && this.routeData.length == 50){
- this.$refs.uToast.show({
- type: 'success',
- message: "最多可创建50条常用路线!",
- })
- }else{
- uni.$u.route("pages/mine/often/addRoute", {
- id: item.id
- })
- }
-
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|