Invoice.vue 8.7 KB

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