supplierDetaileButton.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template name="button">
  2. <view class="button-template clearfix" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  3. <!-- 底部按钮 -->
  4. <view class="btn btn-color" v-if="btnState.isDeliver" @click.stop="btnConfirm('deliver')">发货</view>
  5. <view class="btn btn-cancel" @click.stop="onShareCode">
  6. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  7. 分享订单
  8. </view>
  9. <view class="btn btn-cancel" v-if="btnState.isRecord" @click.stop="btnConfirm('record')">发货记录</view>
  10. </view>
  11. </template>
  12. <script>
  13. export default{
  14. name:"button",
  15. props:{
  16. status:{
  17. type:Number
  18. },
  19. shareCode:{
  20. type:String,
  21. default: ''
  22. }
  23. },
  24. watch:{
  25. status:{
  26. handler:function(val){
  27. this.initData(val)
  28. },
  29. deep:true//对象内部的属性监听,也叫深度监听
  30. }
  31. },
  32. data() {
  33. return{
  34. btnState:this.initStatus(),
  35. isIphoneX:this.$store.state.isIphoneX,
  36. mapStateArr:[
  37. {label:'isDeliver',val:[1,2],status: true},
  38. {label:'isRecord',val:[2,3],status: true},
  39. ]
  40. }
  41. },
  42. created(){
  43. this.initData(this.status)
  44. },
  45. computed: {
  46. },
  47. methods:{
  48. initData(resVal) {
  49. /**
  50. * @分享按钮统一显示
  51. * @按钮根据状态显示
  52. * @(1,2)显示[发货]按钮
  53. */
  54. this.btnState = this.initStatus()
  55. this.mapStateArr.forEach(el => {
  56. el.val.forEach(value => {
  57. if(resVal === value){
  58. this.btnState[el.label] = el.status
  59. //console.log(this.btnState[el.label]);
  60. }
  61. })
  62. })
  63. },
  64. initStatus(){
  65. let btnState= {
  66. isDeliver: false,
  67. isRecord: false,
  68. }
  69. return btnState
  70. },
  71. getShareCode(code){
  72. this.shareCode = code
  73. },
  74. onShareCode(){
  75. this.$parent.isShareModal = true
  76. this.$emit('shareConfirm')
  77. },
  78. btnConfirm(type){
  79. this.$emit('buttonConfirm',type)
  80. }
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. .button-template{
  86. width: 100%;
  87. padding:0 24rpx;
  88. height: auto;
  89. background-color: #FFF;
  90. -webkit-box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  91. box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  92. padding-bottom: 24rpx;
  93. z-index: 999;
  94. box-sizing: border-box;
  95. .share-code{
  96. width: 200rpx;
  97. height: 64rpx;
  98. line-height: 64rpx;
  99. color: #2A45FF;
  100. text-align: left;
  101. position: absolute;
  102. font-size: $font-size-28;
  103. font-weight: bold;
  104. left: 24rpx;
  105. top: 24rpx;
  106. }
  107. .btn{
  108. width: 160rpx;
  109. height: 64rpx;
  110. margin:22rpx;
  111. line-height: 64rpx;
  112. font-size:$font-size-26;
  113. color: #FFFFFF;
  114. text-align: center;
  115. border-radius: 34rpx;
  116. float: right;
  117. }
  118. .btn-color{
  119. background: #ff7a51;
  120. }
  121. .btn-cancel{
  122. background:#FFFFFF;
  123. color: #666666;
  124. border: 1px solid #666666;
  125. .tips{
  126. width: 160rpx;
  127. height: 34rpx;
  128. padding: 10rpx 10rpx;
  129. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  130. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  131. border-radius: 8rpx;
  132. position: absolute;
  133. color: #FFFFFF;
  134. line-height: 34rpx;
  135. font-size: $font-size-24;
  136. text-align: left;
  137. right: 24rpx;
  138. top: -45rpx;
  139. &:before{
  140. content: "";
  141. width: 25rpx;
  142. height: 25rpx;
  143. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  144. position: absolute;
  145. bottom: -8rpx;
  146. right: 30rpx;
  147. z-index: -1;
  148. transform:rotate(45deg);
  149. }
  150. }
  151. }
  152. .btn-delete{
  153. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  154. }
  155. .btn-query{
  156. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  157. }
  158. .btn-confirm{
  159. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  160. }
  161. .btn-share{
  162. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  163. margin-right: 0;
  164. position: relative;
  165. .tips{
  166. width: 160rpx;
  167. height: 34rpx;
  168. padding: 10rpx 10rpx;
  169. background:#E15616;
  170. border-radius: 8rpx;
  171. position: absolute;
  172. color: #FFFFFF;
  173. line-height: 34rpx;
  174. font-size: $font-size-24;
  175. text-align: left;
  176. right: 0;
  177. top: -65rpx;
  178. &:before{
  179. content: "";
  180. width: 25rpx;
  181. height: 25rpx;
  182. background:#E15616;
  183. position: absolute;
  184. bottom: -8rpx;
  185. left: 30rpx;
  186. z-index: -1;
  187. transform:rotate(45deg);
  188. }
  189. }
  190. }
  191. }
  192. </style>