| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <template>
- <view class="content">
- <view class="supplyList">
- <view
- class="supplyCard"
- v-for="(field, i) in fieldList"
- :key="i"
- @tap="toDetail(field.id)"
- >
- <view class="image_content">
- <image :src="field.pic_path ? shareUrl + field.pic_path : '/static/nodata.svg'" mode="aspectFill" />
- </view>
- <view class="info">
- <view class="title">
- {{ field.name }}
- </view>
- <view class="time">
- <view style="margin-bottom: 10rpx;">
- <view>开放时间</view>
- <view style="margin-top: 6rpx;">{{field.open_days}}:{{field.open_hours}}</view>
- </view>
- <view class="field-btn-box">
- <button :class="{
- close: field.order_status == '今日未开放',
- free: field.order_status == '空闲',
- full: field.order_status == '今日已满',
- can: field.order_status == '今日可约',}">
- {{field.order_status}}</button>
- <!-- <button style="background: #00a8ea;" :disabled="field.order_status == '今日已满' || field.order_status == '未开放'">前往预约</button> -->
- <button style="background: #00a8ea;font-weight: bolder;color:#ffffff">前往预约</button>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import md5 from "@/common/md5.js";
- export default {
- data() {
- return {
- fieldList: [],
- shareUrl:getApp().globalData.shareUrl,
- };
- },
- onLoad() {
- this.getMyList();
- },
- methods: {
- toDetail(index) {
- uni.navigateTo({
- url: "/pages/makeField/viewDetail?id=" + index,
- });
- },
- getMyList() {
- let md5Sign = md5(
- "method=" +
- "area" +
- "×tamp=" +
- getApp().globalData.globalTimestamp +
- "&secret=" +
- getApp().globalData.secret
- );
- let url =
- getApp().globalData.shareUrl +
- "api/api.php" +
- "?method=area&source=area&action=list×tamp=" +
- getApp().globalData.globalTimestamp +
- "&sign=" +
- md5Sign;
- uni.request({
- url: url,
- method: "POST",
- header: {
- "content-type": "application/x-www-form-urlencoded",
- },
- data: {
- // method:'area',
- page:'',
- page_size :''
- },
- success: (res) => {
- if (res.data.code === 200) {
- let list = res.data.data.list;
- // list.forEach((item,index)=>{
- // item.statusName = '空闲'
- // })
- // list[1].statusName = '今日已满';
- // list[2].statusName = '今日可约';
- this.fieldList = list;
- }
- },
- fail: () => {
- console.log("连接失败");
- },
- });
- },
- },
- };
- </script>
- <style lang="scss" scope>
- .active {
- color: $uni-color-primary;
- }
- .content {
- font-size: 32rpx;
- margin: 0 5%;
- .supplyList {
- .supplyCard {
- display: flex;
- width: 92%;
- margin: 3% 0;
- padding: 2% 4%;
- height: 5%;
- border-radius: 30rpx;
- box-shadow: rgba(100, 100, 111, 0.2) 0rpx 14rpx 50rpx 0rpx;
- .image_content {
- margin-right: 5%;
- display: flex;
- align-items: center;
- image {
- width: 300rpx;
- height: 265rpx;
- object-fit: cover;
- border-radius: 6rpx;
- background-color: #e4e4e4;
- }
- }
- .info {
- width: 100%;
- display: flex;
- flex-flow: column;
- justify-content: space-between;
- // justify-content: space-around;
- .title {
- width: 100%;
- text-overflow: -o-ellipsis-lastline;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- line-clamp: 2;
- -webkit-box-orient: vertical;
- font-size: 32rpx;
- }
- .time {
- font-weight: 300;
- font-size: 24rpx;
- color: #7f7f7f;
- height: 60%;
- display: flex;
- flex-direction: column;
- justify-content: space-around;
- // margin-top: 20rpx;
- .field-btn-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- button{
- background: #95f204;
- color: #fff;
- font-size: 18rpx;
- margin: 0;
- };
- .close {
- background: #7f7f7f;
- font-weight: bolder;
- };
- .free {
- background: #75e2a8;
- font-weight: bolder;
- };
- .full {
- background: #f59a23;
- font-weight: bolder;
- }
- .can {
- background: #94a8ff;
- font-weight: bolder;
- }
- }
- }
- }
- }
- }
- }
- </style>
|