index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. <template>
  2. <view class="apply-return-of-new-piece" style="width: 100%; height: 100vh">
  3. <zj-page-container>
  4. <zj-page-fill>
  5. <view v-if="form">
  6. <view class="input_module">
  7. <view class="input_module_as">
  8. <view class="input_module_as_title"> 申请人 </view>
  9. <view class="input_module_as_en"> {{ form.applyStuffName }}({{ form.applyStuffNumber }}) </view>
  10. </view>
  11. <view class="input_module_as">
  12. <view class="input_module_as_title"> 所属网点 </view>
  13. <view class="input_module_as_en"> {{ form.websitName }} ({{ form.websitNumber }}) </view>
  14. </view>
  15. <view class="input_module_as">
  16. <view class="input_module_as_title"> *申请类别 </view>
  17. <view class="input_module_as_en">
  18. <radio-group
  19. @change="
  20. d => {
  21. form.applyCategory = d.detail.value
  22. }
  23. "
  24. >
  25. <label style="margin-right: 20upx">
  26. <radio value="HOME" :checked="form.applyCategory === 'HOME'" />家用空调
  27. </label>
  28. <label> <radio value="TRADE" :checked="form.applyCategory === 'TRADE'" />商用空调 </label>
  29. <br />
  30. <br />
  31. <label> <radio value="ELEC" :checked="form.applyCategory === 'ELEC'" />生活电器(小家电) </label>
  32. </radio-group>
  33. </view>
  34. </view>
  35. <view class="input_module_as">
  36. <view class="input_module_as_title"> *申请类型 </view>
  37. <view class="input_module_as_en">
  38. <radio-group
  39. @change="
  40. d => {
  41. form.applyType = d.detail.value
  42. }
  43. "
  44. >
  45. <label style="margin-right: 20upx">
  46. <radio value="NEW" :checked="form.applyType === 'NEW'" />新件返还
  47. </label>
  48. <label> <radio value="LOST" :checked="form.applyType === 'LOST'" />破损返还 </label>
  49. <br />
  50. <br />
  51. <label> <radio value="BUG" :checked="form.applyType === 'BUG'" />故障返还 </label>
  52. </radio-group>
  53. </view>
  54. </view>
  55. <view class="input_module_as">
  56. <view class="input_module_as_title"> *返还方式 </view>
  57. <view class="input_module_as_en">
  58. <radio-group
  59. @change="
  60. d => {
  61. form.refundMode = d.detail.value
  62. }
  63. "
  64. >
  65. <label style="margin-right: 20upx">
  66. <radio value="EXPRESS" :checked="form.refundMode === 'EXPRESS'" />物流快递
  67. </label>
  68. <label> <radio value="SELF" :checked="form.refundMode === 'SELF'" />网点自还 </label>
  69. </radio-group>
  70. </view>
  71. </view>
  72. <view class="input_module_as">
  73. <view class="input_module_as_title"> 发出单位 </view>
  74. <view class="input_module_as_en">
  75. {{ form.deliveryUnit }}
  76. </view>
  77. </view>
  78. <view class="input_module_as">
  79. <view class="input_module_as_title"> 接收单位 </view>
  80. <view class="input_module_as_en">
  81. {{ form.receiveUnit }}
  82. </view>
  83. </view>
  84. <view class="input_module_as">
  85. <view class="input_module_as_title"> 收货地址 </view>
  86. <view class="input_module_as_en">
  87. <input
  88. v-model="form.receiveAddr"
  89. style="width: 100%; height: 100%; margin-top: -6upx"
  90. placeholder="请输入"
  91. />
  92. </view>
  93. </view>
  94. <view class="input_module_as">
  95. <view class="input_module_as_title"> 详细地址 </view>
  96. <view class="input_module_as_en">
  97. <input v-model="form.addr" style="width: 100%; height: 100%; margin-top: -6upx" placeholder="请输入" />
  98. </view>
  99. </view>
  100. </view>
  101. <view class="input_module" v-if="form.itemList && form.itemList.length">
  102. <view class="input_module_title">
  103. <text>配件信息</text>
  104. </view>
  105. <view class="input_module_content">
  106. <view class="input_module_apply_info">
  107. <block v-for="(item, index) in form.itemList" :key="index">
  108. <view class="input_module_apply_view">
  109. <view class="input_module_apply_title">
  110. {{ item.partsName }}
  111. </view>
  112. <view class="input_module_apply_num">
  113. <text class="input_module_apply_number">{{ item.partsNumber }}</text>
  114. <view class="input_module_apply_amount">
  115. <text class="apply_amount"> ¥{{ Math.round(item.salesPrice * 100) / 100 }} </text>
  116. <view class="input_module_apply_counter">
  117. <image
  118. @tap="setQty(item, -1)"
  119. src="/static/images/fittingsManagement/jianjian.png"
  120. mode="aspectFill"
  121. ></image>
  122. <text>{{ item.qty }}</text>
  123. <image
  124. @tap="setQty(item, 1)"
  125. src="/static/images/fittingsManagement//jiajia.png"
  126. mode="aspectFill"
  127. ></image>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </block>
  133. <view class="a_combined_sc">
  134. 合计:<text
  135. >¥{{
  136. [
  137. ...(form.itemList || []).map(item => Math.round(item.salesPrice * item.qty * 100) / 100),
  138. 0
  139. ].reduce((a, b) => {
  140. return a + b
  141. })
  142. }}</text
  143. >
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <view class="input_module">
  149. <view class="input_module_title">
  150. <text>备注</text>
  151. </view>
  152. <view class="input_module_content">
  153. <view class="input_remark">
  154. <textarea
  155. v-model="form.remark"
  156. style="width: 100%; height: 100%"
  157. :maxlength="1000"
  158. placeholder-style="color:#999999"
  159. placeholder="请输入备注"
  160. />
  161. </view>
  162. </view>
  163. </view>
  164. </view>
  165. </zj-page-fill>
  166. <bt-container>
  167. <view class="btcon pv30 ph10">
  168. <view class="confirm-btn" @tap.stop="toStateUrl">提交申请</view>
  169. </view>
  170. </bt-container>
  171. </zj-page-container>
  172. </view>
  173. </template>
  174. <script>
  175. import zjPageContainer from '@/components/zj-page-container/zj-page-container.vue'
  176. import zjPageFill from '@/components/zj-page-container/zj-page-fill.vue'
  177. import { getStorage } from '@/common/utils/storage.js'
  178. export default {
  179. components: {
  180. zjPageContainer,
  181. zjPageFill
  182. },
  183. data() {
  184. return {
  185. form: null
  186. }
  187. },
  188. onLoad(option) {
  189. var { salesOrderNo, pushFlag, identity } = option
  190. this.getDetails({
  191. salesOrderNo,
  192. pushFlag,
  193. identity
  194. })
  195. },
  196. computed: {
  197. userInfo() {
  198. return getStorage('user')
  199. },
  200. idcard() {
  201. return this.userInfo.idCard
  202. }
  203. },
  204. methods: {
  205. toStateUrl() {
  206. var newRefundManageItemBeanList = (this.form.itemList || [])
  207. .filter(item => item.qty > 0)
  208. .map(item => {
  209. var { qty, materialGroupId, materialGroupName, partsName, partsNumber, unitId, unitName } = item
  210. return {
  211. qty,
  212. materialGroupId,
  213. materialGroupName,
  214. partsName,
  215. partsNumber,
  216. unitId,
  217. unitName
  218. }
  219. })
  220. if (!newRefundManageItemBeanList || !newRefundManageItemBeanList.length) {
  221. uni.showModal({
  222. title: '提示',
  223. content: '至少选择一条配件记录',
  224. showCancel: false
  225. })
  226. return
  227. }
  228. if (!this.form.applyType) {
  229. uni.showModal({
  230. title: '提示',
  231. content: '申请类型必须选择',
  232. showCancel: false
  233. })
  234. return
  235. }
  236. if (!this.form.refundMode) {
  237. uni.showModal({
  238. title: '提示',
  239. content: '返还方式必须选择',
  240. showCancel: false
  241. })
  242. return
  243. }
  244. if (!this.form.applyCategory) {
  245. uni.showModal({
  246. title: '提示',
  247. content: '申请类别必须选择',
  248. showCancel: false
  249. })
  250. return
  251. }
  252. var {
  253. id,
  254. salesOrderNo,
  255. applyCategory,
  256. applyType,
  257. refundMode,
  258. belongCompany,
  259. websitName,
  260. websitNumber,
  261. workerId,
  262. workerName,
  263. remark
  264. } = this.form
  265. var data = {
  266. salesOrderId: id,
  267. salesOrderNo,
  268. applyCategory,
  269. applyType,
  270. refundMode,
  271. belongCompany,
  272. websitName,
  273. websitNumber,
  274. workerId,
  275. workerName,
  276. remark,
  277. newRefundManageItemBeanList,
  278. receiveWebsitId: this.form.websitId,
  279. receiveWebsitName: this.form.websitName,
  280. receivePartsWebsitNumber: this.form.partsWebsitNumber,
  281. receiveAddress: this.form.receiveAddr,
  282. identity: this.idcard
  283. }
  284. this.$api
  285. .postJson('/app/worker/new-refund/add', data)
  286. .then(res => {
  287. uni.$emit('DataStatisticsOfParts')
  288. this.$navToPage({
  289. url: '/packageAttachment/pages/applyReturnOfNewPiece/state'
  290. })
  291. })
  292. .catch(() => {})
  293. },
  294. getDetails(params) {
  295. this.$api
  296. .post('/app/worker/parts-sales/detail', params)
  297. .then(res => {
  298. if (res.data.itemList && res.data.itemList.length) {
  299. res.data.itemList.map(item => {
  300. item.qty = item.quantity
  301. })
  302. }
  303. this.form = res.data
  304. })
  305. .catch(() => {})
  306. },
  307. setQty(item, num) {
  308. var n = Number(item.qty) + Number(num)
  309. if (n >= 0 && n <= item.quantity) {
  310. item.qty = n
  311. } else if (num == -1) {
  312. uni.showModal({
  313. title: '提示',
  314. content: '数量不能小于0',
  315. showCancel: false
  316. })
  317. } else if (num == 1) {
  318. uni.showModal({
  319. title: '提示',
  320. content: '数量不能大于库存',
  321. showCancel: false
  322. })
  323. }
  324. }
  325. }
  326. }
  327. </script>
  328. <style scoped lang="scss">
  329. .apply-return-of-new-piece {
  330. .input_module {
  331. background: #ffffff;
  332. margin-bottom: 20upx;
  333. .input_module_as {
  334. width: 100%;
  335. height: auto;
  336. display: flex;
  337. flex-direction: row;
  338. flex-wrap: nowrap;
  339. justify-content: space-between;
  340. .input_module_as_title {
  341. width: 200upx;
  342. min-width: 200upx;
  343. height: 88upx;
  344. text-align: left;
  345. font-size: 28upx;
  346. font-family: PingFang SC, PingFang SC-Medium;
  347. font-weight: 500;
  348. text-align: left;
  349. color: #333333;
  350. line-height: 28upx;
  351. box-sizing: border-box;
  352. padding: 30upx;
  353. }
  354. .input_module_as_en {
  355. width: 100%;
  356. box-sizing: border-box;
  357. padding: 30upx 30upx 30upx 0;
  358. }
  359. }
  360. .input_module_title {
  361. width: 100%;
  362. box-sizing: border-box;
  363. padding: 20upx 30upx;
  364. font-size: 16px;
  365. font-family: PingFang SC, PingFang SC-Heavy;
  366. font-weight: 800;
  367. text-align: left;
  368. color: #333333;
  369. line-height: 24px;
  370. }
  371. .input_module_content {
  372. width: 100%;
  373. box-sizing: border-box;
  374. padding: 0 30upx 20upx;
  375. }
  376. .input_remark,
  377. .input_module_apply_info {
  378. width: 100%;
  379. height: auto;
  380. background: #f7f7f7;
  381. border-radius: 20upx;
  382. box-sizing: border-box;
  383. padding: 20upx;
  384. }
  385. .input_module_apply_view {
  386. margin-bottom: 20upx;
  387. .input_module_apply_title {
  388. width: 100%;
  389. font-size: 14px;
  390. font-family: PingFang SC, PingFang SC-Medium;
  391. font-weight: 500;
  392. text-align: left;
  393. color: #333333;
  394. line-height: 60upx;
  395. overflow: hidden;
  396. text-overflow: ellipsis;
  397. white-space: nowrap;
  398. }
  399. .input_module_apply_num {
  400. width: 100%;
  401. box-sizing: border-box;
  402. padding-bottom: 20upx;
  403. border-bottom: 1upx solid #e5e5e5;
  404. display: flex;
  405. justify-content: space-between;
  406. align-items: center;
  407. .input_module_apply_number {
  408. font-size: 28upx;
  409. font-family: PingFang SC, PingFang SC-Medium;
  410. font-weight: 500;
  411. text-align: left;
  412. color: #666666;
  413. }
  414. .input_module_apply_amount {
  415. width: 50%;
  416. display: flex;
  417. justify-content: flex-end;
  418. align-items: center;
  419. .apply_amount {
  420. font-size: 28upx;
  421. font-family: PingFang SC, PingFang SC-Medium;
  422. font-weight: 500;
  423. text-align: right;
  424. color: #333333;
  425. }
  426. .input_module_apply_counter {
  427. width: 45%;
  428. margin-left: 20upx;
  429. display: flex;
  430. justify-content: space-between;
  431. align-items: center;
  432. text {
  433. font-size: 30upx;
  434. font-family: PingFang SC, PingFang SC-Heavy;
  435. font-weight: bold;
  436. text-align: center;
  437. color: #333333;
  438. }
  439. image {
  440. width: 40upx;
  441. min-width: 40upx;
  442. height: 40upx;
  443. min-height: 40upx;
  444. }
  445. }
  446. }
  447. }
  448. }
  449. .a_combined_sc {
  450. width: 100%;
  451. text-align: right;
  452. font-size: 28upx;
  453. font-family: PingFang SC, PingFang SC-Medium;
  454. font-weight: 500;
  455. text-align: right;
  456. color: #666666;
  457. text {
  458. font-size: 32upx;
  459. font-family: PingFang SC, PingFang SC-Heavy;
  460. font-weight: bold;
  461. text-align: right;
  462. color: #e95505;
  463. }
  464. }
  465. }
  466. }
  467. </style>