oiling.vue 6.6 KB

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