index.vue 15 KB

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