sellerDetaileButton.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template name="button">
  2. <view class="button-template" :style="{paddingBottom :isIphoneX ? '68rpx' : '0rpx'}">
  3. <!-- 底部按钮 -->
  4. <view class="button-content">
  5. <view class="btn btn-cancel" v-if="secondHandOrderFlag!=1" @click.stop="btnConfirm('again',order)">再来一单</view>
  6. <view class="btn btn-cancel" v-if="btnState.isCancel" @click.stop="btnConfirm('cancel',order)">取消订单</view>
  7. <view class="btn btn-cancel" v-if="btnState.isDelete" @click.stop="btnConfirm('delete',order)">删除订单</view>
  8. <view class="btn btn-share" @click.stop="onShareCode">
  9. <view class="tips" v-if="shareCode">分享码:{{shareCode}}</view>
  10. 分享订单
  11. </view>
  12. <view class="btn btn-color" v-if="btnState.isConfirm" @click.stop="btnConfirm('confirm',order)">确认订单</view>
  13. <view class="btn btn-color" v-if="btnState.isPay && ableUserMoney > 0 && !rechargeGoods" @click.stop="btnConfirm('balance',order)">余额抵扣</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default{
  19. name:"button",
  20. props:{
  21. status:{
  22. type:Number
  23. },
  24. order: {
  25. type:Object
  26. },
  27. ableUserMoney:{
  28. type:Number
  29. },
  30. rechargeGoods:{
  31. type:Boolean
  32. },
  33. shareCode:{
  34. type:String
  35. },
  36. serviceProviderId:{
  37. type:Number
  38. },
  39. secondHandOrderFlag:{
  40. type:String
  41. }
  42. },
  43. watch:{
  44. status:{
  45. handler:function(val){
  46. this.initData(val)
  47. },
  48. deep:true//对象内部的属性监听,也叫深度监听
  49. }
  50. },
  51. data() {
  52. return{
  53. btnState:this.initStatus(),
  54. isIphoneX:this.$store.state.isIphoneX,
  55. invoiceStatus:false,
  56. mapStateArr:[
  57. {label:'isDelete',val:[6],status: true},
  58. {label:'isCancel',val:[0,111],status: true},
  59. {label:'isConfirm',val:[0],status: true},
  60. {label:'isPay',val:[11,12,13,21,22,23,111],status: true},
  61. ]
  62. }
  63. },
  64. created(){
  65. console.log(this.rechargeGoods);
  66. this.initData(this.status)
  67. },
  68. computed: {
  69. },
  70. methods:{
  71. initData(resVal) {
  72. /**
  73. * @分享按钮统一显示
  74. * @按钮根据状态显示
  75. * @(4、5、7、12、22、23、32)显示[查看物流]按钮,其他隐藏
  76. * @(6)显示[删除订单],其他隐藏
  77. * @(0、111)显示[取消订单],其他隐藏
  78. * @(21,31)只显示分享
  79. * @(13,33)显示[确认收货]和[查看物流]
  80. */
  81. this.btnState = this.initStatus()
  82. this.mapStateArr.forEach(el => {
  83. el.val.forEach(value => {
  84. if(resVal === value){
  85. this.btnState[el.label] = el.status
  86. //console.log(this.btnState[el.label]);
  87. }
  88. })
  89. })
  90. },
  91. initStatus(){
  92. let btnState= {
  93. isQuery: false,
  94. isDelete: false,
  95. isCancel: false,
  96. isConfirm: false,
  97. isPay: false,
  98. }
  99. return btnState
  100. },
  101. getShareCode(code){
  102. this.shareCode = code
  103. },
  104. onShareCode(){
  105. if(this.order.onlinePayFlag!= '1'){
  106. this.PayService.PayOrderCheckoutCounter({orderId:this.order.orderID}).then(response =>{
  107. let data = response.data.order
  108. this.invoiceStatus = data.invoiceStatus
  109. //判断线上线下显示
  110. if(this.invoiceStatus){
  111. this.$util.modal('提示','由于商品发票属性的限制,本订单不能进行线上支付,请让客户选择线下转账方式付款','继续分享','知道了',true,() =>{
  112. this.$parent.isShareModal = true
  113. })
  114. }else{
  115. this.$parent.isShareModal = true
  116. }
  117. }).catch(error =>{
  118. this.$util.msg(error.msg,2000)
  119. })
  120. }else{
  121. this.$parent.isShareModal = true
  122. }
  123. // this.$emit('shareConfirm')
  124. },
  125. btnConfirm(type,order){
  126. let data = {
  127. type:type,
  128. orderId:order.orderID,
  129. order:order
  130. }
  131. this.$emit('buttonConfirm',data)
  132. },
  133. }
  134. }
  135. </script>
  136. <style lang="scss">
  137. .button-template{
  138. width: 100%;
  139. height: auto;
  140. position: fixed;
  141. bottom: 0;
  142. left: 0;
  143. background: #FFFFFF;
  144. .button-content{
  145. padding:0 24rpx;
  146. height: auto;
  147. float: right;
  148. position: relative;
  149. margin: 20rpx 0;
  150. .share-code{
  151. width: 200rpx;
  152. height: 64rpx;
  153. line-height: 64rpx;
  154. color: #2A45FF;
  155. text-align: left;
  156. position: absolute;
  157. font-size: $font-size-28;
  158. font-weight: bold;
  159. left: 24rpx;
  160. top: 24rpx;
  161. }
  162. .btn{
  163. width: 160rpx;
  164. height: 64rpx;
  165. // margin:22rpx;
  166. line-height: 64rpx;
  167. font-size:$font-size-26;
  168. color: #FFFFFF;
  169. text-align: center;
  170. border-radius: 34rpx;
  171. float: right;
  172. }
  173. .btn-color{
  174. background: #f94b4b;
  175. // margin: 20rpx 0 20rpx 20rpx;
  176. .tips{
  177. width: 160rpx;
  178. height: 34rpx;
  179. padding: 10rpx 10rpx;
  180. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  181. box-shadow:0px 2px 4px 0px rgba(0,0,0,0.2);
  182. border-radius: 8rpx;
  183. position: absolute;
  184. color: #FFFFFF;
  185. line-height: 34rpx;
  186. font-size: $font-size-24;
  187. text-align: left;
  188. right: 24rpx;
  189. top: -45rpx;
  190. &:before{
  191. content: "";
  192. width: 25rpx;
  193. height: 25rpx;
  194. background:linear-gradient(45deg,rgba(0,0,0,1) 0%,rgba(87,87,87,1) 100%);
  195. position: absolute;
  196. bottom: -8rpx;
  197. right: 30rpx;
  198. z-index: -1;
  199. transform:rotate(45deg);
  200. }
  201. }
  202. }
  203. .btn-cancel{
  204. background:#FFFFFF;
  205. color: #666666;
  206. float: left;
  207. // margin: 22rpx 0;
  208. margin-right: 15rpx;
  209. border: 2rpx solid #999999;
  210. }
  211. .btn-delete{
  212. background:linear-gradient(315deg,rgba(255,163,3,1) 0%,rgba(255,53,1,1) 100%);
  213. }
  214. .btn-query{
  215. background:linear-gradient(135deg,rgba(255,212,129,1) 0%,rgba(198,129,0,1) 100%);
  216. }
  217. .btn-confirm{
  218. background:linear-gradient(315deg,rgba(231,0,0,1) 0%,rgba(255,104,1,1) 100%);
  219. }
  220. .btn-share{
  221. background:#FFFFFF;
  222. color: #666666;
  223. float: left;
  224. // margin: 22rpx 0;
  225. margin-right: 15rpx;
  226. border: 2rpx solid #999999;
  227. position: relative;
  228. .tips{
  229. width: 160rpx;
  230. height: 34rpx;
  231. padding: 10rpx 10rpx;
  232. background:#E15616;
  233. border-radius: 8rpx;
  234. position: absolute;
  235. color: #FFFFFF;
  236. line-height: 34rpx;
  237. font-size: $font-size-24;
  238. text-align: left;
  239. right: 0;
  240. top: -69rpx;
  241. &:before{
  242. content: "";
  243. width: 25rpx;
  244. height: 25rpx;
  245. background:#E15616;
  246. position: absolute;
  247. bottom: -8rpx;
  248. left: 30rpx;
  249. z-index: -1;
  250. transform:rotate(45deg);
  251. }
  252. }
  253. }
  254. }
  255. }
  256. </style>