supplierDetaileButton.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template name="button">
  2. <view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  3. <!-- 底部按钮 -->
  4. <view class="btn btn-color" @click.stop="onShareCode">
  5. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  6. 分享订单
  7. </view>
  8. <view class="btn btn-color" @click.stop="btnConfirm('record')">发货记录</view>
  9. <view class="btn btn-color" v-if="btnState.isDeliver" @click.stop="btnConfirm('deliver')">发货</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: 702rpx;
  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. .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: 10rpx;
  116. float: right;
  117. }
  118. .btn-color{
  119. background: $btn-confirm;
  120. margin: 22rpx 0 22rpx 22rpx;
  121. .tips{
  122. width: 160rpx;
  123. height: 34rpx;
  124. padding: 10rpx 10rpx;
  125. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  126. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  127. border-radius: 8rpx;
  128. position: absolute;
  129. color: #FFFFFF;
  130. line-height: 34rpx;
  131. font-size: $font-size-24;
  132. text-align: left;
  133. right: 24rpx;
  134. top: -45rpx;
  135. &:before{
  136. content: "";
  137. width: 25rpx;
  138. height: 25rpx;
  139. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  140. position: absolute;
  141. bottom: -8rpx;
  142. right: 30rpx;
  143. z-index: -1;
  144. transform:rotate(45deg);
  145. }
  146. }
  147. }
  148. .btn-cancel{
  149. background:#FFFFFF;
  150. color: #999999;
  151. float: left;
  152. margin: 22rpx 0;
  153. text-align: left;
  154. }
  155. .btn-delete{
  156. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  157. }
  158. .btn-query{
  159. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  160. }
  161. .btn-confirm{
  162. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  163. }
  164. .btn-share{
  165. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  166. margin-right: 0;
  167. position: relative;
  168. .tips{
  169. width: 160rpx;
  170. height: 34rpx;
  171. padding: 10rpx 10rpx;
  172. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  173. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  174. border-radius: 8rpx;
  175. position: absolute;
  176. color: #FFFFFF;
  177. line-height: 34rpx;
  178. font-size: $font-size-24;
  179. text-align: left;
  180. right: 0;
  181. top: -65rpx;
  182. &:before{
  183. content: "";
  184. width: 25rpx;
  185. height: 25rpx;
  186. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  187. position: absolute;
  188. bottom: -8rpx;
  189. right: 30rpx;
  190. z-index: -1;
  191. transform:rotate(45deg);
  192. }
  193. }
  194. }
  195. }
  196. </style>