receive.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view>
  3. <my-add-button @handleClick="handleClick" />
  4. <!-- <view class="border-bottom">
  5. <u-tabs
  6. class="p-fixed left0 right0 zIndex"
  7. :list="list"
  8. :name="'label'"
  9. :is-scroll="false"
  10. :current="current"
  11. @change="change"
  12. ></u-tabs>
  13. </view> -->
  14. <common-tabs :list="list" :current="current" @change="change" />
  15. <view>
  16. <my-page
  17. :loadData="loadData"
  18. :swipe-action="true"
  19. :row-show-params="{statusMap: statusMap,statusValue: $DictCache.VALUE.SPARE_PICK_FORM_STATUS,
  20. statusColor: $DictCache.COLOR.SPARE_PICK_FORM_STATUS}"
  21. @rowClick="handleDetail"
  22. :page-size="10"
  23. ref="myPage"
  24. >
  25. <template #pageRow="{ recordModel,rowShowParams }">
  26. <view
  27. class="mx3 my2 p3 bg-color-white box p-relative"
  28. @longpress="showMask(recordModel.id,$event)">
  29. <common-mask :item="recordModel" :maskId="maskId" @hide="maskId = 0" @del="handleDel(recordModel)" />
  30. <view class="d-flex j-between border-bottom pb-2 a-center">
  31. <view class="text-color-b f-size-26">{{ recordModel.updateTime }}</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 pr-3">
  38. <view class="text-color-3 f-size-32 f-weight-bold">{{
  39. recordModel.storeName
  40. }}</view>
  41. <view class="text-color-y f-size-32 f-weight-bold">{{
  42. recordModel.totalPrice
  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.pickNo }}
  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.NOT_EXECUTE">
  54. <view @click.stop="confirmHandle(recordModel)">提交</view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. </my-page>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. list: [],
  68. current: 0,
  69. statusMap: {},
  70. maskId: 0
  71. };
  72. },
  73. onPullDownRefresh() {
  74. this.$refs.myPage.pagePullDownRefresh();
  75. },
  76. onReachBottom() {
  77. this.$refs.myPage.pageReachBottom();
  78. },
  79. created() {
  80. const formStatusList = this.$DictCache.getChildrenList(this.$DictCache.TYPE.SPARE_PICK_FORM_STATUS);
  81. const statusList = [{ label: '全部', value: '' }]
  82. this.list = statusList.concat(formStatusList);
  83. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  84. this.$DictCache.TYPE.SPARE_PICK_FORM_STATUS
  85. );
  86. },
  87. onShow() {
  88. this.$nextTick(() => {
  89. this.$refs.myPage.initPage();
  90. })
  91. },
  92. onLoad() {},
  93. onHide() {
  94. this.maskId = 0
  95. },
  96. methods: {
  97. showMask(id, e) {
  98. this.maskId = id
  99. // #ifdef H5
  100. e.preventDefault()
  101. // #endif
  102. },
  103. // tab
  104. change(index, e) {
  105. this.current = index;
  106. this.$refs.myPage.initPage();
  107. },
  108. // 删除
  109. handleDel(recordModel) {
  110. const that = this
  111. const params = []
  112. params.push(recordModel.id)
  113. uni.showModal({
  114. title: '提示',
  115. content: '您确认删除吗?',
  116. success: (res) => {
  117. if (res.confirm) {
  118. this.$Http.deleteSparePickForms(params).then(res => {
  119. uni.showToast({ title: '删除成功' })
  120. that.$refs.myPage.listData = []
  121. that.$refs.myPage.loadMore = true
  122. that.$refs.myPage.pageNum = 1
  123. that.$refs.myPage.initPage();
  124. })
  125. } else if (res.cancel) { }
  126. }
  127. });
  128. },
  129. loadData(parameter) {
  130. // filter: 1,
  131. // status: this.list[this.current].value
  132. return this.$Http
  133. .getSparePickFormPage({
  134. ...parameter,
  135. status: this.list[this.current].value,
  136. dataScope: {
  137. sortBy: 'desc',
  138. sortName: 'update_time'
  139. }
  140. })
  141. .then(res => {
  142. const data = res.data;
  143. if (this.$BaseTool.Object.isNotBlank(data)) {
  144. const rows = data.rows;
  145. if (this.$BaseTool.Object.isNotBlank(rows) && rows.length > 0) {
  146. rows.forEach(item => {
  147. item.totalPrice = this.$BaseTool.Amount.formatter(item.totalPrice);
  148. })
  149. }
  150. }
  151. return res.data;
  152. })
  153. },
  154. confirmHandle(item) {
  155. const that = this;
  156. uni.showModal({
  157. title: '提示',
  158. content: '确认提交到仓库?',
  159. success: function (res) {
  160. if (res.confirm) {
  161. that.$Http.updateToOutStore(item).then((res) => {
  162. that.page = 1;
  163. that.loadMore = true;
  164. that.listData = [];
  165. that.$refs.myPage.initPage();
  166. });
  167. }
  168. }
  169. });
  170. },
  171. handleClick() {
  172. uni.navigateTo({
  173. url: '/pages/receive/receive-add-new'
  174. });
  175. },
  176. // 跳转详情
  177. handleDetail(recordModel) {
  178. if (this.maskId != 0) return this.maskId = 0
  179. uni.navigateTo({
  180. url: '/pages/receive/receive-detail?id=' + recordModel.id
  181. });
  182. }
  183. }
  184. };
  185. </script>
  186. <style lang="less">
  187. page {
  188. background-color: #f4f4f4;
  189. }
  190. .box {
  191. border-radius: 20rpx;
  192. padding-right: 0;
  193. }
  194. .edit-box {
  195. padding: 0 30rpx;
  196. margin-top: 40rpx;
  197. .edit {
  198. padding: 8rpx 40rpx;
  199. border: 1px solid #ddd;
  200. border-radius: 20rpx;
  201. font-size: 26rpx;
  202. color: #666;
  203. margin-left: 30rpx;
  204. }
  205. }
  206. </style>