codeList.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="container">
  3. <!-- <view class="header-title flex-y-center box-pack-between">
  4. <view class="flex-y-center">
  5. <view class="rund flex-center" @click="choiceAll()">
  6. <icon type="success_no_circle" size="12" v-if="checkedAll" />
  7. </view>
  8. <text class="ft28">全选</text>
  9. </view>
  10. <view class="ft28 status1" @click="dell">
  11. 一键清空
  12. </view>
  13. </view> -->
  14. <!-- <view class="hg-line"></view> -->
  15. <view class="list">
  16. <view class="item flex-y-center" v-for="(item,index) in list" :key="index">
  17. <!-- <view class="rund" v-if="item.checked">
  18. <view class="rund flex-center" @click="choice(index)">
  19. <icon type="success_no_circle" size="12" v-if="item.checked" />
  20. </view>
  21. </view> -->
  22. <view class="flex-grow-1">
  23. <view class="flex border-b">
  24. <view class="flex-grow-1">
  25. <view class=" flex-y-center">
  26. <view class="rund flex-center" @click="choice(index)">
  27. <icon type="success_no_circle" size="12" v-if="index == act_index" />
  28. </view>
  29. <view class="name">
  30. {{item.pages == "pages/index/index" ? '餐桌码' :
  31. item.pages == "pages/onPay/onPay"?'收款码':item.pages == "pages/lineup/lineup"?'排队取号':''}}
  32. </view>
  33. <!-- <view :class="item.status==1?'status1':'status0'">{{item.status==1?'已开台':'空闲'}}</view> -->
  34. </view>
  35. <view class="flex flex-y-center">
  36. <view class="cell flex flex-y-center ft26" style="color: #999;">
  37. <view class="title">编号:</view>
  38. <view class="desc">{{item.code}}</view>
  39. </view>
  40. </view>
  41. <view class="flex flex-y-center" v-if="item.table_id">
  42. <view class="cell flex flex-y-center ft26" style="color: #999;">
  43. <view class="title">桌号:</view>
  44. <view class="desc">{{item.table_id}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="flex-grow-0">
  49. <image @click="openImg(item.image)" :src="URL+item.image" class="codeImg"></image>
  50. </view>
  51. </view>
  52. <view class="content flex flex-y-center">
  53. <view class="cell flex flex-y-center">
  54. <button @click="onWechat(item)" class="mini-btn" type="primary"
  55. size="mini">{{item.wechat}}</button>
  56. </view>
  57. <view class="cell flex flex-y-center">
  58. <button @click="onAlipay(item)" class="mini-btn" style="background: #007AFF;" type="primary"
  59. size="mini">{{item.alipay}}</button>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="no-more">没有更多内容了~</view>
  65. </view>
  66. <view class="footer-bar">
  67. <view class="content flex flex-center">
  68. <view class="btn" @click="Unbinding">解绑</view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. store_id: "",
  78. list: [],
  79. page: 1,
  80. is_bottom: false,
  81. checkedAll: false,
  82. table_manager: '',
  83. act_index: -1,
  84. URL: getApp().globalData.URL,
  85. }
  86. },
  87. onLoad(options) {
  88. this.store_id = uni.getStorageSync("store_id")
  89. if (options.name) {
  90. uni.setNavigationBarTitle({
  91. title: `${options.name}管理`
  92. })
  93. this.table_manager = options.name || ''
  94. }
  95. },
  96. onShow() {
  97. this.getData();
  98. },
  99. onReachBottom() {
  100. },
  101. methods: {
  102. openImg(img) {
  103. uni.previewImage({
  104. urls: [this.URL + img]
  105. })
  106. },
  107. onWechat(item) {
  108. if (item.is_wechat == 1) {
  109. uni.showToast({
  110. title: "已绑定",
  111. icon: 'none'
  112. })
  113. } else {
  114. uni.showModal({
  115. title: '提示',
  116. content: '确定绑定微信码吗?',
  117. showCancel: true,
  118. success: res => {
  119. if (res.confirm) {
  120. this.common(item.id, 1)
  121. }
  122. }
  123. })
  124. }
  125. },
  126. onAlipay(item) {
  127. if (item.is_alipay == 1) {
  128. uni.showToast({
  129. title: "已绑定",
  130. icon: 'none'
  131. })
  132. } else {
  133. uni.showModal({
  134. title: '提示',
  135. content: '确定绑定支付宝码吗?',
  136. showCancel: true,
  137. success: res => {
  138. if (res.confirm) {
  139. this.common(item.id, 2)
  140. }
  141. }
  142. })
  143. }
  144. },
  145. common(id, type) {
  146. this.request({
  147. url: 'Smdcshop/bind_empty_one',
  148. data: {
  149. id,
  150. type,
  151. }
  152. }).then(res => {
  153. if (res.code == 200) {
  154. uni.showToast({
  155. title: res.message,
  156. icon: 'none'
  157. })
  158. setTimeout(() => {
  159. this.getData();
  160. }, 2000)
  161. }
  162. })
  163. },
  164. Unbinding() {
  165. if (this.act_index < 0) {
  166. uni.showToast({
  167. title: "请选择解绑码",
  168. icon: 'none'
  169. })
  170. return
  171. }
  172. let id = this.list[this.act_index].id;
  173. this.request({
  174. url: 'Smdcshop/empty_code_delete',
  175. data: {
  176. id: id
  177. }
  178. }).then(res => {
  179. if (res.code == 200) {
  180. uni.showToast({
  181. title: res.message,
  182. icon: 'none'
  183. })
  184. setTimeout(() => {
  185. this.act_index = -1
  186. this.getData();
  187. }, 2000)
  188. }
  189. })
  190. },
  191. choice(index) {
  192. this.act_index = index
  193. },
  194. dell(e) {
  195. let arr = getData(this.list);
  196. function getData(col) {
  197. return col
  198. .filter(item => item.checked)
  199. .map(item => item.id);
  200. }
  201. if (arr.length <= 0) {
  202. uni.showToast({
  203. title: '请选择桌台',
  204. icon: "none",
  205. })
  206. return
  207. }
  208. uni.showModal({
  209. content: "清空所有桌台吗?",
  210. success: (r) => {
  211. if (r.confirm) {
  212. this.request({
  213. url: "Smdcshop/tableall_set",
  214. data: {
  215. id: arr.join(","),
  216. }
  217. }).then(res => {
  218. if (res.code == 200) {
  219. this.getData()
  220. }
  221. })
  222. }
  223. }
  224. })
  225. },
  226. getData() {
  227. this.request({
  228. url: 'Smdcshop/empty_code_list',
  229. data: {
  230. store_id: this.store_id
  231. }
  232. }).then(res => {
  233. if (res.code == 200) {
  234. this.list = res.data
  235. }
  236. })
  237. }
  238. }
  239. }
  240. </script>
  241. <style>
  242. @import url("../static/css/common.css");
  243. page {
  244. background-color: #F4F5F7;
  245. }
  246. .border-b{
  247. border-bottom: 1rpx solid #F1F1F1
  248. }
  249. .codeImg {
  250. width: 150rpx;
  251. height: 150rpx;
  252. }
  253. .header-title {
  254. height: 120rpx;
  255. background: #FFF;
  256. position: fixed;
  257. left: 0;
  258. width: 100%;
  259. padding: 0 20rpx;
  260. z-index: 99;
  261. }
  262. .hg-line {
  263. height: 120rpx;
  264. }
  265. .rund {
  266. height: 40rpx;
  267. width: 40rpx;
  268. margin-right: 10rpx;
  269. border: 1rpx solid #ccc;
  270. border-radius: 3px;
  271. }
  272. .list {
  273. padding: 30rpx 25rpx;
  274. }
  275. .list .item {
  276. border-radius: 8rpx;
  277. overflow: hidden;
  278. padding: 0 20rpx;
  279. border-left: 8rpx solid #247EFF;
  280. background-color: #fff;
  281. margin-bottom: 30rpx;
  282. }
  283. .list .item .name {
  284. height: 80rpx;
  285. border-bottom: 1rpx solid #f5f5f5;
  286. font-size: 30rpx;
  287. line-height: 80rpx;
  288. font-weight: bold;
  289. }
  290. .list .item .content {
  291. padding: 20rpx 0 24rpx;
  292. }
  293. .list .item .content .cell {
  294. flex: none;
  295. width: 50%;
  296. box-sizing: border-box;
  297. padding-right: 30rpx;
  298. font-size: 26rpx;
  299. line-height: 37rpx;
  300. color: #666;
  301. }
  302. .list .item .content .cell .title {
  303. color: #99A0AD;
  304. }
  305. .status0 {
  306. background: #007AFF;
  307. color: #FFFFFF;
  308. padding: 4rpx 10rpx;
  309. font-size: 26rpx;
  310. border-radius: 4rpx;
  311. }
  312. .status1 {
  313. border-radius: 4rpx;
  314. color: #FFFFFF;
  315. background: #FF5722;
  316. font-size: 26rpx;
  317. padding: 4rpx 10rpx;
  318. }
  319. </style>