list.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <base-page>
  3. <view class="uni-flex uni-row check-wrap">
  4. <view class="check-head">
  5. <text>核销列表</text>
  6. <text>核销详情</text>
  7. </view>
  8. <view class="check-content">
  9. <view class="left-wrap-content">
  10. <view class="wrap-search-box">
  11. <view class="wrap-search">
  12. <input placeholder="输入核销码" v-model="searchText" @input="search()" placeholder-style="font-size:0.14rem" />
  13. <i class="iconfont icon31sousuo" @click="search()"></i>
  14. </view>
  15. </view>
  16. <block v-if="list.length > 0">
  17. <scroll-view scroll-y="true" class="check-list all-scroll" @scrolltolower="getRecordList">
  18. <view class="item" v-for="(item, index) in list" :key="index" @click="tableDataFn(item)" :class="current_id == item.id ? 'item-hover' : ''">
  19. <view class="item-box">
  20. <view class="head">
  21. <view class="nick-name">核销码:{{ item.verify_code }}</view>
  22. <view class="time">核销时间:{{ $util.timeFormat(item.verify_time, 'y-m-d h:i') }}</view>
  23. </view>
  24. <view class="body">
  25. <text>{{ detailInfo.verifier_name }}</text>
  26. <text>{{ detailInfo.verify_type_name }}核销</text>
  27. </view>
  28. </view>
  29. </view>
  30. </scroll-view>
  31. </block>
  32. <view class="not-record" v-else>暂无数据</view>
  33. </view>
  34. <view class="check-detail text">
  35. <view class="form-content" v-if="detailInfo && Object.keys(detailInfo).length">
  36. <view class="verify-item" v-for="(item, index) in detailInfo.verify_content_json.item_array" :key="index">
  37. <view class="item-img"><image :src="$util.img(item.img.split(',')[0], { size: 'small' })" mode="aspectFit"></image></view>
  38. <view class="item-info">
  39. <view>{{ item.name }}</view>
  40. </view>
  41. </view>
  42. <view class="form-item">
  43. <view class="form-label">核销码:</view>
  44. <view class="form-inline">
  45. <text>{{ detailInfo.verify_code }}</text>
  46. </view>
  47. </view>
  48. <view class="form-item">
  49. <view class="form-label">核销类型:</view>
  50. <view class="form-inline">{{ detailInfo.verify_type_name }}核销</view>
  51. </view>
  52. <view class="form-item">
  53. <view class="form-label">核销员:</view>
  54. <view class="form-inline">{{ detailInfo.verifier_name }}</view>
  55. </view>
  56. <view class="form-item">
  57. <view class="form-label">核销次数:</view>
  58. <view class="form-inline">{{ detailInfo.verify_num }}</view>
  59. </view>
  60. <view class="form-item">
  61. <view class="form-label">核销时间:</view>
  62. <view class="form-inline">{{ $util.timeFormat(detailInfo.verify_time, 'y-m-d h:i') }}</view>
  63. </view>
  64. <view class="form-item" v-if="detailInfo.member_id > 0">
  65. <view class="form-label">所属会员:</view>
  66. <view class="form-inline">{{ detailInfo.nickname }}</view>
  67. </view>
  68. <view class="form-item" v-if="detailInfo.member_id > 0">
  69. <view class="form-label">手机号:</view>
  70. <view class="form-inline">{{ detailInfo.mobile ? detailInfo.mobile : '--' }}</view>
  71. </view>
  72. </view>
  73. <block v-else><image class="detail-empty" :src="$util.img('public/uniapp/cashier/goods_empty.png')" mode="widthFix"></image></block>
  74. </view>
  75. </view>
  76. </view>
  77. </base-page>
  78. </template>
  79. <script>
  80. export default {
  81. data() {
  82. return {
  83. detailInfo: null,
  84. // 初始是请求第几页
  85. page: 1,
  86. // 每次返回数据数
  87. page_size: 20,
  88. list: [],
  89. current_id: 0,
  90. searchText: ''
  91. };
  92. },
  93. onLoad() {
  94. this.getRecordList();
  95. },
  96. methods: {
  97. search() {
  98. this.page = 1;
  99. this.list = [];
  100. this.getRecordList();
  101. },
  102. // 查询项目列表
  103. getRecordList() {
  104. this.$api.sendRequest({
  105. url: '/cashier/storeapi/verify/recordlists',
  106. data: {
  107. page: this.page,
  108. page_size: this.page_size,
  109. search_text: this.searchText
  110. },
  111. success: res => {
  112. if (res.data.list.length == 0) {
  113. this.detailInfo = {};
  114. this.$forceUpdate();
  115. }
  116. if (res.code >= 0 && res.data.list.length != 0) {
  117. this.page += 1;
  118. this.list = this.list.concat(res.data.list);
  119. }
  120. if (this.list.length) {
  121. this.tableDataFn(this.list[0]);
  122. }
  123. }
  124. });
  125. },
  126. tableDataFn(e) {
  127. this.current_id = e.id;
  128. this.getInfo(e.id);
  129. },
  130. to() {
  131. this.$util.redirectTo('/pages/index/home');
  132. },
  133. getInfo(id) {
  134. this.$api.sendRequest({
  135. url: '/cashier/storeapi/verify/recordsdetail',
  136. data: { id: id },
  137. success: res => {
  138. if (res.code >= 0) {
  139. this.detailInfo = null;
  140. this.detailInfo = res.data;
  141. } else {
  142. this.$util.showToast({
  143. title: res.message
  144. });
  145. }
  146. }
  147. });
  148. }
  149. }
  150. };
  151. </script>
  152. <style lang="scss">
  153. .check-wrap {
  154. flex-direction: column;
  155. background-color: #fff;
  156. min-height: 100%;
  157. .check-head {
  158. display: flex;
  159. justify-content: space-around;
  160. line-height: 0.6rem;
  161. font-weight: 500;
  162. height: 0.6rem;
  163. border-top: 0.01rem solid #e6e6e6;
  164. border-bottom: 0.01rem solid #e6e6e6;
  165. text {
  166. width: 5rem;
  167. text-align: center;
  168. font-size: 0.18rem;
  169. border-left: 0.01rem solid #e6e6e6;
  170. box-sizing: border-box;
  171. &:nth-child(2) {
  172. flex: 1;
  173. width: 0;
  174. }
  175. }
  176. }
  177. .check-content {
  178. display: flex;
  179. min-height: calc(100vh - 1rem);
  180. > view {
  181. padding: 0.2rem;
  182. box-sizing: border-box;
  183. }
  184. .left-wrap-content {
  185. display: flex;
  186. flex-direction: column;
  187. height: calc(100vh - 1rem);
  188. padding: 0;
  189. .wrap-search-box {
  190. height: 0.35rem;
  191. border-bottom: 0.01rem solid #e6e6e6;
  192. padding: 0.1rem 0.15rem;
  193. .wrap-search {
  194. background: #f5f5f5;
  195. display: flex;
  196. position: relative;
  197. padding: 0.05rem 0.15rem 0.05rem 0.4rem;
  198. input {
  199. width: 100%;
  200. }
  201. .iconfont {
  202. position: absolute;
  203. left: 0.15rem;
  204. top: 0.08rem;
  205. cursor: pointer;
  206. }
  207. }
  208. }
  209. }
  210. .not-record {
  211. color: #e6e6e6;
  212. font-size: 0.4rem;
  213. margin-top: 3rem;
  214. text-align: center;
  215. width: 5rem;
  216. }
  217. .check-list {
  218. width: 5rem;
  219. height: calc(100% - 0.5rem);
  220. padding: 0;
  221. .item-hover {
  222. background: #f3eeff;
  223. }
  224. .item {
  225. position: relative;
  226. padding: 0.2rem;
  227. border-bottom: 0.01rem solid #e6e6e6;
  228. cursor: pointer;
  229. .name {
  230. font-size: $uni-font-size-lg;
  231. padding-bottom: 0.07rem;
  232. }
  233. .item-box {
  234. .head {
  235. display: flex;
  236. justify-content: space-between;
  237. }
  238. .body {
  239. margin-top: 0.15rem;
  240. display: flex;
  241. justify-content: space-between;
  242. }
  243. .time {
  244. text-align: right;
  245. }
  246. }
  247. .time,
  248. .nick-name {
  249. line-height: 1;
  250. width: 50%;
  251. font-size: $uni-font-size-lg;
  252. }
  253. .type {
  254. position: absolute;
  255. right: 0.25rem;
  256. top: 50%;
  257. transform: translateY(-50%);
  258. }
  259. }
  260. }
  261. .check-detail {
  262. flex: 1;
  263. width: 0;
  264. border-left: 0.01rem solid #e6e6e6;
  265. position: relative;
  266. .detail-empty {
  267. position: absolute;
  268. top: 50%;
  269. left: 50%;
  270. transform: translate(-50%, -50%);
  271. width: 2.1rem;
  272. height: 1.55;
  273. }
  274. .form-content {
  275. margin-top: 0.2rem;
  276. .form-item {
  277. margin-bottom: 0.1rem;
  278. display: flex;
  279. .form-label {
  280. width: 1.6rem;
  281. text-align: right;
  282. padding-right: 0.1rem;
  283. box-sizing: border-box;
  284. height: 0.32rem;
  285. line-height: 0.32rem;
  286. }
  287. .form-inline {
  288. line-height: 0.32rem;
  289. margin-right: 0.1rem;
  290. box-sizing: border-box;
  291. }
  292. }
  293. .verify-item {
  294. display: flex;
  295. padding: 0.15rem;
  296. background: #f5f5f5;
  297. margin-bottom: 0.1rem;
  298. .item-img {
  299. width: 0.8rem;
  300. height: 0.8rem;
  301. display: flex;
  302. align-items: center;
  303. justify-content: center;
  304. image {
  305. width: 100%;
  306. }
  307. }
  308. .item-info {
  309. flex: 1;
  310. width: 0;
  311. margin-left: 0.15rem;
  312. }
  313. }
  314. }
  315. }
  316. }
  317. }
  318. </style>