123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 |
- <template>
- <view>
- <view class="btnS">
- <view style="width: 90%;">
- <u-search :clearabled="true" shape="round" :showAction="false" v-model="seaName"
- @search="searchClick"></u-search>
- </view>
- </view>
- <view class="contain" style="margin: 10px 0;" v-for="(item, index) in tableData" :key="index">
- <view class="box" :class="{ 'boxed-border': item.defaultState == 2 }">
- <view class="container" @click="carList(item)">
- <view class="text-container">
- <view class="flex-item">{{item.name ? item.name : '无' }}</view>
- <u-tag plain :text="item.openState ? '营业中' : '离线'" :type="item.openState ? 'success' : 'error'"
- size="mini"></u-tag>
- </view>
- </view>
- <view class="icon-container">
- <u-icon name="phone" size="28" @click.stop="call"></u-icon>
- <u-icon style="margin-left: 10px;" name="info-circle" size="28" @click.stop="btnIC(item)"></u-icon>
- </view>
- <view :class="{ 'btnbor': item.defaultState==2 }" v-if="item.defaultState==2">
- <!-- <u-tag text="当前" bgColor='#FF6D20' borderColor='#FF6D20' icon="checkmark-circle"></u-tag> -->
- <image src="../../static/danqian.png" class="img-ding"></image>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- seaName: '',
- orderinfo: {},
- tableData: [{
- name: '23333',
- tags: 1,
- showBorder: true,
- },
- {
- name: '门店',
- tags: 1,
- showBorder: false,
- },
- {
- name: '店家',
- tags: 1,
- showBorder: false,
- }
- ],
- page: {
- pageNum: 1,
- pageSize: 20,
- total: 0,
- totalPage: 0
- },
- status: 'loading'
- }
- },
- created() {
- this.fatchDate()
- },
- methods: {
- searchClick(e) {
- this.seaName = e
- this.fatchDate()
- console.log('==============================', e)
- },
- call() {
- if (this.tableData.customerPhone) {
- uni.makePhoneCall({
- phoneNumber: this.tableData.customerPhone
- });
- } else {
- uni.showToast({
- icon: 'none',
- title: '暂无商家电话'
- })
- }
- },
- btnIC(e) {
- console.log('e=================', e)
- uni.navigateTo({
- url: `/pages/diningCar/diningCar?id=${e.id}`
- })
- },
- carList(e) {
- const carl = {
- id: e.id,
- customerPhone: e.customerPhone,
- name: e.name,
- openState: e.openState
- }
- uni.setStorageSync("carl", carl)
- console.log('---------------------', carl)
- uni.navigateTo({
- url: `/pages/classify/classify`
- })
- },
- async fatchDate() {
- var queryParams = {
- "pageSize": this.page.pageSize,
- "pageNum": this.page.pageNum,
- "name": this.seaName
- }
- try {
- const response = await this.$request('post', '/sale/diningCar/queryDiningCar', queryParams);
- console.log('response', response)
- const data = response.rows; // 假设 res.rows 是一个数组
- console.log('response.rows', response.rows);
- if (response.code === 200) {
- const li = data;
- if (this.page.pageNum === 1) {
- this.tableData = li;
- } else {
- this.tableData = this.tableData.concat(li);
- }
- this.page.total = data.count;
- this.page.totalPage = Math.ceil(data.count / this.page.pageSize);
- this.status = this.page.totalPage === 0 || this.page.totalPage === this.page.pageNum ?
- 'noMore' : 'more';
- } else {
- //this.$toast(data.msg);
- }
- } catch (err) {
- console.error('请求异常', err);
- }
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .box {
- padding: 20rpx 20rpx 0;
- height: 80px;
- border-bottom-left-radius: 30rpx;
- border-bottom-right-radius: 30rpx;
- background-position: top;
- box-shadow: 0 0 5px 2px #ebebeb;
- background-repeat: no-repeat;
- border-radius: 20rpx;
- background-color: #fff;
- .btnbor {
- position: absolute;
- /* 设置为绝对定位 */
- right: 16px;
- /* 相对于父元素的右边缘 */
- bottom: 30px;
- /* 相对于父元素的下边缘 */
- margin: 0;
- /* 清除 margin 属性 */
- padding: 0;
- /* 清除 padding 属性 */
- &::after {
- content: '';
- display: block;
- width: 100%;
- height: 100%;
- border: 1px solid #FF6D20;
- border-radius: 20rpx;
- position: absolute;
- top: 0;
- right: 0;
- background-color: #fff;
- z-index: -1;
- /* 使边框在图片下面 */
- }
- }
- }
- .boxed-border {
- border: 1px solid #FF6D20;
- /* 边框样式 */
- padding: 20rpx 20rpx 0;
- border-radius: 20rpx;
- /* 添加圆角 */
- // .btnbor {
- // margin-right: -11px;
- // margin-top: -15px;
- // float: right;
- // }
- }
- .box:hover {
- border: 1px solid #FF6D20;
- /* 鼠标悬停时显示边框 */
- }
- .box:active {
- border: 1px solid #F54319;
- /* 鼠标按下时显示另一种边框颜色 */
- }
- .container {
- display: flex;
- /* 使用 Flexbox 布局 */
- justify-content: space-between;
- /* 子元素之间留有空白 */
- }
- .text-container {
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- /* 左对齐 */
- }
- .flex-item {
- margin-bottom: 10px;
- }
- .tag-item {
- margin-left: auto;
- /* 将标签推到右边 */
- }
- .icon-container {
- display: flex;
- /* 使用 Flexbox 布局 */
- flex-direction: row;
- /* 水平排列子元素 */
- justify-content: flex-end;
- /* 子元素右对齐 */
- margin-top: -55px;
- right: 0;
- bottom: 0;
- gap: 10px;
- /* 设置图标之间的距离 */
- }
- .img-ding {
- width: 83px;
- height: 30px;
- position: absolute;
- right: 0;
- top: 0;
- margin: 0; // 清除 margin 属性,以避免与边框重叠
- }
- .btnS {
- display: flex;
- justify-content: center;
- align-items: center;
- margin-top: 5px;
- }
- </style>
|