index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. <template>
  2. <!-- 选择发票信息下拉列表 -->
  3. <view>
  4. <view :class="{ mask: invShow }" @touchmove.stop.prevent @click="invClose"></view>
  5. <view class="popup" :class="{ on: invShow }" @touchmove.stop.prevent>
  6. <view class="popup-hd">抬头选择<view class="close" @click="invClose"><text class="iconfont icon-ic_close"></text></view>
  7. </view>
  8. <scroll-view class="popup-bd" scroll-y="true">
  9. <radio-group v-if="invList.length" name="inv" @change="invChange">
  10. <template v-for="(item, index) in invList">
  11. <label v-if="item.type === 1 || item.type === 2 && isSpecial" :key="item.id" :class="{ checked: (invChecked || invId) == item.id }" class="acea-row row-middle item">
  12. <text class="iconfont icon-ic_complete"></text>
  13. <radio class="radio" :value="item.id" :checked="item.id === invChecked" />
  14. <view class="text">
  15. <view class="acea-row row-middle type">{{ item.type === 1 ? '普通' : '专用' }}发票抬头-{{ item.header_type === 1 ? '个人' : '企业' }}</view>
  16. <view class="acea-row row-middle text-bottom">
  17. <view class="text-left">
  18. <view class="acea-row row-middle name-wrap">
  19. <view class="name">{{item.name}}</view>
  20. <view v-if="item.is_default" class="default">默认</view>
  21. </view>
  22. <view class="number">{{item.header_type == 1 ? item.drawer_phone : item.duty_number}}</view>
  23. </view>
  24. <navigator v-if="!isOrder" class="navigator acea-row row-center-wrapper" :url="`/pages/users/user_invoice_form/index?from=order_confirm&id=${item.id}&${urlQuery}`"
  25. hover-class="none"><text class="iconfont icon-ic_edit"></text></navigator>
  26. <navigator v-else class="navigator acea-row row-center-wrapper" :url="`/pages/users/user_invoice_form/index?from=order_details&id=${item.id}&order_id=${orderId}`"
  27. hover-class="none"><text class="iconfont icon-ic_edit"></text></navigator>
  28. </view>
  29. </view>
  30. </label>
  31. </template>
  32. </radio-group>
  33. <view v-else class="empty">
  34. <image class="image" :src="imgHost + '/statics/images/noInvoice.png'"></image>
  35. <view>您还没有添加发票信息哟~</view>
  36. </view>
  37. </scroll-view>
  38. <view class="popup-ft">
  39. <navigator v-if="!isOrder" class="navigator" :url="`/pages/users/user_invoice_form/index?from=order_confirm&${urlQuery}`" hover-class="none">添加新的抬头</navigator>
  40. <navigator v-else class="navigator" :url="`/pages/users/user_invoice_form/index?order_id=${orderId}&from=order_details`" hover-class="none">添加新的抬头</navigator>
  41. <button class="button" plain @click="invCancel">不开发票</button>
  42. <button v-if="isOrder && invList.length" class="button" plain @click="invSub">确认提交</button>
  43. <slot name="buttom"></slot>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. import {
  50. HTTP_REQUEST_URL
  51. } from '@/config/app';
  52. export default {
  53. data() {
  54. return {
  55. invId: 0,
  56. imgHost: HTTP_REQUEST_URL
  57. }
  58. },
  59. props: {
  60. invShow: {
  61. type: Boolean,
  62. default: false
  63. },
  64. invList: {
  65. type: Array,
  66. default () {
  67. return [];
  68. }
  69. },
  70. invChecked: {
  71. type: String,
  72. default: ''
  73. },
  74. isSpecial: {
  75. type: Boolean,
  76. default: false
  77. },
  78. urlQuery: {
  79. type: String,
  80. default: ''
  81. },
  82. isOrder: {
  83. type: Number,
  84. default: 0
  85. },
  86. orderId: {
  87. type: String,
  88. default: ''
  89. }
  90. },
  91. methods: {
  92. invClose(state) {
  93. this.$emit('inv-close');
  94. },
  95. invChange(e) {
  96. if (this.isOrder) {
  97. this.invId = e.detail.value
  98. } else {
  99. this.$emit('inv-change', e.detail.value);
  100. }
  101. },
  102. invSub() {
  103. this.$emit('inv-change', this.invId || this.invChecked);
  104. },
  105. invCancel() {
  106. this.$emit('inv-cancel');
  107. }
  108. },
  109. }
  110. </script>
  111. <style lang="scss" scoped>
  112. /deep/uni-radio .uni-radio-input {
  113. margin-right: 0;
  114. }
  115. .popup {
  116. position: fixed;
  117. bottom: 0;
  118. left: 0;
  119. z-index: 999;
  120. width: 100%;
  121. border-top-left-radius: 32rpx;
  122. border-top-right-radius: 32rpx;
  123. background-color: #F5F5F5;
  124. transform: translateY(100%);
  125. transition: 0.3s;
  126. }
  127. .popup.on {
  128. transform: translateY(0);
  129. }
  130. .popup-hd {
  131. position: relative;
  132. height: 108rpx;
  133. font-size: 32rpx;
  134. line-height: 108rpx;
  135. text-align: center;
  136. color: #333333;
  137. .close {
  138. position: absolute;
  139. top: 50%;
  140. right: 32rpx;
  141. width: 36rpx;
  142. height: 36rpx;
  143. border-radius: 18rpx;
  144. margin-top: -16rpx;
  145. background-color: #EEEEEE;
  146. text-align: center;
  147. line-height: 36rpx;
  148. }
  149. .iconfont {
  150. font-size: 24rpx;
  151. color: #999999;
  152. }
  153. }
  154. .popup-bd {
  155. height: 792rpx;
  156. padding: 24rpx 20rpx 8rpx;
  157. box-sizing: border-box;
  158. .item {
  159. position: relative;
  160. border: 1rpx solid #FFFFFF;
  161. border-radius: 24rpx;
  162. margin-bottom: 20rpx;
  163. background-color: #FFFFFF;
  164. overflow: hidden;
  165. &::after {
  166. content: "";
  167. position: absolute;
  168. top: 0;
  169. right: 0;
  170. border: 36rpx solid #FFFFFF;
  171. }
  172. .icon-ic_complete {
  173. position: absolute;
  174. top: 8rpx;
  175. right: 8rpx;
  176. z-index: 2;
  177. font-size: 32rpx;
  178. color: #FFFFFF;
  179. }
  180. &.checked {
  181. border-color: var(--view-theme);
  182. &::after {
  183. border-color: var(--view-theme);
  184. border-bottom-color: transparent;
  185. border-left-color: transparent;
  186. }
  187. }
  188. }
  189. .radio {
  190. display: none;
  191. }
  192. .text {
  193. flex: 1;
  194. min-width: 0;
  195. }
  196. .text-bottom {
  197. position: relative;
  198. padding: 32rpx 24rpx;
  199. &::before {
  200. content: "";
  201. position: absolute;
  202. top: 0;
  203. right: 24rpx;
  204. left: 24rpx;
  205. border-top: 1rpx solid #eee;
  206. }
  207. }
  208. .name-wrap {
  209. display: inline-flex;
  210. max-width: 100%;
  211. }
  212. .name {
  213. flex: 1;
  214. overflow: hidden;
  215. white-space: nowrap;
  216. text-overflow: ellipsis;
  217. font-weight: 500;
  218. font-size: 28rpx;
  219. line-height: 40rpx;
  220. color: #333333;
  221. }
  222. .default {
  223. height: 34rpx;
  224. padding: 0 8rpx;
  225. border-radius: 8rpx;
  226. margin-left: 8rpx;
  227. background-color: #FCEAE9;
  228. font-size: 22rpx;
  229. line-height: 34rpx;
  230. color: var(--view-theme);
  231. }
  232. .email {
  233. margin-top: 16rpx;
  234. font-size: 24rpx;
  235. color: #666666;
  236. }
  237. .number {
  238. margin-top: 12rpx;
  239. font-size: 24rpx;
  240. line-height: 34rpx;
  241. color: #999999;
  242. }
  243. .text-left {
  244. flex: 1;
  245. min-width: 0;
  246. }
  247. .type {
  248. padding: 24rpx;
  249. font-size: 24rpx;
  250. line-height: 34rpx;
  251. color: #333333;
  252. }
  253. .navigator {
  254. width: 56rpx;
  255. height: 56rpx;
  256. border-radius: 50%;
  257. margin-left: 24rpx;
  258. .iconfont {
  259. font-size: 32rpx;
  260. color: #333333;
  261. }
  262. }
  263. }
  264. .popup-ft {
  265. padding: 20rpx 20rpx calc(20rpx + env(safe-area-inset-bottom));
  266. .navigator {
  267. height: 80rpx;
  268. border-radius: 40rpx;
  269. background-color: var(--view-theme);
  270. font-size: 28rpx;
  271. line-height: 80rpx;
  272. text-align: center;
  273. color: #FFFFFF;
  274. .iconfont {
  275. margin-right: 14rpx;
  276. font-size: 30rpx;
  277. }
  278. }
  279. .button {
  280. height: 80rpx;
  281. border: 1rpx solid var(--view-theme);
  282. border-radius: 40rpx;
  283. margin-top: 24rpx;
  284. font-size: 28rpx;
  285. line-height: 80rpx;
  286. color: var(--view-theme);
  287. }
  288. }
  289. .empty {
  290. padding-top: 58rpx;
  291. font-size: 26rpx;
  292. text-align: center;
  293. color: #999999;
  294. .image {
  295. width: 400rpx;
  296. height: 260rpx;
  297. margin-bottom: 20rpx;
  298. }
  299. }
  300. .mask {
  301. z-index: 990;
  302. }
  303. </style>