interestsItem.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <div class="order-item" :key="i">
  3. <!-- <div class="o-top"></div> -->
  4. <div class="o-title">
  5. <span>
  6. <span class="orderSn table-header">{{$t('manage.myOrders.numbers')}}{{item.orderSn}}</span>
  7. <span class="orderTime">{{ item.tradeTime }}</span>
  8. </span>
  9. <span class="table-header">{{$t('manage.myOrders.quantity')}}</span>
  10. <span class="table-header">{{$t('manage.myOrders.subtotal')}}</span>
  11. <span class="table-header">{{$t('manage.myOrders.total1')}}</span>
  12. </div>
  13. <div class="o-detail">
  14. <div class="od-name">
  15. <div>
  16. <p>{{$t('manage.myOrders.memerText')}}</p>
  17. <p>{{$t('manage.Spending.listLabel.payType')}}:{{ PAYSIDMAP[item.payType] }}</p>
  18. <p style="word-break: break-all;" v-if="item.incrementIds" :title="item.incrementIds">{{$t('manage.member.memberPackage')}}:{{ item.incrementIds.join(",") }}</p>
  19. <p v-else>{{$t('manage.member.memberPackage')}}:{{ item.incrementId }}</p>
  20. </div>
  21. </div>
  22. <div class="count">{{item.count}}</div>
  23. <div class="sum">{{item.amount}}</div>
  24. <div class="sum total-momey">{{item.amount}}</div>
  25. </div>
  26. <div class="inovice-con" :class="{'ic-active':item.showInvoice}">
  27. <div class="o-invoiceTitle">
  28. <span>{{$t('manage.myOrders.invoice')}}</span>
  29. <span v-if="getStatus(item) !== 'shipped'" @click="edit"><i class="iconfont icon-edit"></i>{{$t('manage.myOrders.edit')}}</span>
  30. <!-- <span v-else><i class="iconfont icon-choice"></i>发票已寄出</span> -->
  31. </div>
  32. <div class="o-invoice">
  33. <editInvoice :data="getItemInvoice(item)" :orderId='item.id' :invoiceId="item.invoice&&(item.invoice.id)"/>
  34. </div>
  35. </div>
  36. <div class="bottom-area">
  37. <div class="to-pay">
  38. <template v-if="getStatus(item) !== 'expire'">
  39. <span class="cancel btns" @click="changeIvoiceStatus(i,item)">{{item.invoice && item.invoice.type ? $t('manage.myOrders.invoiceInfo') : $t('manage.myOrders.invoice')}}</span>
  40. </template>
  41. </div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import { mapState } from 'vuex'
  47. import editInvoice from '@/components/editInvoice'
  48. import MallConfig from '@/config/mall'
  49. export default {
  50. props: {
  51. item: Object,
  52. i: Number
  53. },
  54. provide () {
  55. return {
  56. hideInvoice: this.hideInvoice,
  57. saveInvoiceData: this.saveInvoice
  58. }
  59. },
  60. data () {
  61. return {
  62. PAYSIDMAP: MallConfig.PAYSIDMAP,
  63. showInvoice: true
  64. }
  65. },
  66. computed: {
  67. ...mapState({
  68. token: state => state.user.token,
  69. language: state => state.language.current,
  70. myorder: state => {
  71. let type = Object.prototype.toString.call(state.user.myorder)
  72. if (type === '[object Object]') {
  73. return state.user.myorder
  74. }
  75. let condition = state.user.myorder && state.user.myorder !== 'null' && type !== '[object Array]'
  76. return condition ? JSON.parse(state.user.myorder) : {}
  77. }
  78. })
  79. },
  80. components: {
  81. editInvoice
  82. },
  83. mounted () {
  84. this.$set(this.item, 'showInvoice', false)
  85. },
  86. methods: {
  87. edit () {
  88. this.showInvoice = false
  89. },
  90. hideInvoice () {
  91. this.showInvoice = true
  92. },
  93. changeIvoiceStatus (i, item) {
  94. // item.showInvoice = !item.showInvoice
  95. // this.$set(this.item, 'showInvoice', item.showInvoice)
  96. this.$bus.$emit('order/showInvoice', {
  97. order: item,
  98. orderId: item.id,
  99. data: this.getItemInvoice(item),
  100. invoiceId: item.invoice&&(item.invoice.id)
  101. })
  102. },
  103. saveInvoice (data) {
  104. this.$set(this.item, 'invoice', data)
  105. },
  106. getItemInvoice (item) {
  107. let invoice = item.invoice
  108. if (!invoice) {
  109. return ''
  110. }
  111. invoice['typeName'] = this.$t(`manage.invoiceTypeName.${invoice.type}`)
  112. return invoice
  113. },
  114. getStatus (item) {
  115. let temp = ''
  116. let sPay = function () {
  117. switch (item.shippingStatus) {
  118. case 'unshipped':
  119. temp = 'unshipped'
  120. break
  121. case 'partShipped':
  122. temp = 'partShipped'
  123. break
  124. case 'shipped':
  125. temp = 'shipped'
  126. break
  127. case 'received':
  128. temp = 'received'
  129. break
  130. default:
  131. break
  132. }
  133. }
  134. let pPay = function () {
  135. switch (item.paymentStatus) {
  136. case 'unpaid':
  137. temp = 'unpaid'
  138. break
  139. case 'paid':
  140. sPay()
  141. break
  142. default:
  143. break
  144. }
  145. }
  146. switch (item.orderStatus) {
  147. case 'unprocessed':
  148. pPay()
  149. break
  150. case 'completed':
  151. temp = 'finish'
  152. break
  153. case 'processed':
  154. sPay()
  155. break
  156. case 'expire':
  157. temp = 'expire'
  158. break
  159. default:
  160. break
  161. }
  162. return temp
  163. },
  164. toPay (item) {
  165. this.$router.push({
  166. name: 'pay',
  167. query: {
  168. payType: 0,
  169. orderId: item.id,
  170. orderType: 0,
  171. orderSn: item.orderSn
  172. }
  173. })
  174. },
  175. async cancal (item) {
  176. this.$toast.showConfirm('warn', this.$t('toast.15'), async () => {
  177. let params = {
  178. orderId: item.id
  179. }
  180. let res = await this.$http({
  181. method: 'post',
  182. data: params,
  183. headers: {
  184. token: this.token
  185. },
  186. url: '/user/order/cancel'
  187. })
  188. let data = res.data
  189. if (data.code === 0) {
  190. return this.$toast.show('success', this.$t('toast.37'), () => {
  191. this.currentPage = this.currentPage >= this.maxPage ? this.maxPage : this.currentPage
  192. this.getList()
  193. })
  194. }
  195. return this.$toast.show('error', this.$t('toast.38'))
  196. })
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="less" scoped>
  202. .text-ellipsis{
  203. overflow:hidden;
  204. white-space: nowrap;
  205. text-overflow: ellipsis;
  206. -o-text-overflow:ellipsis;
  207. }
  208. .order-item {
  209. margin-bottom: 40px;
  210. border: 1px solid #EBEBEB;
  211. .inovice-con{
  212. max-height: 0;
  213. overflow: hidden;
  214. }
  215. .ic-active{
  216. max-height: 500px;
  217. transition: 0.3s ease max-height;
  218. }
  219. .o-top {
  220. color: #68b8f1;
  221. line-height: 60px;
  222. height: 60px;
  223. font-size: 16px;
  224. padding: 0 20px;
  225. user-select: none;
  226. border-bottom: 1px solid #EBEBEB;
  227. }
  228. .o-title,.o-invoiceTitle {
  229. user-select: none;
  230. display: flex;
  231. height: 32px;
  232. padding: 0 20px;
  233. align-items: center;
  234. line-height: 32px;
  235. // border-bottom: 1px solid #EBEBEB;
  236. background: #F7F7F7;
  237. span {
  238. font-size: 14px;
  239. flex: 1;
  240. text-align: center;
  241. &:first-child {
  242. flex: 5;
  243. text-align: left;
  244. }
  245. }
  246. }
  247. .orderSn {
  248. color: #323233;
  249. margin-right: 15px;
  250. }
  251. .o-invoiceTitle{
  252. align-items: center;
  253. .iconfont{
  254. vertical-align: middle;
  255. font-size: 20px;
  256. margin-right: 5px;
  257. }
  258. .icon-edit{
  259. color: #15BEC8;
  260. }
  261. .icon-choice{
  262. color: #02e430;
  263. }
  264. span {
  265. display: inline-block;
  266. vertical-align: middle;
  267. &:last-child{
  268. transform: translateX(11px);
  269. cursor: pointer;
  270. }
  271. &:first-child {
  272. flex: 1;
  273. transform: translateX(0);
  274. text-align: left;
  275. }
  276. }
  277. }
  278. .o-invoice{
  279. display: flex;
  280. align-items: center;
  281. padding: 10px 20px 10px 85px;
  282. color: #4a4a4a;
  283. font-size: 14px;
  284. border-bottom: 1px solid #EBEBEB;
  285. }
  286. .o-detail {
  287. display: flex;
  288. align-items: center;
  289. min-height: 86px;
  290. line-height: 86px;
  291. padding: 0 20px;
  292. color: #4a4a4a;
  293. font-size: 14px;
  294. border-bottom: 1px solid #EBEBEB;
  295. .od-name {
  296. display: flex;
  297. align-items: center;
  298. flex: 5;
  299. .thumbnail {
  300. width: 55px;
  301. margin-right: 10px;
  302. }
  303. p {
  304. line-height: 1.5;
  305. font-size: 14px;
  306. color: #969696;
  307. &:first-of-type{
  308. font-weight: bold;
  309. color: #2d2d2d;
  310. }
  311. }
  312. }
  313. .count {
  314. flex: 1;
  315. text-align: center;
  316. }
  317. .sum {
  318. flex: 1;
  319. text-align: center;
  320. }
  321. }
  322. .sum-price {
  323. display: flex;
  324. height: 40px;
  325. line-height: 40px;
  326. padding: 0 40px;
  327. border-bottom: 1px solid #EBEBEB;
  328. div {
  329. flex: 2;
  330. color: #4a4a4a;
  331. font-size: 14px;
  332. &:last-child {
  333. flex: 1;
  334. text-align: right;
  335. }
  336. }
  337. }
  338. .bottom-area{
  339. position: relative;
  340. .bottom-left{
  341. position: absolute;
  342. top: 50%;
  343. left: 20px;
  344. color: #a0a0a0;
  345. transform: translateY(-50%);
  346. font-size: 14px;
  347. color: #323233;
  348. }
  349. .to-pay {
  350. text-align: right;
  351. height: 50px;
  352. line-height: 50px;
  353. padding: 0 25px;
  354. .cancel {
  355. font-size: 14px;
  356. // border: 1px solid #ccc;
  357. display: inline-block;
  358. text-align: center;
  359. cursor: pointer;
  360. background: #fff;
  361. color: #202020;
  362. border: 1px solid #323233;
  363. width: 104px;
  364. height: 32px;
  365. line-height: 32px;
  366. border-radius: 4px;
  367. }
  368. .pay {
  369. background: #15BEC8;
  370. font-size: 14px;
  371. display: inline-block;
  372. width: 104px;
  373. height: 32px;
  374. line-height: 32px;
  375. color: #fff;
  376. text-align: center;
  377. cursor: pointer;
  378. border-radius: 4px;
  379. }
  380. .expreeNum {
  381. margin-right: 60px;
  382. color: #323233;
  383. }
  384. }
  385. }
  386. }
  387. .table-header {
  388. font-weight: 600;
  389. color: #202020;
  390. }
  391. .total-momey {
  392. font-weight: 400;
  393. color: #202020;
  394. font-size: 20px;
  395. }
  396. </style>