sellerOrderButton.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template name="button">
  2. <view class="button-template">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <view class="btn btn-cancel" v-if="secondHandOrderFlag!=1 && !rechargeGoods" @click.stop="btnConfirm('again',orderID)">再来一单</view>
  6. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',orderID)">取消订单</view>
  7. <!-- <view class="btn btn-cancel" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',orderID)">删除订单</view> -->
  8. <view class="btn btn-cancel" @click.stop="onShareCode(orderID,userID)">分享订单</view>
  9. <view class="btn btn-query" v-if="btnState.isQuery && order.secondHandOrderFlag!=1" @click.stop="btnConfirm('query',order)">查看物流</view>
  10. <view class="btn btn-color" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',orderID)">确认订单</view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default{
  16. name:"button",
  17. props:{
  18. status: {
  19. type:Number
  20. },
  21. orderID: {
  22. type:Number
  23. },
  24. userID:{
  25. type:Number
  26. },
  27. rechargeGoods:{
  28. type:Boolean
  29. },
  30. serviceProviderId:{
  31. type:Number
  32. },
  33. secondHandOrderFlag:{
  34. type:String
  35. }
  36. },
  37. data() {
  38. return{
  39. isShare:true,
  40. shareCode:'',
  41. btnState:this.initStatus(),
  42. mapStateArr:[
  43. {label:'isQuery',val:[4,5,12,13,33,22,23,32,77],status: true},
  44. {label:'isDelete',val:[6],status: true},
  45. {label:'isCancel',val:[0,111],status: true},
  46. {label:'isConfirm',val:[0],status: true},
  47. ]
  48. }
  49. },
  50. created(){
  51. this.initData(this.status)
  52. },
  53. computed: {
  54. },
  55. watch:{
  56. status:{
  57. handler:function(val){
  58. this.initData(val)
  59. },
  60. deep:true//对象内部的属性监听,也叫深度监听
  61. }
  62. },
  63. methods:{
  64. initData(resVal) {
  65. /**
  66. * @分享按钮统一显示
  67. * @按钮根据状态显示
  68. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  69. * @(6)显示[删除订单],其他隐藏
  70. * @(0、111)显示[取消订单],其他隐藏
  71. * @(21,31)只显示分享
  72. * @(13,33)显示[确认收货]和[查看物流]
  73. */
  74. this.btnState = this.initStatus()
  75. this.mapStateArr.forEach(el => {
  76. el.val.forEach(value => {
  77. if(resVal === value){
  78. this.btnState[el.label] = el.status
  79. }
  80. })
  81. })
  82. },
  83. initStatus(){
  84. let btnState= {
  85. isDelete: false,
  86. isCancel: false,
  87. isConfirm: false,
  88. isShare: true
  89. }
  90. return btnState
  91. },
  92. getShareCode(code){
  93. this.shareCode = code
  94. },
  95. onShareCode(oID,uID){
  96. this.$parent.isShareModal = true
  97. this.$parent.btnoRderID = oID,
  98. this.$parent.btnClubUserID = uID
  99. this.$emit('shareConfirm')
  100. },
  101. btnConfirm(type,id){
  102. let data = {
  103. type:type,
  104. orderId:id,
  105. }
  106. this.$emit('buttonConfirm',data)
  107. },
  108. }
  109. }
  110. </script>
  111. <style lang="scss">
  112. .button-template{
  113. width: 100%;
  114. height: auto;
  115. float: left;
  116. background: #FFFFFF;
  117. .button-content{
  118. height: auto;
  119. float: right;
  120. position: relative;
  121. margin: 20rpx 0;
  122. .share-code{
  123. width: 200rpx;
  124. height: 64rpx;
  125. line-height: 64rpx;
  126. color: #2A45FF;
  127. text-align: left;
  128. position: absolute;
  129. font-size: $font-size-28;
  130. font-weight: bold;
  131. left: 24rpx;
  132. top: 24rpx;
  133. }
  134. .btn{
  135. width: 160rpx;
  136. height: 64rpx;
  137. line-height: 64rpx;
  138. font-size:$font-size-26;
  139. color: #FFFFFF;
  140. text-align: center;
  141. border-radius:34rpx;
  142. // float: right;
  143. display: inline-block;
  144. }
  145. .btn-color{
  146. background: $btn-confirm;
  147. // margin: 22rpx 0 22rpx 22rpx;
  148. }
  149. .btn-cancel{
  150. border: 2rpx solid #999999;
  151. background:#FFFFFF;
  152. color: #666666;
  153. // float: left;
  154. margin-right: 15rpx;
  155. }
  156. .btn-delete{
  157. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  158. }
  159. .btn-query{
  160. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  161. }
  162. .btn-confirm{
  163. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  164. }
  165. .btn-share{
  166. background:linear-gradient(315deg,rgba(0,212,150,1) 0%,rgba(126,243,174,1) 100%);
  167. margin-right: 0;
  168. position: relative;
  169. .tips{
  170. width: 160rpx;
  171. height: 34rpx;
  172. padding: 10rpx 10rpx;
  173. background:#E15616;
  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:#E15616;
  187. position: absolute;
  188. bottom: -8rpx;
  189. left: 30rpx;
  190. z-index: -1;
  191. transform:rotate(45deg);
  192. }
  193. }
  194. }
  195. }
  196. }
  197. </style>