Invoice.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="发货单" @clickLeft="backAdd">
  4. <!--右菜单-->
  5. <!-- <template slot="right">
  6. <u-button type="success" size="small" class="u-reset-button" @click="invoiceSelect"
  7. text="选择发货单"></u-button>
  8. </template> -->
  9. </uni-nav-bar>
  10. <!-- <u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection> -->
  11. <view class="top-wrapper">
  12. <view class="nav_box rx-sc">
  13. <view class="nav_item " :class="{active: current == 0}" @click="handNav(0)">
  14. 发货单</view>
  15. <view class="nav_item" :class="{active: current == 1}" @click="handNav(1)">
  16. 物品明细</view>
  17. <view class="menu_box" @click="handleSearch" v-show="current == 0">
  18. <image class="menu_icon" src="~@/static/moreSearch.svg"></image>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="wrapper">
  23. <u-list v-show="current == 0" @scrolltolower="scrolltolower" class="listContent">
  24. <checkbox-group v-for="(item, index) in dataList" :key="index" @change="e => selectVal(e, item, index)">
  25. <label>
  26. <view class="listBox">
  27. <view class="listBox-sel">
  28. <checkbox :value="item.id" color="#fff" :disabled="item.disabled"
  29. :checked="item.checked" />
  30. </view>
  31. <view class="listBox-con">
  32. <view class="listBox-top">
  33. <view class="listBox-name">
  34. {{ item.contactName }}
  35. </view>
  36. </view>
  37. <view class="listBox-bottom">
  38. <view>发货单编码:{{ item.docNo }}</view>
  39. <view>销售订单编码:{{ item.orderNo }}</view>
  40. <view class="half">是否回执:{{ item.replied == 1?'是':'否' }}</view>
  41. <view class="half">状态:{{ orderStatus(item) }}</view>
  42. <view>创建时间:{{ item.createTime }}</view>
  43. </view>
  44. </view>
  45. </view>
  46. </label>
  47. </checkbox-group>
  48. <u-empty class="noDate" style="margin-top: 20vh" v-if="!dataList.length"></u-empty>
  49. </u-list>
  50. <itemSelect @getDetails="getDetails" ref="itemRef" v-show="current == 1" />
  51. </view>
  52. <view class="footer">
  53. <u-button type="success" size="small" class="u-reset-button" @click="jumpAdd">
  54. <view class="selBtn">选择( {{ checkListLen }} )</view>
  55. </u-button>
  56. </view>
  57. <screen ref="screen" @succeed="cabScreen"></screen>
  58. <u-toast ref="uToast"></u-toast>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. parameterGetByCode
  64. } from '@/api/mainData/index.js';
  65. import screen from './screen.vue'
  66. import itemSelect from './itemSelect.vue'
  67. import {
  68. reviewStatusEnum
  69. } from '@/enum/dict';
  70. import {
  71. saleordersendrecord
  72. } from '@/api/saleManage/saleorder/index.js'
  73. let [isEnd] = [false]
  74. export default {
  75. components: {
  76. screen,
  77. itemSelect
  78. },
  79. computed: {
  80. orderStatus() {
  81. return (row) => {
  82. return reviewStatusEnum[row.reviewStatus].label;
  83. };
  84. },
  85. checkListLen() {
  86. return this.detailsData.id ? 1 : 0
  87. },
  88. },
  89. data() {
  90. return {
  91. contactId: '',
  92. current: 0,
  93. page: 1,
  94. size: 10,
  95. dataList: [],
  96. detailsData: {},
  97. }
  98. },
  99. onLoad({
  100. contactId
  101. }) {
  102. this.contactId = contactId;
  103. this.getList();
  104. // this.getClassify()
  105. },
  106. methods: {
  107. //返回添加页
  108. backAdd() {
  109. uni.navigateBack()
  110. },
  111. invoiceSelect() {
  112. },
  113. handNav(index) {
  114. this.current = index;
  115. },
  116. handleSearch() {
  117. this.$refs.screen.open();
  118. },
  119. cabScreen(params) {
  120. console.log(params, 'params -')
  121. this.page = 1;
  122. this.getList(params);
  123. },
  124. async getList(data = {}) {
  125. let params = {
  126. pageNum: this.page,
  127. reviewStatus: 2,
  128. ...data,
  129. contactId: this.contactId
  130. }
  131. isEnd = false
  132. const res = await saleordersendrecord(params)
  133. if (params.pageNum === 1) {
  134. this.dataList = []
  135. }
  136. this.dataList.push(...res.list)
  137. isEnd = this.dataList.length >= res.count
  138. },
  139. //勾选
  140. selectVal(e, val, index) {
  141. this.$set(this.dataList[index], 'checked', !this.dataList[index].checked)
  142. this.dataList.forEach((item, i) => {
  143. if (item.id != val.id) {
  144. this.$set(this.dataList[i], 'checked', false)
  145. }
  146. })
  147. // 勾选完 查询物品明细
  148. if (val.checked) {
  149. this.$refs.itemRef.getData(this.dataList[index]);
  150. } else {
  151. this.$refs.itemRef.resetTable();
  152. }
  153. this.detailsData = {};
  154. },
  155. // 选择
  156. jumpAdd() {
  157. if (!this.detailsData.id) {
  158. this.$refs.uToast.show({
  159. type: "warning",
  160. message: "请选择一条物品明细数据",
  161. })
  162. return;
  163. }
  164. let obj = this.dataList.filter(item => item.checked)[0];
  165. let data = {
  166. orderCode: obj.docNo,
  167. orderId: obj.id,
  168. tableList: [this.detailsData]
  169. }
  170. uni.$emit('goosData',data);
  171. uni.navigateBack();
  172. },
  173. getDetails(data) {
  174. this.detailsData = data;
  175. },
  176. scrolltolower() {
  177. if (isEnd) return
  178. this.page++
  179. this.getList()
  180. },
  181. },
  182. }
  183. </script>
  184. <style lang="scss" scoped>
  185. @import './invoice.scss';
  186. /deep/.u-subsection__item__text {
  187. font-size: 28rpx !important;
  188. }
  189. .u-reset-button {
  190. position: absolute;
  191. right: 10rpx;
  192. top: 20rpx;
  193. width: 160rpx;
  194. }
  195. .mainBox {
  196. height: 100vh;
  197. display: flex;
  198. flex-direction: column;
  199. .wrapper {
  200. // flex: 1;
  201. height: calc(100vh - 250rpx);
  202. overflow: hidden;
  203. }
  204. //底部按钮
  205. .footer {
  206. height: 45px;
  207. position: relative;
  208. display: flex;
  209. justify-content: space-between;
  210. align-items: center;
  211. bottom: 0;
  212. width: 100%;
  213. height: 50px;
  214. border-top: 1px solid #eeecec;
  215. background-color: #ffffff;
  216. z-index: 999;
  217. .bottom {
  218. margin-left: 10rpx;
  219. }
  220. .u-reset-button {
  221. position: absolute;
  222. right: 10rpx;
  223. top: 20rpx;
  224. width: 150rpx;
  225. }
  226. }
  227. .nav_box {
  228. padding: 6rpx 32rpx;
  229. position: relative;
  230. .nav_item {
  231. font-size: 28rpx;
  232. font-weight: 400;
  233. color: $theme-color;
  234. background: #F0F8F2;
  235. margin-right: 16rpx;
  236. padding: 4rpx 16rpx;
  237. border-radius: 8rpx;
  238. border: 2rpx solid #ACD4B5;
  239. }
  240. .menu_box {
  241. position: absolute;
  242. right: 20rpx;
  243. top: 10rpx;
  244. .menu_icon {
  245. width: 44rpx;
  246. height: 44rpx;
  247. }
  248. }
  249. .active {
  250. background: $theme-color;
  251. border: 2rpx solid $theme-color;
  252. color: #FFF;
  253. }
  254. }
  255. }
  256. </style>