diningList.vue 5.3 KB

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