diningList.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. <template>
  2. <view>
  3. <view class="btnS">
  4. <view style="width: 90%;">
  5. <u-search :clearabled="true" shape="round" :showAction="false" v-model="seaName"
  6. @search="searchClick"></u-search>
  7. </view>
  8. </view>
  9. <view class="contain" style="margin: 10px 0;" v-for="(item, index) in tableData" :key="index">
  10. <view class="box" :class="{ 'boxed-border': item.defaultState == 2 }">
  11. <view class="container" @click="carList">
  12. <view class="text-container">
  13. <view class="flex-item">{{item.name ? item.name : '无' }}</view>
  14. <u-tag plain :text="item.openState ? '营业中' : '离线'" :type="item.openState ? 'success' : 'error'"
  15. size="mini"></u-tag>
  16. </view>
  17. </view>
  18. <view class="icon-container">
  19. <u-icon name="phone" size="28" @click.stop="call"></u-icon>
  20. <u-icon style="margin-left: 10px;" name="info-circle" size="28" @click.stop="btnIC(item)"></u-icon>
  21. </view>
  22. <view :class="{ 'btnbor': item.defaultState==2 }" v-if="item.defaultState==2">
  23. <!-- <u-tag text="当前" bgColor='#FF6D20' borderColor='#FF6D20' icon="checkmark-circle"></u-tag> -->
  24. <image src="../../static/danqian.png" class="img-ding"></image>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. seaName: '',
  35. orderinfo: {},
  36. tableData: [{
  37. name: '23333',
  38. tags: 1,
  39. showBorder: true,
  40. },
  41. {
  42. name: '门店',
  43. tags: 1,
  44. showBorder: false,
  45. },
  46. {
  47. name: '店家',
  48. tags: 1,
  49. showBorder: false,
  50. }
  51. ],
  52. page: {
  53. pageNum: 1,
  54. pageSize: 20,
  55. total: 0,
  56. totalPage: 0
  57. },
  58. status: 'loading'
  59. }
  60. },
  61. created() {
  62. this.fatchDate()
  63. },
  64. methods: {
  65. searchClick(e) {
  66. this.seaName = e
  67. this.fatchDate()
  68. console.log('==============================', e)
  69. },
  70. async call() {
  71. const query = {
  72. id: this.tableData.customerId
  73. }
  74. const response = await this.$request('post', '/sale/customer/queryCustomerById', query);
  75. if (this.orderinfo.shopCall) {
  76. uni.makePhoneCall({
  77. phoneNumber: this.orderinfo.shopCall
  78. });
  79. } else {
  80. uni.showToast({
  81. icon: 'none',
  82. title: '暂无商家电话'
  83. })
  84. }
  85. },
  86. btnIC(e) {
  87. console.log('e=================', e)
  88. uni.navigateTo({
  89. url: `/pages/diningCar/diningCar?id=${e.id}`
  90. })
  91. },
  92. carList() {
  93. uni.navigateTo({
  94. url: `/pages/classify/classify`
  95. })
  96. },
  97. async fatchDate() {
  98. var queryParams = {
  99. "pageSize": this.page.pageSize,
  100. "pageNum": this.page.pageNum,
  101. "name": this.seaName
  102. }
  103. try {
  104. const response = await this.$request('post', '/sale/diningCar/queryDiningCar', queryParams);
  105. console.log('response', response)
  106. const data = response.rows; // 假设 res.rows 是一个数组
  107. console.log('response.rows', response.rows);
  108. if (response.code === 200) {
  109. const li = data;
  110. if (this.page.pageNum === 1) {
  111. this.tableData = li;
  112. } else {
  113. this.tableData = this.tableData.concat(li);
  114. }
  115. this.page.total = data.count;
  116. this.page.totalPage = Math.ceil(data.count / this.page.pageSize);
  117. this.status = this.page.totalPage === 0 || this.page.totalPage === this.page.pageNum ?
  118. 'noMore' : 'more';
  119. } else {
  120. //this.$toast(data.msg);
  121. }
  122. } catch (err) {
  123. console.error('请求异常', err);
  124. }
  125. }
  126. }
  127. }
  128. </script>
  129. <style scoped lang="scss">
  130. .box {
  131. padding: 20rpx 20rpx 0;
  132. height: 80px;
  133. border-bottom-left-radius: 30rpx;
  134. border-bottom-right-radius: 30rpx;
  135. background-position: top;
  136. box-shadow: 0 0 5px 2px #ebebeb;
  137. background-repeat: no-repeat;
  138. border-radius: 20rpx;
  139. background-color: #fff;
  140. .btnbor {
  141. margin: -32rpx -20rpx 0;
  142. // margin-right: -11px;
  143. margin-top: 12px;
  144. float: right;
  145. position: relative; // 设置为相对定位
  146. &::after {
  147. content: '';
  148. display: block;
  149. width: 100%;
  150. height: 100%;
  151. border: 1px solid #FF6D20;
  152. border-radius: 20rpx;
  153. position: absolute;
  154. top: 0;
  155. right: 0;
  156. background-color: #fff;
  157. z-index: -1; // 使边框在图片下面
  158. }
  159. }
  160. }
  161. .boxed-border {
  162. border: 1px solid #FF6D20;
  163. /* 边框样式 */
  164. padding: 20rpx 20rpx 0;
  165. border-radius: 20rpx;
  166. /* 添加圆角 */
  167. // .btnbor {
  168. // margin-right: -11px;
  169. // margin-top: -15px;
  170. // float: right;
  171. // }
  172. }
  173. .box:hover {
  174. border: 1px solid #FF6D20;
  175. /* 鼠标悬停时显示边框 */
  176. }
  177. .box:active {
  178. border: 1px solid #F54319;
  179. /* 鼠标按下时显示另一种边框颜色 */
  180. }
  181. .container {
  182. display: flex;
  183. /* 使用 Flexbox 布局 */
  184. justify-content: space-between;
  185. /* 子元素之间留有空白 */
  186. }
  187. .text-container {
  188. display: flex;
  189. flex-direction: column;
  190. align-items: flex-start;
  191. /* 左对齐 */
  192. }
  193. .flex-item {
  194. margin-bottom: 10px;
  195. }
  196. .tag-item {
  197. margin-left: auto;
  198. /* 将标签推到右边 */
  199. }
  200. .icon-container {
  201. display: flex;
  202. /* 使用 Flexbox 布局 */
  203. flex-direction: row;
  204. /* 水平排列子元素 */
  205. justify-content: flex-end;
  206. /* 子元素右对齐 */
  207. margin-top: -55px;
  208. right: 0;
  209. bottom: 0;
  210. gap: 10px;
  211. /* 设置图标之间的距离 */
  212. }
  213. .img-ding {
  214. width: 83px;
  215. height: 30px;
  216. position: absolute;
  217. right: 0;
  218. top: 0;
  219. margin: 0; // 清除 margin 属性,以避免与边框重叠
  220. }
  221. .btnS {
  222. display: flex;
  223. justify-content: center;
  224. align-items: center;
  225. margin-top: 5px;
  226. }
  227. </style>