list.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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.OUT_STORE_FORM_STATUS,
  20. statusColor: $DictCache.COLOR.OUT_STORE_FORM_STATUS}"
  21. @rowClick="handleDetail"
  22. :page-size="10"
  23. ref="myPage"
  24. >
  25. <template #pageRow="{ recordModel,rowShowParams }">
  26. <view class="mx3 my2 p3 bg-color-white box p-relative"
  27. @longpress="showMask(recordModel.id,$event)">
  28. <common-mask :item="recordModel" :maskId="maskId" @hide='maskId = 0' @del='handleDel(recordModel)' />
  29. <view class="d-flex j-between border-bottom pb-2 a-center">
  30. <view class="text-color-b f-size-26">{{ recordModel.updateTime }}</view>
  31. <my-badge
  32. :text="rowShowParams.statusMap[recordModel.status]"
  33. :status="rowShowParams.statusColor[recordModel.status]"
  34. />
  35. </view>
  36. <view class="mt-2 d-flex j-between pr-3">
  37. <view class="text-color-3 f-size-32 f-weight-bold">{{
  38. recordModel.storeName
  39. }}</view>
  40. <view class="text-color-y f-size-32 f-weight-bold">{{
  41. recordModel.totalPrice
  42. }}</view>
  43. </view>
  44. <view class="d-flex j-end edit-box">
  45. <view
  46. class="text-color-3 f-size-32 edit"
  47. v-if="recordModel.status === rowShowParams.statusValue.NOT_EXECUTE">
  48. <view @click.stop="confirmHandle(recordModel)">提交</view>
  49. </view>
  50. </view>
  51. <view class="d-flex j-end edit-box">
  52. <view
  53. class="text-color-3 f-size-32 edit"
  54. v-if="recordModel.status === rowShowParams.statusValue.EXECUTING">
  55. <view @click.stop="updateStoreBack(recordModel)">撤销</view>
  56. </view>
  57. </view>
  58. </view>
  59. </template>
  60. </my-page>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. export default {
  66. data() {
  67. return {
  68. list: [],
  69. current: 0,
  70. statusMap: {},
  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 formStatusList = this.$DictCache.getChildrenList(this.$DictCache.TYPE.OUT_STORE_FORM_STATUS);
  82. const statusList = [{ label: '全部', value: '' }]
  83. this.list = statusList.concat(formStatusList);
  84. this.statusMap = this.$DictCache.getLabelByValueMapByType(
  85. this.$DictCache.TYPE.OUT_STORE_FORM_STATUS
  86. );
  87. },
  88. onShow() {
  89. this.$nextTick(() => {
  90. this.$refs.myPage.initPage();
  91. })
  92. },
  93. onLoad() {},
  94. onHide() {
  95. this.maskId = 0
  96. },
  97. methods: {
  98. showMask(id, e) {
  99. this.maskId = id
  100. // #ifdef H5
  101. e.preventDefault()
  102. // #endif
  103. },
  104. // tab
  105. change(index, e) {
  106. this.current = index;
  107. this.$refs.myPage.initPage();
  108. },
  109. // 删除
  110. handleDel(recordModel) {
  111. let that = this
  112. let params = []
  113. params.push(recordModel.id)
  114. uni.showModal({
  115. title: '提示',
  116. content: '您确认删除吗?',
  117. success: (res)=> {
  118. if (res.confirm) {
  119. this.$Http.deleteOutStoreForms(params).then(res=>{
  120. uni.showToast({ title:'删除成功' })
  121. that.$refs.myPage.listData = []
  122. that.$refs.myPage.loadMore = true
  123. that.$refs.myPage.pageNum = 1
  124. that.$refs.myPage.initPage();
  125. })
  126. } else if (res.cancel) { }
  127. }
  128. });
  129. },
  130. loadData(parameter) {
  131. // filter: 1,
  132. // status: this.list[this.current].value
  133. return this.$Http
  134. .getOutStoreFormPage({
  135. ...parameter,
  136. status: this.list[this.current].value,
  137. dataScope:{
  138. sortBy:'desc',
  139. sortName:'update_time'
  140. }
  141. })
  142. .then(res => {
  143. const data = res.data;
  144. if (this.$BaseTool.Object.isNotBlank(data)) {
  145. const rows = data.rows;
  146. if (this.$BaseTool.Object.isNotBlank(rows) && rows.length > 0) {
  147. rows.forEach(item => {
  148. item.totalPrice = this.$BaseTool.Amount.formatter(item.totalPrice);
  149. })
  150. }
  151. }
  152. return res.data;
  153. })
  154. },
  155. confirmHandle(item) {
  156. const that = this;
  157. uni.showModal({
  158. title: "提示",
  159. content: "确认提交出库?",
  160. success: function (res) {
  161. if (res.confirm) {
  162. that.$Http.updateOutStore(item).then((res) => {
  163. that.page = 1;
  164. that.loadMore = true;
  165. that.listData = [];
  166. that.$refs.myPage.initPage();
  167. });
  168. }
  169. },
  170. });
  171. },
  172. updateStoreBack(item) {
  173. const that = this;
  174. uni.showModal({
  175. title: "提示",
  176. content: "确认撤销该出库单?",
  177. success: function (res) {
  178. if (res.confirm) {
  179. that.$Http.updateStoreBack(item).then((res) => {
  180. that.page = 1;
  181. that.loadMore = true;
  182. that.listData = [];
  183. that.$refs.myPage.initPage();
  184. });
  185. }
  186. },
  187. });
  188. },
  189. handleClick() {
  190. uni.navigateTo({
  191. url: '/pages/out-store/out-store-add-new'
  192. });
  193. },
  194. // 跳转详情
  195. handleDetail(recordModel) {
  196. if (this.maskId != 0) return this.maskId = 0
  197. uni.navigateTo({
  198. url: '/pages/out-store/out-store-detail?id=' + recordModel.id
  199. });
  200. }
  201. }
  202. };
  203. </script>
  204. <style lang="less">
  205. page {
  206. background-color: #f4f4f4;
  207. }
  208. .box {
  209. border-radius: 20rpx;
  210. padding-right: 0;
  211. }
  212. .edit-box {
  213. padding: 0 30rpx;
  214. margin-top: 40rpx;
  215. .edit {
  216. padding: 8rpx 40rpx;
  217. border: 1px solid #ddd;
  218. border-radius: 20rpx;
  219. font-size: 26rpx;
  220. color: #666;
  221. margin-left: 30rpx;
  222. }
  223. }
  224. </style>