supplierDetaileButton.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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" @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. ]
  39. }
  40. },
  41. created(){
  42. this.initData(this.status)
  43. },
  44. computed: {
  45. },
  46. methods:{
  47. initData(resVal) {
  48. /**
  49. * @分享按钮统一显示
  50. * @按钮根据状态显示
  51. * @(1,2)显示[发货]按钮
  52. */
  53. this.btnState = this.initStatus()
  54. this.mapStateArr.forEach(el => {
  55. el.val.forEach(value => {
  56. if(resVal === value){
  57. this.btnState[el.label] = el.status
  58. //console.log(this.btnState[el.label]);
  59. }
  60. })
  61. })
  62. },
  63. initStatus(){
  64. let btnState= {
  65. isQuery: false,
  66. isDelete: false,
  67. isCancel: false,
  68. isConfirm: false,
  69. }
  70. return btnState
  71. },
  72. getShareCode(code){
  73. this.shareCode = code
  74. },
  75. onShareCode(){
  76. this.$parent.isShareModal = true
  77. this.$emit('shareConfirm')
  78. },
  79. btnConfirm(type){
  80. this.$emit('buttonConfirm',type)
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="scss">
  86. .button-template{
  87. width: 100%;
  88. padding:0 24rpx;
  89. height: auto;
  90. background-color: #FFF;
  91. -webkit-box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  92. box-shadow: 0px 3px 10px rgba(51, 51, 51, 0.5);
  93. padding-bottom: 24rpx;
  94. z-index: 999;
  95. box-sizing: border-box;
  96. .share-code{
  97. width: 200rpx;
  98. height: 64rpx;
  99. line-height: 64rpx;
  100. color: #2A45FF;
  101. text-align: left;
  102. position: absolute;
  103. font-size: $font-size-28;
  104. font-weight: bold;
  105. left: 24rpx;
  106. top: 24rpx;
  107. }
  108. .btn{
  109. width: 160rpx;
  110. height: 64rpx;
  111. margin:22rpx;
  112. line-height: 64rpx;
  113. font-size:$font-size-26;
  114. color: #FFFFFF;
  115. text-align: center;
  116. border-radius: 34rpx;
  117. float: right;
  118. }
  119. .btn-color{
  120. background: #ff7a51;
  121. }
  122. .btn-cancel{
  123. background:#FFE6DC;
  124. color: #E15616;
  125. border: 1px solid #E15616;
  126. .tips{
  127. width: 160rpx;
  128. height: 34rpx;
  129. padding: 10rpx 10rpx;
  130. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  131. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  132. border-radius: 8rpx;
  133. position: absolute;
  134. color: #FFFFFF;
  135. line-height: 34rpx;
  136. font-size: $font-size-24;
  137. text-align: left;
  138. right: 24rpx;
  139. top: -45rpx;
  140. &:before{
  141. content: "";
  142. width: 25rpx;
  143. height: 25rpx;
  144. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  145. position: absolute;
  146. bottom: -8rpx;
  147. right: 30rpx;
  148. z-index: -1;
  149. transform:rotate(45deg);
  150. }
  151. }
  152. }
  153. .btn-delete{
  154. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  155. }
  156. .btn-query{
  157. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  158. }
  159. .btn-confirm{
  160. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  161. }
  162. .btn-share{
  163. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  164. margin-right: 0;
  165. position: relative;
  166. .tips{
  167. width: 160rpx;
  168. height: 34rpx;
  169. padding: 10rpx 10rpx;
  170. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  171. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  172. border-radius: 8rpx;
  173. position: absolute;
  174. color: #FFFFFF;
  175. line-height: 34rpx;
  176. font-size: $font-size-24;
  177. text-align: left;
  178. right: 0;
  179. top: -65rpx;
  180. &:before{
  181. content: "";
  182. width: 25rpx;
  183. height: 25rpx;
  184. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  185. position: absolute;
  186. bottom: -8rpx;
  187. right: 30rpx;
  188. z-index: -1;
  189. transform:rotate(45deg);
  190. }
  191. }
  192. }
  193. }
  194. </style>