batch-oiling-select.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view>
  3. <my-add-button @handleClick="handleClick" />
  4. <u-popup v-model="popupShow" mode="bottom">
  5. <u-button type="primary" @click="addChange(2)" style="padding-left: 20rpx;padding-right: 20rpx;">批量复制</u-button>
  6. <u-button type="primary" @click="addChange(0)" style="padding-left: 20rpx;padding-right: 20rpx;">扫码填报</u-button>
  7. <u-button type="primary" @click="addChange(1)" style="padding-left: 20rpx;padding-right: 20rpx;">手动填报</u-button>
  8. <!--<u-button type="primary" @click="addChange(3)" style="padding-left: 20rpx;padding-right: 20rpx;">批量确认</u-button>-->
  9. </u-popup>
  10. <common-tabs :list="list" :current="current" @change="change" />
  11. <my-page
  12. :loadData="loadData"
  13. :swipe-action="true"
  14. :row-show-params="{
  15. statusValue: $DictCache.VALUE.SB_OIL_STATUS,
  16. statusMap: statusMap,
  17. statusColor: $DictCache.COLOR.SB_OIL_STATUS,
  18. }"
  19. @rowClick="handleDetail"
  20. :page-size="10"
  21. ref="myPage"
  22. >
  23. <template #pageRow="{ recordModel, rowShowParams }">
  24. <view
  25. class="mx3 my2 p3 bg-color-white box p-relative"
  26. @longpress="showMask(recordModel.id,$event)">
  27. <common-mask :item="recordModel" :maskId="maskId" @hide="maskId = 0" @del="handleDel(recordModel)" />
  28. <view class="d-flex j-between border-bottom pb-2 a-center">
  29. <view class="text-color-b f-size-26">{{
  30. recordModel.updateTime
  31. }}</view>
  32. <my-badge
  33. :text="rowShowParams.statusMap[recordModel.status]"
  34. :status="rowShowParams.statusColor[recordModel.status]"
  35. />
  36. </view>
  37. <view class="mt-2 d-flex j-between">
  38. <view class="text-color-3 f-size-32 f-weight-bold">{{
  39. recordModel.sbName
  40. }}</view>
  41. <view class="text-color-3 f-size-32 f-weight-bold">{{
  42. recordModel.storeName
  43. }}</view>
  44. </view>
  45. <view class="mt-2 d-flex j-between">
  46. <view class="f-size-26 text-color-6 f-weight-4 mt-2">
  47. {{ recordModel.sbNo }}
  48. </view>
  49. </view>
  50. <view class="d-flex j-end edit-box">
  51. <view
  52. class="text-color-3 f-size-32 edit"
  53. v-if="recordModel.status === rowShowParams.statusValue.OIL"
  54. >
  55. <view @click.stop="confirmHandle(recordModel)">确认</view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. </my-page>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. list: [],
  68. statusMap: {},
  69. current: 0,
  70. popupShow: false,
  71. maskId: 0
  72. };
  73. },
  74. onPullDownRefresh() {
  75. this.$refs.myPage.pagePullDownRefresh();
  76. },
  77. onReachBottom() {
  78. this.$refs.myPage.pageReachBottom();
  79. },
  80. created() {
  81. const sbOilStatusList = this.$DictCache.getChildrenList(
  82. this.$DictCache.TYPE.SB_OIL_STATUS
  83. );
  84. const statusList = [{ label: '全部', value: '' }];
  85. sbOilStatusList.forEach((item) => {
  86. if (
  87. item.value !== this.$DictCache.VALUE.SB_OIL_STATUS.APPLY &&
  88. item.value !== this.$DictCache.VALUE.SB_OIL_STATUS.REJECT
  89. ) {
  90. statusList.push(item);
  91. }
  92. });
  93. this.list = statusList;
  94. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  95. this.$DictCache.TYPE.SB_OIL_STATUS
  96. );
  97. },
  98. onShow() {
  99. this.$nextTick(() => {
  100. this.$refs.myPage.initPage();
  101. });
  102. },
  103. onLoad() {},
  104. onHide() {
  105. this.maskId = 0
  106. },
  107. methods: {
  108. addChange(index) {
  109. if (index === 0) {
  110. uni.scanCode({
  111. success(e) {
  112. console.log(e.result);
  113. if (e.result) {
  114. uni.navigateTo({
  115. url: '/pages/oiling/my-oiling-add?sbId=' + e.result
  116. });
  117. }
  118. }
  119. });
  120. } else if (index === 1) {
  121. uni.navigateTo({
  122. url: '/pages/oiling/my-oiling-add'
  123. });
  124. } else if (index === 2) {
  125. this.$Http
  126. .copySbOils({})
  127. .then((res) => {
  128. this.$refs.myPage.pagePullDownRefresh();
  129. });
  130. } else if (index === 3) {
  131. uni.navigateTo({
  132. url: '/pages/oiling/my-oiling-add'
  133. });
  134. }
  135. },
  136. showMask(id, e) {
  137. this.maskId = id
  138. // #ifdef H5
  139. e.preventDefault()
  140. // #endif
  141. },
  142. // tab
  143. change(index, e) {
  144. this.current = index;
  145. this.$refs.myPage.initPage();
  146. },
  147. // 删除
  148. handleDel(recordModel) {
  149. const that = this;
  150. const params = [];
  151. params.push(recordModel.id);
  152. uni.showModal({
  153. title: '提示',
  154. content: '您确认删除吗?',
  155. success: (res) => {
  156. if (res.confirm) {
  157. this.$Http.deleteSbOils(params).then((res) => {
  158. uni.showToast({ title: '删除成功' });
  159. that.$refs.myPage.listData = [];
  160. that.$refs.myPage.loadMore = true;
  161. that.$refs.myPage.pageNum = 1;
  162. that.$refs.myPage.initData();
  163. });
  164. } else if (res.cancel) {
  165. }
  166. }
  167. });
  168. },
  169. loadData(parameter) {
  170. return this.$Http
  171. .getSbOilPage({
  172. ...parameter,
  173. filter: 1,
  174. status: this.list[this.current].value
  175. })
  176. .then((res) => {
  177. this.popupShow = false
  178. return res.data;
  179. });
  180. },
  181. confirmHandle(recordModel) {
  182. uni.navigateTo({
  183. url: '/pages/oiling/my-oiling-detail?confirm=1&id=' + recordModel.id
  184. });
  185. },
  186. // 使其他的列表选择隐藏
  187. handleClick() {
  188. this.popupShow = true
  189. },
  190. // 详情
  191. handleDetail(recordModel) {
  192. if (this.maskId !== 0) { return this.maskId = 0 }
  193. uni.navigateTo({
  194. url: '/pages/oiling/my-oiling-detail?id=' + recordModel.id
  195. });
  196. }
  197. }
  198. };
  199. </script>
  200. <style lang="less">
  201. .main {
  202. .box {
  203. border-radius: unit(20, rpx);
  204. padding-right: 0;
  205. }
  206. }
  207. page {
  208. background-color: #f4f4f4;
  209. }
  210. .edit-box {
  211. padding: 0 30rpx;
  212. margin-top: 40rpx;
  213. .edit {
  214. padding: 8rpx 40rpx;
  215. border: 1px solid #ddd;
  216. border-radius: 20rpx;
  217. font-size: 26rpx;
  218. color: #666;
  219. margin-left: 30rpx;
  220. }
  221. }
  222. </style>