batch-oiling-update.vue 7.8 KB

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