sellerFreight.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template name="freight">
  2. <view class="freight-template">
  3. <!-- 运费信息 -->
  4. <view class="invoice-freight" @tap.stop="hanldOperationConfim">
  5. <view class="freight-left">
  6. 运费<text class="iconfont icon-yunfeishuoming" @click.stop="showTip"></text>
  7. </view>
  8. <view class="freight-right">
  9. <text>{{freightText}}</text>
  10. <text class="text" v-if="freightData.freightType == '1'">¥{{freightData.freightTypeMoney}}</text>
  11. <text class="iconfont icon-xiayibu"></text>
  12. </view>
  13. </view>
  14. <!--底部选择模态层弹窗组件 -->
  15. <view class="popup spec" :class="specClass" @touchmove.stop.prevent="discard" @click="freightConfim">
  16. <!-- 遮罩层 -->
  17. <view class="mask"></view>
  18. <view class="layer" @tap.stop="discard">
  19. <view class="content">
  20. <view class="freight-ltitle">选择运费</view>
  21. <view class="freight-radio">
  22. <radio-group class="row-group" @change="radioChange">
  23. <label class="row-input" v-for="(item, index) in freightList" :key="item.value">
  24. <radio class="row-radio" :value="item.value" :checked="index === current" color="#E15616"/>
  25. <view class="row-text">{{item.name}}</view>
  26. </label>
  27. </radio-group>
  28. </view>
  29. <view class="freight-group" v-if="freightData.freightType == '1'">
  30. <view class="group-from">
  31. <input class="form-input" type="text" v-model="freightData.freightTypeMoney" placeholder="请填写运费" maxlength="20">
  32. </view>
  33. </view>
  34. <view class="freight-group" v-if="freightData.freightType == '2'">
  35. <text class="text">{{freightText}}</text>
  36. </view>
  37. <view class="freight-group" v-if="freightData.freightType == '3'">
  38. <text class="text">{{freightText}}</text>
  39. </view>
  40. </view>
  41. <view class="btn">
  42. <view class="button add" @click="freightConfim">完成</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default{
  50. name:"freight",
  51. data() {
  52. return{
  53. freightText:'不包邮',
  54. specClass: '',//规格弹窗css类,控制开关动画
  55. freightList:[
  56. {value:'1',name:'不包邮'},
  57. {value:'2',name:'包邮'},
  58. {value:'3',name:'到付'},
  59. ],
  60. current:0,
  61. freightData:{
  62. freightType:'1',
  63. freightTypeMoney:10
  64. }
  65. }
  66. },
  67. created(){
  68. },
  69. computed: {
  70. },
  71. methods:{
  72. freightConfim(){
  73. console.log(this.freightData.freightType);
  74. switch(this.freightData.freightType){
  75. case '1':
  76. this.choiceaFreightFirst(this.freightData.freightType)
  77. break;
  78. case '2':
  79. this.choiceaFreightFirst(this.freightData.freightType)
  80. break;
  81. case '3':
  82. this.choiceaFreightFirst(this.freightData.freightType)
  83. break;
  84. }
  85. },
  86. choiceaFreightFirst(index){
  87. if(index == '1'){
  88. if(this.freightData.freightTypeMoney==''){
  89. this.$util.msg('请填写运费',2000)
  90. return
  91. }
  92. this.$emit('handleChoiceaFreight',this.freightData)
  93. }else{
  94. this.$emit('handleChoiceaFreight',this.freightData)
  95. }
  96. this.hideSpec()
  97. },
  98. showTip(){
  99. this.$emit('showFreightAlert');
  100. },
  101. hideSpec() {//关闭选择数量确认弹窗
  102. this.specClass = 'hide';
  103. setTimeout(() => {
  104. this.specClass = 'none';
  105. }, 200);
  106. },
  107. hanldOperationConfim(data){//显示选择数量确认弹窗
  108. console.log(data)
  109. this.specClass = 'show';
  110. },
  111. radioChange(e) {
  112. this.freightData.freightType = e.target.value;
  113. switch(this.freightData.freightType){
  114. case '1':
  115. this.freightText = '不包邮'
  116. break;
  117. case '2':
  118. this.freightText = '包邮'
  119. break;
  120. case '3':
  121. this.freightText = '到付'
  122. break;
  123. }
  124. for (let i = 0; i < this.freightList.length; i++) {
  125. if (this.freightList[i].value === this.freightType) {
  126. this.current = i;
  127. break;
  128. }
  129. }
  130. },
  131. discard(){
  132. //丢弃
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. .freight-template{
  139. width: 100%;
  140. height: auto;
  141. background: #FFFFFF;
  142. float: left;
  143. margin-top: 24rpx;
  144. .invoice-freight{
  145. width: 702rpx;
  146. padding: 0 24rpx;
  147. height: 88rpx;
  148. line-height: 88rpx;
  149. font-size: $font-size-28;
  150. color: $text-color;
  151. background: #FFFFFF;
  152. float: left;
  153. font-weight: bold;
  154. .freight-left{
  155. float: left;
  156. .icon-yunfeishuoming{
  157. height: 100%;
  158. padding:15rpx;
  159. color: $color-system;
  160. font-weight: normal;
  161. }
  162. }
  163. .freight-right{
  164. float: right;
  165. color: #2A81FF;
  166. .text{
  167. line-height: 88rpx;
  168. color: #ff0000;
  169. margin:0 20rpx;
  170. }
  171. .icon-xiayibu{
  172. line-height: 88rpx;
  173. color: #999999;
  174. font-weight: normal;
  175. }
  176. }
  177. }
  178. }
  179. .freight-ltitle{
  180. width: 100%;
  181. line-height: 60rpx;
  182. height: 60rpx;
  183. font-size: $font-size-28;
  184. color: #333333;
  185. }
  186. .freight-radio{
  187. width: 100%;
  188. height: 88rpx;
  189. line-height: 88rpx;
  190. display: flex;
  191. border-bottom: 1px solid #EBEBEB;
  192. .row-group{
  193. flex:1;
  194. display: flex;
  195. }
  196. .row-input{
  197. flex: 1;
  198. height: 88rpx;
  199. line-height: 88rpx;
  200. }
  201. .row-radio{
  202. float: left;
  203. transform: scale(0.6);
  204. }
  205. .row-text{
  206. font-size: $font-size-24;
  207. color: $text-color;
  208. }
  209. }
  210. .freight-group{
  211. width: 100%;
  212. height: 88rpx;
  213. display: flex;
  214. border-bottom: 1px solid #FFFFFF;
  215. flex-direction: row;
  216. .text{
  217. display: block;
  218. flex: 1;
  219. line-height: 88rpx;
  220. font-size: $font-size-24;
  221. color: #999999;
  222. text-align: left;
  223. padding-left: 10rpx;
  224. }
  225. .group-from{
  226. flex: 1;
  227. height: 40rpx;
  228. padding: 20rpx;
  229. line-height: 40rpx;
  230. align-items: flex-start;
  231. font-size: $font-size-24;
  232. color: $text-color;
  233. background: #F7F7F7;
  234. border-radius: 14rpx;
  235. margin-bottom: 20rpx;
  236. .form-input{
  237. height: 40rpx;
  238. line-height: 40rpx;
  239. flex-grow: 1;
  240. }
  241. }
  242. }
  243. /* 加入购物模态层*/
  244. @keyframes showPopup {
  245. 0% {
  246. opacity: 0;
  247. }
  248. 100% {
  249. opacity: 1;
  250. }
  251. }
  252. @keyframes hidePopup {
  253. 0% {
  254. opacity: 1;
  255. }
  256. 100% {
  257. opacity: 0;
  258. }
  259. }
  260. @keyframes showLayer {
  261. 0% {
  262. transform: translateY(0);
  263. }
  264. 100% {
  265. transform: translateY(-100%);
  266. }
  267. }
  268. @keyframes hideLayer {
  269. 0% {
  270. transform: translateY(-100%);
  271. }
  272. 100% {
  273. transform: translateY(0);
  274. }
  275. }
  276. @keyframes showAmnation {
  277. 0% {
  278. top: -12rpx;
  279. opacity: 0;
  280. }
  281. 50% {
  282. top: -60rpx;
  283. opacity: 1;
  284. }
  285. 100% {
  286. top: -100rpx;
  287. opacity: 0;
  288. }
  289. }
  290. @keyframes hideAmnation {
  291. 0% {
  292. top: -100rpx;
  293. opacity: 0;
  294. }
  295. 100% {
  296. top: -12rpx;
  297. opacity: 0;
  298. }
  299. }
  300. .popup {
  301. position: fixed;
  302. top: 0;
  303. width: 100%;
  304. height: 100%;
  305. z-index: 999;
  306. display: none;
  307. .mask{
  308. position: fixed;
  309. top: 0;
  310. width: 100%;
  311. height: 100%;
  312. z-index: 21;
  313. background-color: rgba(0, 0, 0, 0.6);
  314. }
  315. .layer {
  316. position: fixed;
  317. z-index: 22;
  318. bottom: -460rpx;
  319. width: 702rpx;
  320. padding: 24rpx 24rpx 36rpx 24rpx;
  321. height: 400rpx;
  322. border-radius: 40rpx 40rpx 0 0;
  323. background-color: #fff;
  324. display: flex;
  325. flex-wrap: wrap;
  326. align-content: space-between;
  327. .content {
  328. width: 100%;
  329. }
  330. .btn {
  331. width: 100%;
  332. height: 88rpx;
  333. display: flex;
  334. .button {
  335. width: 702rpx;
  336. height: 88rpx;
  337. color: #fff;
  338. display: flex;
  339. align-items: center;
  340. justify-content: center;
  341. font-size: $font-size-28;
  342. border-radius: 14rpx;
  343. background: $btn-confirm;
  344. }
  345. }
  346. }
  347. &.show {
  348. display: block;
  349. .mask{
  350. animation: showPopup 0.2s linear both;
  351. }
  352. .layer {
  353. animation: showLayer 0.2s linear both;
  354. }
  355. }
  356. &.hide {
  357. display: block;
  358. .mask{
  359. animation: hidePopup 0.2s linear both;
  360. }
  361. .layer {
  362. animation: hideLayer 0.2s linear both;
  363. }
  364. }
  365. &.none {
  366. display: none;
  367. }
  368. &.service {
  369. .row {
  370. margin: 30upx 0;
  371. .title {
  372. font-size: 30upx;
  373. margin: 10upx 0;
  374. }
  375. .description {
  376. font-size: 28upx;
  377. color: #999;
  378. }
  379. }
  380. }
  381. .layer-smimg{
  382. width: 114rpx;
  383. height: 114rpx;
  384. float: left;
  385. border-radius: 10rpx;
  386. margin-right: 24rpx;
  387. image{
  388. width: 114rpx;
  389. height: 114rpx;
  390. border-radius: 10rpx;
  391. }
  392. }
  393. .layer-nunbox{
  394. justify-content: space-between;
  395. align-items: center;
  396. width: 536rpx;
  397. height: 88rpx;
  398. padding: 13rpx 0 0 0;
  399. float: left;
  400. .layer-nunbox-t{
  401. width: 100%;
  402. height:44rpx;
  403. position:relative;
  404. display: flex;
  405. .layer-nunbox-text{
  406. line-height: 44rpx;
  407. font-size: $font-size-28;
  408. }
  409. .number-box{
  410. display: flex;
  411. justify-content: center;
  412. align-items: center;
  413. .iconfont{
  414. font-size: $font-size-32;
  415. padding:0 20rpx;
  416. font-size: $text-color;
  417. }
  418. .btn-input{
  419. width: 62rpx;
  420. height: 48rpx;
  421. line-height: 48rpx;
  422. background: #F8F8F8;
  423. border-radius: 4rpx;
  424. text-align: center;
  425. font-size: $font-size-28;
  426. }
  427. }
  428. .product-step{
  429. position: absolute;
  430. left: 45rpx;
  431. bottom: 0;
  432. height: 44rpx;
  433. background: #FFFFFF;
  434. }
  435. }
  436. .layer-nunbox-b{
  437. width: 100%;
  438. height:44rpx;
  439. margin-top: 13rpx;
  440. }
  441. .text{
  442. line-height: 44rpx;
  443. font-size: $font-size-28;
  444. .p{
  445. color: #FF2A2A;
  446. }
  447. .p:first-child{
  448. margin-left: 30rpx;
  449. }
  450. .p.sm{
  451. font-size: $font-size-24;
  452. }
  453. }
  454. }
  455. }
  456. </style>