123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- <template>
- <view class="center">
- <view class="route">
- <view v-for="(item,index) in routeData" class="route_css">
- <view class="route_site flex">
- <span class="blueDot dot"></span>
- <view class="site_text">
- <!-- {{item.sendProvince}} -->{{item.sendCity ? item.sendCity: item.sendProvince}}
- {{item.sendArea}}
- </view>
- <!-- {{item.sendCity ? item.sendCity: item.sendProvince}} {{item.sendArea}} -->
- <image class="jt_css" src="@/static/images/goodSource/jt.png" mode='widthFix'></image>
- <span class="redDot dot"></span>
- <view class="site_text">
- <!-- {{item.unloadProvince}} -->{{item.unloadCity ? item.unloadCity: item.unloadProvince}}
- {{item.unloadArea}}
- </view>
- </view>
- <view class="flex btns">
- <view class="btn_css" @click="addRoute(item)">修改</view>
- <view class="btn_css" @click="del(item.id)">删除</view>
- <view class="btn_css" @click="showChane(item)">{{item.displayFlag == 1?"显示中":"已隐藏"}}</view>
- </view>
- </view>
- <u-loadmore :status="status" :nomore-text="nomoreText" />
- </view>
- <u-toast ref="uToast"></u-toast>
- <u-modal :show="tipsShow" :title="tipsText" :closeOnClickOverlay='true' :showCancelButton='true'
- confirmColor='#2772FB' @confirm="delSubmit" @close="cancelClick" @cancel="cancelClick"></u-modal>
- <view class="bottom_add">
- <view class="add_btn" @click="addRoute(1)">添加常用路线</view>
- <span class="tips">最多可创建50条</span>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- routeData: [],
- status: 'loadmore',
- nomoreText: '实在没有了~',
- tipsShow: false,
- tipsText: "",
- delId: "",
- }
- },
- onShow() {},
- onLoad() {
- this.getList()
- },
- onNavigationBarButtonTap(e) {
- this.addRoute(1)
- },
- methods: {
- delSubmit() {
- this.$request.baseRequest('post', '/commonRoute/api/delete', {
- id: this.delId
- }).then(res => {
- if (res.code == 200) {
- this.$refs.uToast.show({
- type: 'success',
- message: "删除成功!",
- })
- this.tipsShow = false
- this.getList()
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- del(ids) {
- this.tipsText = "确定删除改常用路线?"
- this.tipsShow = true
- this.delId = ids
- },
- cancelClick() {
- this.tipsShow = false
- },
- getList() {
- this.status = 'loading';
- this.$request.baseRequest('get', '/commonRoute/select', {
- commonId: uni.getStorageSync("firstAuthentication").commonId,
- pageSize: 10,
- currentPage: 1
- }).then(res => {
- if (res.code == 200) {
- this.routeData = res.data.records
- if (res.data.total == 0) {
- this.status = 'nomore'
- } else {
- this.status = 'loadmore'
- }
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- },
- showChane(item) {
- if (item.displayFlag == 1) {
- item.displayFlag = 2
- } else {
- item.displayFlag = 1
- }
- this.$request.baseRequest('post', '/commonRoute/api/edit', item).then(res => {
- if (res.code == 200) {
- if (item.displayFlag == 1) {
- this.$refs.uToast.show({
- type: 'success',
- message: "路线展示中!",
- })
- } else {
- this.$refs.uToast.show({
- type: 'success',
- message: "路线已隐藏!",
- })
- }
- }
- })
- .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>
- .center {
- height: calc(100vh - 25vh);
- padding: 30rpx 30rpx 200rpx;
- background: #F2F4F7;
- position: flex;
- position: relative;
- }
- .route {
- .route_css {
- background: #FFFFFF;
- margin-bottom: 40rpx;
- padding: 30rpx 50rpx;
- border-radius: 20rpx;
- .route_site {
- border-bottom: 1px solid #E6E6E6;
- height: 120rpx;
- .site_text {
- // width: 180rpx;
- max-width: 200rpx;
- overflow: hidden;
- // height: 60rpx;
- text-overflow: ellipsis;
- white-space: nowrap;
- font-size: 32rpx;
- // font-weight: 500;
- // margin: 0 20rpx;
- }
- }
- .jt_css {
- width: 60rpx;
- height: 20rpx;
- margin: 0 23rpx;
- }
- .dot {
- display: inline-block;
- width: 12rpx;
- height: 12rpx;
- border-radius: 6rpx;
- margin: 20rpx 20rpx 0 0;
- }
- .blueDot {
- background: #2772FB;
- }
- .redDot {
- background: #FE6300;
- }
- .btns {
- width: 100%;
- justify-content: flex-end;
- margin-top: 40rpx;
- }
- .btn_css {
- margin-left: 30rpx;
- width: 120rpx;
- height: 66rpx;
- border-radius: 33px;
- border: 1px solid #CDCDCD;
- line-height: 66rpx;
- text-align: center;
- }
- }
- }
- .bottom_add {
- position: fixed;
- left: 0;
- bottom: 0;
- width: 100%;
- height: 160rpx;
- padding-top: 30rpx;
- background: #FFFFFF;
- text-align: center;
- .add_btn {
- width: 90%;
- height: 70rpx;
- line-height: 70rpx;
- background: #2772FB;
- text-align: center;
- border-radius: 35rpx;
- color: #FFFFFF;
- margin-top: 30rpx;
- // height: 60rpx;
- margin: 0 auto;
- }
- .tips {
- text-align: center;
- color: #ABABAB;
- font-size: 24rpx;
- }
- }
- </style>
|