ing_ruku.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <template>
  2. <view class="PanKuContainer">
  3. <view
  4. class="goodList"
  5. >
  6. <view
  7. v-for="(item, i) in infoList"
  8. :key="i"
  9. class="goodItem"
  10. >
  11. <view class="skuContainer">
  12. <view
  13. class="header"
  14. :class="item.toggle ? 'open' : ''"
  15. @click="item.toggle = !item.toggle"
  16. >
  17. <!-- <view class="icon"></view>
  18. <view class="name">{{ item.attr }}</view> -->
  19. <view class="top">
  20. <view
  21. class="avatar"
  22. :style="{ backgroundImage: `url(${item.imgurl})` }"
  23. />
  24. <view class="info">
  25. <view class="name">{{ item.name }}</view>
  26. <view class="fixed">一年零一天不满意退钱</view>
  27. </view>
  28. </view>
  29. </view>
  30. <view v-if="item.toggle" class="skuList">
  31. <view class="skuHeader">
  32. <view class="type">规格</view>
  33. <view class="size">尺码</view>
  34. <view class="num">数量</view>
  35. </view>
  36. <view
  37. v-for="(btem, bi) in item.spec"
  38. :key="bi"
  39. class="skuItem"
  40. >
  41. <view class="type color">{{ btem.sex ? '男款' : '女款' }}</view>
  42. <view class="size color">{{ btem.size }}</view>
  43. <view class="num color">{{ btem.num }}</view>
  44. </view>
  45. </view>
  46. <view class="dataAll">
  47. <view class="sex">
  48. 男款:{{ item.men }}{{ unit }}
  49. /
  50. 女款:{{ item.women }}{{ unit }}
  51. </view>
  52. <view class="num">
  53. 合计:<text class="spec">{{ item.total }}{{ unit }}</text>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="beizhu" v-if="remark">
  60. <view class="beizhu_title">备注内容:</view>
  61. <view class="beizhu_cont">{{remark}}</view>
  62. </view>
  63. <view class="reviseBtn" v-if="status">
  64. <view>
  65. <text class="type">{{ infoList.length }}类</text>
  66. <text class="all">共计:</text>
  67. <text class="num">{{ infoList.reduce((a, b) => a + b.total, 0) }}</text>
  68. <text class="unit">{{ unit }}</text>
  69. </view>
  70. <view class="submitBtn" @click="toPublishRuKu">确认入库</view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import { goodsDetail, publishRuKu } from "@/apis/stock.js"
  76. export default {
  77. data() {
  78. return {
  79. remark: '',
  80. status: false,
  81. infoList: [],
  82. unit: '件',
  83. order_id: ''
  84. }
  85. },
  86. watch: {
  87. status(a) {
  88. this.unit = a ? '件' : '套'
  89. }
  90. },
  91. onLoad(e) {
  92. this.status = e.status ? Boolean(Number(e.status)) : false
  93. this.order_id = e.order_id
  94. this.remark = e.remark
  95. this.getRuKuInfo()
  96. },
  97. methods: {
  98. // 获取详情
  99. getRuKuInfo() {
  100. let _this = this
  101. uni.showLoading()
  102. goodsDetail({ id: _this.order_id }).then(res => {
  103. uni.hideLoading()
  104. if (res.code === 200) {
  105. Object.keys(res.data).forEach(k => {
  106. if(res.data[k].spec.length > 0) {
  107. if(res.data[k].spec.length > 1) {
  108. res.data[k].toggle = false
  109. } else {
  110. res.data[k].toggle = true
  111. }
  112. res.data[k].attr = _this.changeKey(k)
  113. res.data[k].men = res.data[k].spec.filter(({ sex }) => sex).reduce((a, b) => a + Number(b.num), 0)
  114. res.data[k].women = res.data[k].spec.filter(({ sex }) => !sex).reduce((a, b) => a + Number(b.num), 0)
  115. res.data[k].total = res.data[k].spec.reduce((a, b) => a + Number(b.num), 0)
  116. _this.infoList.push(res.data[k])
  117. }
  118. })
  119. } else {
  120. uni.showModal({
  121. content: res.message || "获取详情失败",
  122. showCancel: false
  123. })
  124. }
  125. }).catch(() => {
  126. uni.hideLoading()
  127. uni.showModal({
  128. content: "获取详情失败",
  129. showCancel: false
  130. })
  131. })
  132. },
  133. // 确认入库
  134. toPublishRuKu() {
  135. const _this = this
  136. uni.showModal({
  137. content: '入库时请确认商品信息是否正确',
  138. confirmText: '入库',
  139. cancelText: '取消',
  140. success(res) {
  141. if(res.confirm) {
  142. uni.showLoading()
  143. publishRuKu({ id: _this.order_id }).then(res => {
  144. uni.hideLoading()
  145. if(res.code === 200) {
  146. uni.showModal({
  147. content: "入库成功",
  148. showCancel: false,
  149. success(res) {
  150. if(res.confirm) {
  151. uni.navigateBack()
  152. }
  153. }
  154. })
  155. } else {
  156. uni.showModal({
  157. content: res.message || '入库失败',
  158. showCancel: false
  159. })
  160. }
  161. }).catch(() => {
  162. uni.hideLoading()
  163. uni.showModal({
  164. content: "入库失败",
  165. showCancel: false
  166. })
  167. })
  168. }
  169. }
  170. })
  171. },
  172. changeKey(k) {
  173. let out = ''
  174. switch(k) {
  175. case 'hard':
  176. out = '精装版'
  177. break;
  178. case 'new_old':
  179. out = '纯棉版'
  180. break;
  181. case 'old':
  182. out = '高腰版'
  183. break;
  184. case 'simple':
  185. out = '简约版'
  186. break;
  187. case 'youth':
  188. out = '青春版'
  189. break;
  190. default:
  191. out = '简约版'
  192. break
  193. }
  194. return out
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. page{
  201. display: flex;
  202. flex-direction: column;
  203. }
  204. .PanKuContainer {
  205. width: 100%;
  206. flex: 1;
  207. background-color: #F9F9FB;
  208. // padding: 30rpx;
  209. .btn {
  210. width: 140rpx;
  211. height: 56rpx;
  212. border-radius: 8rpx;
  213. background-color: #EA4A41;
  214. color: #FFFFFF;
  215. font-size: 28rpx;
  216. line-height: 56rpx;
  217. text-align: center;
  218. text-align: center;
  219. }
  220. .beizhu {
  221. padding: 30rpx 35rpx;
  222. margin-bottom: 120rpx;
  223. background-color: #fff;
  224. color: #333;
  225. font-size: 28rpx;
  226. &_title {
  227. font-size: 32rpx;
  228. font-weight: bold;
  229. color: #333333;
  230. margin-bottom: 20rpx;
  231. }
  232. &_cont {
  233. background: #F8F8F8;
  234. border-radius: 24rpx;
  235. padding: 30rpx;
  236. }
  237. }
  238. .reviseBtn {
  239. position: fixed;
  240. bottom: 0;
  241. left: 0;
  242. right: 0;
  243. height: 100rpx;
  244. display: flex;
  245. align-items: center;
  246. justify-content: space-between;
  247. background: #FFFFFF;
  248. color: #FFFFFF;
  249. font-size: 32rpx;
  250. padding: 0 30rpx;
  251. .type {
  252. color: #999999;
  253. font-size: 28rpx;
  254. margin-right: 10rpx;
  255. }
  256. .all {
  257. color: #333333;
  258. font-size: 28rpx;
  259. }
  260. .num {
  261. font-size: 40rpx;
  262. color: #EA4A41;
  263. }
  264. .unit {
  265. font-size: 28rpx;
  266. color: #EA4A41;
  267. }
  268. .submitBtn {
  269. width: 192rpx;
  270. height: 68rpx;
  271. line-height: 68rpx;
  272. text-align: center;
  273. border-radius: 68rpx;
  274. background: linear-gradient(to right, #F97C55, #F44545);
  275. color: #FFFFFF;
  276. font-size: 28rpx;
  277. }
  278. }
  279. .goodList {
  280. width: 100%;
  281. .goodItem {
  282. width: 100%;
  283. margin-bottom: 30rpx;
  284. box-sizing: border-box;
  285. .top {
  286. width: 100%;
  287. display: flex;
  288. align-items: stretch;
  289. justify-content: space-between;
  290. // margin-bottom: 40rpx;
  291. .avatar {
  292. width: 160rpx;
  293. height: 130rpx;
  294. background-color: #eeeeee;
  295. background-position: center;
  296. background-size: cover;
  297. background-repeat: no-repeat;
  298. border-radius: 16rpx;
  299. }
  300. .info {
  301. display: flex;
  302. justify-content: center;
  303. flex-direction: column;
  304. flex: 1;
  305. overflow: hidden;
  306. margin-left: 20rpx;
  307. .name {
  308. color: #333333;
  309. font-size: 32rpx;
  310. font-weight: bold;
  311. line-height: 44rpx;
  312. margin-bottom: 20rpx;
  313. }
  314. .fixed {
  315. font-size: 28rpx;
  316. height: 48rpx;
  317. line-height: 48rpx;
  318. // border: 1px solid #F76454;
  319. box-sizing: border-box;
  320. width: 304rpx;
  321. border-radius: 8rpx;
  322. background: #FFF4F3;
  323. color: #FB231F;
  324. text-align: center;
  325. }
  326. }
  327. }
  328. .skuContainer {
  329. width: 100%;
  330. background-color: #ffffff;
  331. box-sizing: border-box;
  332. // border-radius: 24rpx;
  333. overflow: hidden;
  334. .header {
  335. width: 100%;
  336. height: 200rpx;
  337. padding: 0 30rpx;
  338. box-sizing: border-box;
  339. display: flex;
  340. align-items: center;
  341. justify-content: flex-start;
  342. border-bottom: 1px solid #EEEEEE;
  343. .icon {
  344. width: 30rpx;
  345. height: 30rpx;
  346. border-radius: 50%;
  347. background-color: rgba(234, 74, 65, 0.36);
  348. margin-right: 10rpx;
  349. display: flex;
  350. align-items: center;
  351. justify-content: center;
  352. &::before {
  353. content: "";
  354. display: block;
  355. width: 18rpx;
  356. height: 18rpx;
  357. border-radius: 50%;
  358. background-color: #EA4A41;
  359. }
  360. }
  361. .name {
  362. color: #333333;
  363. font-size: 32rpx;
  364. line-height: 44rpx;
  365. }
  366. &::after {
  367. display: block;
  368. content: "";
  369. margin-left: auto;
  370. width: 20rpx;
  371. height: 30rpx;
  372. background-image: url(../../static/new_my/arrow.png);
  373. background-position: center;
  374. background-size: cover;
  375. background-repeat: no-repeat;
  376. }
  377. &.open {
  378. &::after {
  379. transform: rotate(90deg) !important;
  380. }
  381. }
  382. }
  383. .skuList{
  384. width: 100%;
  385. .skuHeader, .skuItem {
  386. width: 100%;
  387. height: 100rpx;
  388. padding: 0 30rpx;
  389. box-sizing: border-box;
  390. display: flex;
  391. align-items: center;
  392. justify-content: space-between;
  393. border-bottom: 1px solid #EEEEEE;
  394. .type, .size, .num {
  395. flex: 1;
  396. overflow: hidden;
  397. display: flex;
  398. align-items: center;
  399. justify-content: center;
  400. }
  401. .color {
  402. font-weight: bold;
  403. color: #333;
  404. }
  405. .type {
  406. justify-content: flex-start;
  407. }
  408. .size{
  409. justify-content: center;
  410. }
  411. .num {
  412. justify-content: flex-end;
  413. }
  414. }
  415. .skuHeader {
  416. color: #999999;
  417. font-size: 28rpx;
  418. line-height: 40rpx;
  419. }
  420. }
  421. .dataAll {
  422. width: 100%;
  423. height: 116rpx;
  424. padding: 0 30rpx;
  425. box-sizing: border-box;
  426. display: flex;
  427. align-items: center;
  428. justify-content: space-between;
  429. .sex {
  430. color: #333333;
  431. font-size: 28rpx;
  432. }
  433. .num {
  434. color: #999999;
  435. font-size: 28rpx;
  436. .spec {
  437. color: #EA4A41 !important;
  438. font-size: 40rpx !important;
  439. font-weight: bolder;
  440. }
  441. }
  442. }
  443. }
  444. }
  445. }
  446. }
  447. </style>