敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
1.1 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. export default {
  2. data() {
  3. return {
  4. }
  5. },
  6. computed: {
  7. },
  8. methods: {
  9. // 立即支付
  10. toPayOrder(item){
  11. let api = ''
  12. // if([0, 1].includes(item.shopState)){
  13. api = 'createOrderTwo'
  14. // }else{
  15. // api = 'createSumOrderAgain'
  16. // }
  17. this.$api(api, {
  18. orderId : item.id,
  19. addressId : item.addressId
  20. }, res => {
  21. if(res.code == 200){
  22. uni.requestPaymentWxPay(res)
  23. .then(res => {
  24. uni.showToast({
  25. title: '支付成功',
  26. icon: 'none'
  27. })
  28. this.getData()
  29. }).catch(n => {
  30. this.getData()
  31. })
  32. }
  33. })
  34. },
  35. // 确认收货
  36. confirmOrder(item){
  37. uni.showModal({
  38. title: '您收到货了吗?',
  39. success : e => {
  40. if(e.confirm){
  41. this.$api('confirmOrder', {
  42. orderId : item.id,
  43. }, res => {
  44. this.getData()
  45. })
  46. }
  47. }
  48. })
  49. },
  50. // 取消订单
  51. cancelOrder(item){
  52. uni.showModal({
  53. title: '确认取消订单吗?',
  54. success : e => {
  55. if(e.confirm){
  56. this.$api('cancelOrder', {
  57. orderId : item.id,
  58. }, res => {
  59. this.getData()
  60. })
  61. }
  62. }
  63. })
  64. },
  65. }
  66. }