Invoice.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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. 发货单</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 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>
  75. </view>
  76. </label>
  77. </checkbox-group>
  78. <u-empty
  79. class="noDate"
  80. style="margin-top: 20vh"
  81. v-if="!dataList.length"
  82. ></u-empty>
  83. </u-list>
  84. <itemSelect
  85. @getDetails="getDetails"
  86. ref="itemRef"
  87. v-show="current == 1"
  88. />
  89. </view>
  90. <view class="footer">
  91. <u-button
  92. type="success"
  93. size="small"
  94. class="u-reset-button"
  95. @click="jumpAdd"
  96. >
  97. <view class="selBtn">选择( {{ checkListLen }} )</view>
  98. </u-button>
  99. </view>
  100. <screen ref="screen" @succeed="cabScreen"></screen>
  101. <u-toast ref="uToast"></u-toast>
  102. </view>
  103. </template>
  104. <script>
  105. import { parameterGetByCode } from "@/api/mainData/index.js";
  106. import screen from "./screen.vue";
  107. import itemSelect from "./itemSelect.vue";
  108. import { reviewStatusEnum } from "@/enum/dict";
  109. import { saleordersendrecord } from "@/api/saleManage/saleorder/index.js";
  110. let [isEnd] = [false];
  111. export default {
  112. components: {
  113. screen,
  114. itemSelect,
  115. },
  116. computed: {
  117. orderStatus() {
  118. return (row) => {
  119. return reviewStatusEnum[row.reviewStatus].label;
  120. };
  121. },
  122. checkListLen() {
  123. return this.detailsData.id ? 1 : 0;
  124. },
  125. },
  126. data() {
  127. return {
  128. contactId: "",
  129. current: 0,
  130. page: 1,
  131. size: 10,
  132. dataList: [],
  133. detailsData: {},
  134. };
  135. },
  136. onLoad({ contactId }) {
  137. this.contactId = contactId;
  138. this.getList();
  139. // this.getClassify()
  140. },
  141. methods: {
  142. //返回添加页
  143. backAdd() {
  144. uni.navigateBack();
  145. },
  146. invoiceSelect() {},
  147. handNav(index) {
  148. this.current = index;
  149. },
  150. handleSearch() {
  151. this.$refs.screen.open();
  152. },
  153. cabScreen(params) {
  154. console.log(params, "params -");
  155. this.page = 1;
  156. this.getList(params);
  157. },
  158. async getList(data = {}) {
  159. let params = {
  160. pageNum: this.page,
  161. reviewStatus: 2,
  162. ...data,
  163. contactId: this.contactId,
  164. };
  165. isEnd = false;
  166. const res = await saleordersendrecord(params);
  167. if (params.pageNum === 1) {
  168. this.dataList = [];
  169. }
  170. this.dataList.push(...res.list);
  171. isEnd = this.dataList.length >= res.count;
  172. },
  173. //勾选
  174. selectVal(e, val, index) {
  175. this.$set(this.dataList[index], "checked", !this.dataList[index].checked);
  176. this.dataList.forEach((item, i) => {
  177. if (item.id != val.id) {
  178. this.$set(this.dataList[i], "checked", false);
  179. }
  180. });
  181. // 勾选完 查询物品明细
  182. if (val.checked) {
  183. this.$refs.itemRef.getData(this.dataList[index]);
  184. } else {
  185. this.$refs.itemRef.resetTable();
  186. }
  187. this.detailsData = {};
  188. },
  189. // 选择
  190. jumpAdd() {
  191. if (!this.detailsData.id) {
  192. this.$refs.uToast.show({
  193. type: "warning",
  194. message: "请选择一条物品明细数据",
  195. });
  196. return;
  197. }
  198. let obj = this.dataList.filter((item) => item.checked)[0];
  199. let data = {
  200. orderCode: obj.docNo,
  201. orderId: obj.id,
  202. tableList: [this.detailsData],
  203. };
  204. uni.$emit("goosData", data);
  205. uni.navigateBack();
  206. },
  207. getDetails(data) {
  208. this.detailsData = data;
  209. },
  210. scrolltolower() {
  211. if (isEnd) return;
  212. this.page++;
  213. this.getList();
  214. },
  215. },
  216. };
  217. </script>
  218. <style lang="scss" scoped>
  219. @import "./invoice.scss";
  220. /deep/.u-subsection__item__text {
  221. font-size: 28rpx !important;
  222. }
  223. .u-reset-button {
  224. position: absolute;
  225. right: 10rpx;
  226. top: 20rpx;
  227. width: 160rpx;
  228. }
  229. .mainBox {
  230. height: 100vh;
  231. display: flex;
  232. flex-direction: column;
  233. .wrapper {
  234. // flex: 1;
  235. height: calc(100vh - 250rpx);
  236. overflow: hidden;
  237. }
  238. //底部按钮
  239. .footer {
  240. height: 45px;
  241. position: relative;
  242. display: flex;
  243. justify-content: space-between;
  244. align-items: center;
  245. bottom: 0;
  246. width: 100%;
  247. height: 50px;
  248. border-top: 1px solid #eeecec;
  249. background-color: #ffffff;
  250. z-index: 999;
  251. .bottom {
  252. margin-left: 10rpx;
  253. }
  254. .u-reset-button {
  255. position: absolute;
  256. right: 10rpx;
  257. top: 20rpx;
  258. width: 150rpx;
  259. }
  260. }
  261. .nav_box {
  262. padding: 6rpx 32rpx;
  263. position: relative;
  264. .nav_item {
  265. font-size: 28rpx;
  266. font-weight: 400;
  267. color: $theme-color;
  268. background: #f0f8f2;
  269. margin-right: 16rpx;
  270. padding: 4rpx 16rpx;
  271. border-radius: 8rpx;
  272. border: 2rpx solid #acd4b5;
  273. }
  274. .menu_box {
  275. position: absolute;
  276. right: 20rpx;
  277. top: 10rpx;
  278. .menu_icon {
  279. width: 44rpx;
  280. height: 44rpx;
  281. }
  282. }
  283. .active {
  284. background: $theme-color;
  285. border: 2rpx solid $theme-color;
  286. color: #fff;
  287. }
  288. }
  289. }
  290. </style>