diningList.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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(item)">
  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. call() {
  71. if (this.tableData.customerPhone) {
  72. uni.makePhoneCall({
  73. phoneNumber: this.tableData.customerPhone
  74. });
  75. } else {
  76. uni.showToast({
  77. icon: 'none',
  78. title: '暂无商家电话'
  79. })
  80. }
  81. },
  82. btnIC(e) {
  83. console.log('e=================', e)
  84. uni.navigateTo({
  85. url: `/pages/diningCar/diningCar?id=${e.id}`
  86. })
  87. },
  88. carList(e) {
  89. const carl = {
  90. id: e.id,
  91. customerPhone: e.customerPhone,
  92. name: e.name,
  93. openState: e.openState
  94. }
  95. uni.setStorageSync("carl", carl)
  96. console.log('---------------------', carl)
  97. uni.navigateTo({
  98. url: `/pages/classify/classify`
  99. })
  100. },
  101. async fatchDate() {
  102. var queryParams = {
  103. "pageSize": this.page.pageSize,
  104. "pageNum": this.page.pageNum,
  105. "name": this.seaName
  106. }
  107. try {
  108. const response = await this.$request('post', '/sale/diningCar/queryDiningCar', queryParams);
  109. console.log('response', response)
  110. const data = response.rows; // 假设 res.rows 是一个数组
  111. console.log('response.rows', response.rows);
  112. if (response.code === 200) {
  113. const li = data;
  114. if (this.page.pageNum === 1) {
  115. this.tableData = li;
  116. } else {
  117. this.tableData = this.tableData.concat(li);
  118. }
  119. this.page.total = data.count;
  120. this.page.totalPage = Math.ceil(data.count / this.page.pageSize);
  121. this.status = this.page.totalPage === 0 || this.page.totalPage === this.page.pageNum ?
  122. 'noMore' : 'more';
  123. } else {
  124. //this.$toast(data.msg);
  125. }
  126. } catch (err) {
  127. console.error('请求异常', err);
  128. }
  129. }
  130. }
  131. }
  132. </script>
  133. <style scoped lang="scss">
  134. .box {
  135. padding: 20rpx 20rpx 0;
  136. height: 80px;
  137. border-bottom-left-radius: 30rpx;
  138. border-bottom-right-radius: 30rpx;
  139. background-position: top;
  140. box-shadow: 0 0 5px 2px #ebebeb;
  141. background-repeat: no-repeat;
  142. border-radius: 20rpx;
  143. background-color: #fff;
  144. .btnbor {
  145. position: absolute;
  146. /* 设置为绝对定位 */
  147. right: 16px;
  148. /* 相对于父元素的右边缘 */
  149. bottom: 30px;
  150. /* 相对于父元素的下边缘 */
  151. margin: 0;
  152. /* 清除 margin 属性 */
  153. padding: 0;
  154. /* 清除 padding 属性 */
  155. &::after {
  156. content: '';
  157. display: block;
  158. width: 100%;
  159. height: 100%;
  160. border: 1px solid #FF6D20;
  161. border-radius: 20rpx;
  162. position: absolute;
  163. top: 0;
  164. right: 0;
  165. background-color: #fff;
  166. z-index: -1;
  167. /* 使边框在图片下面 */
  168. }
  169. }
  170. }
  171. .boxed-border {
  172. border: 1px solid #FF6D20;
  173. /* 边框样式 */
  174. padding: 20rpx 20rpx 0;
  175. border-radius: 20rpx;
  176. /* 添加圆角 */
  177. // .btnbor {
  178. // margin-right: -11px;
  179. // margin-top: -15px;
  180. // float: right;
  181. // }
  182. }
  183. .box:hover {
  184. border: 1px solid #FF6D20;
  185. /* 鼠标悬停时显示边框 */
  186. }
  187. .box:active {
  188. border: 1px solid #F54319;
  189. /* 鼠标按下时显示另一种边框颜色 */
  190. }
  191. .container {
  192. display: flex;
  193. /* 使用 Flexbox 布局 */
  194. justify-content: space-between;
  195. /* 子元素之间留有空白 */
  196. }
  197. .text-container {
  198. display: flex;
  199. flex-direction: column;
  200. align-items: flex-start;
  201. /* 左对齐 */
  202. }
  203. .flex-item {
  204. margin-bottom: 10px;
  205. }
  206. .tag-item {
  207. margin-left: auto;
  208. /* 将标签推到右边 */
  209. }
  210. .icon-container {
  211. display: flex;
  212. /* 使用 Flexbox 布局 */
  213. flex-direction: row;
  214. /* 水平排列子元素 */
  215. justify-content: flex-end;
  216. /* 子元素右对齐 */
  217. margin-top: -55px;
  218. right: 0;
  219. bottom: 0;
  220. gap: 10px;
  221. /* 设置图标之间的距离 */
  222. }
  223. .img-ding {
  224. width: 83px;
  225. height: 30px;
  226. position: absolute;
  227. right: 0;
  228. top: 0;
  229. margin: 0; // 清除 margin 属性,以避免与边框重叠
  230. }
  231. .btnS {
  232. display: flex;
  233. justify-content: center;
  234. align-items: center;
  235. margin-top: 5px;
  236. }
  237. </style>