diningList.vue 5.2 KB

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